Skip to content

Commit

Permalink
a possible way for min data points per time bin
Browse files Browse the repository at this point in the history
  • Loading branch information
amit2011 committed Aug 27, 2023
1 parent 9ea8431 commit c7c76c7
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void remove(String vehicleNumber, String tripId){
}

public int getCount() {
return counter;
return Math.min(counter - OverlapOptimizer.MIN_DEVICES, 1);
}

public Tuple<String, String> getSelfTripVehicleRoute() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
public class OverlapOptimizer {

public static final Logger LOG = LogManager.getLogger(OverlapOptimizer.class);
public static int MIN_DEVICES;

// public enum OptimizingElements{vehicle, GTFS}

Expand All @@ -34,8 +35,9 @@ public class OverlapOptimizer {
private final SigmoidFunction sigmoidFunction;
private double totalNetworkRouteLength= Double.NaN;

public OverlapOptimizer(int timebinSize, String outputPath, SigmoidFunction sigmoidFunction){
public OverlapOptimizer(int timebinSize, String outputPath, SigmoidFunction sigmoidFunction, int minDevicesPerTimeBin){
this.spatialOverlap = new SpatialOverlap(timebinSize);
MIN_DEVICES = minDevicesPerTimeBin;
this.outputPath = outputPath;
this.sigmoidFunction = sigmoidFunction;
String date = new SimpleDateFormat("dd-MM-yy").format(Calendar.getInstance().getTime());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ public class DelhiGTFSOverlapIdentifier {
public static void main(String[] args) {
String GTFS_PATH = "..\\..\\repos\\sl-repos\\shared\\data\\project_data\\delhi\\gtfs_files\\\\12052021\\GTFS_DIMTS_12052021.zip";
int timebinSize = 24*60*60;
int freqDataPointsDevice = 1;
int minDataPointsPerTimeBin = 40; // configurable
int minDevicesPerTimeBin = (int) Math.ceil( (freqDataPointsDevice* timebinSize/60) / minDataPointsPerTimeBin );

String outFilePath = "..\\..\\repos\\sl-repos\\shared\\data\\project_data\\delhi\\gtfs_files\\25052021\\gtfs_overlap_prob_24hTimebin_excludingSelfTrips\\";

OverlapOptimizer optimizer = new OverlapOptimizer(timebinSize, outFilePath, SigmoidFunction.BipolarSigmoid);
OverlapOptimizer optimizer = new OverlapOptimizer(timebinSize, outFilePath, SigmoidFunction.BipolarSigmoid, minDevicesPerTimeBin);
optimizer.initializeWithGTFS(GTFS_PATH);
// optimizer.run(10);
optimizer.optimizeTillProb(0.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@
*/

public class DelhiVehicleOverlapIdentifier {



public static void main(String[] args) {
String GTFS_PATH = FileUtils.SVN_PROJECT_DATA_DRIVE+"\\delhi\\gtfs_files\\\\12052021\\GTFS_DIMTS_12052021.zip";
String vehicles_file = FileUtils.SVN_PROJECT_DATA_DRIVE+"\\delhi\\dimts\\Mar2021\\VehicleSampleData.txt";

int timebinSize = 24*60*60;
int freqDataPointsDevice = 1;
int minDataPointsPerTimeBin = 40; // configurable
int minDevicesPerTimeBin = (int) Math.ceil( (freqDataPointsDevice* timebinSize) / minDataPointsPerTimeBin );


String outFilePath = FileUtils.SVN_PROJECT_DATA_DRIVE+"\\delhi\\gtfs_files\\02122021\\vehicles_overlap_prob_24hTimebin_excludingSelfTrips\\";

OverlapOptimizer optimizer = new OverlapOptimizer(timebinSize, outFilePath, SigmoidFunction.BipolarSigmoid);
OverlapOptimizer optimizer = new OverlapOptimizer(timebinSize, outFilePath, SigmoidFunction.BipolarSigmoid, minDevicesPerTimeBin);
optimizer.initializeWithGTFSAndVehicles(GTFS_PATH, vehicles_file);
// optimizer.run(10);
optimizer.optimizeTillProb(0.0);
Expand Down

0 comments on commit c7c76c7

Please sign in to comment.