@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | assert(!is_null($addressRand), "Cannot retrieve random address"); |
25 | 25 | |
26 | 26 | if (isset($addressRand['is_depot'])) { |
27 | - if ($addressRand['is_depot']) { |
|
28 | - echo 'This address is depot! Try again.'; |
|
27 | + if ($addressRand['is_depot']) { |
|
28 | + echo 'This address is depot! Try again.'; |
|
29 | 29 | |
30 | - return; |
|
31 | - } |
|
30 | + return; |
|
31 | + } |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $route_destination_id = $addressRand['route_destination_id']; |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | |
38 | 38 | // Remove the destination from the optimization |
39 | 39 | $params = [ |
40 | - 'optimization_problem_id' => $optimization_problem_id, |
|
41 | - 'route_destination_id' => $route_destination_id, |
|
40 | + 'optimization_problem_id' => $optimization_problem_id, |
|
41 | + 'route_destination_id' => $route_destination_id, |
|
42 | 42 | ]; |
43 | 43 | |
44 | 44 | $result = $optimization->removeAddress($params); |
@@ -23,21 +23,21 @@ discard block |
||
23 | 23 | $addresses = []; |
24 | 24 | |
25 | 25 | $params = [ |
26 | - 'route_id' => $routeId, |
|
27 | - 'addresses' => [ |
|
28 | - '0' => [ |
|
29 | - 'address' => 'Cabo Rojo, Cabo Rojo 00623, Puerto Rico', |
|
30 | - 'alias' => '', |
|
31 | - 'lat' => 18.086627, |
|
32 | - 'lng' => -67.145735, |
|
33 | - 'curbside_lat' => 18.086627, |
|
34 | - 'curbside_lng' => -67.145735, |
|
35 | - 'is_departed' => false, |
|
36 | - 'is_visited' => false, |
|
37 | - 'sequence_no' => 3, |
|
38 | - ], |
|
39 | - ], |
|
40 | - 'optimal_position' => false, |
|
26 | + 'route_id' => $routeId, |
|
27 | + 'addresses' => [ |
|
28 | + '0' => [ |
|
29 | + 'address' => 'Cabo Rojo, Cabo Rojo 00623, Puerto Rico', |
|
30 | + 'alias' => '', |
|
31 | + 'lat' => 18.086627, |
|
32 | + 'lng' => -67.145735, |
|
33 | + 'curbside_lat' => 18.086627, |
|
34 | + 'curbside_lng' => -67.145735, |
|
35 | + 'is_departed' => false, |
|
36 | + 'is_visited' => false, |
|
37 | + 'sequence_no' => 3, |
|
38 | + ], |
|
39 | + ], |
|
40 | + 'optimal_position' => false, |
|
41 | 41 | ]; |
42 | 42 | |
43 | 43 | $route1 = new Route(); |
@@ -51,5 +51,5 @@ discard block |
||
51 | 51 | assert(isset($result->addresses), "Cannot insert a destination into the route"); |
52 | 52 | |
53 | 53 | foreach ($result->addresses as $address) { |
54 | - echo 'Address -> '.$address->address, ', Sequence number -> '.$address->sequence_no.'<br>'; |
|
54 | + echo 'Address -> '.$address->address, ', Sequence number -> '.$address->sequence_no.'<br>'; |
|
55 | 55 | } |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | $addressRand = (array) $route->GetRandomAddressFromRoute($routeId); |
22 | 22 | |
23 | 23 | if (isset($addressRand['is_depot'])) { |
24 | - if ($addressRand['is_depot']) { |
|
25 | - echo "Random chosen address is depot, it cannot be marked!.. Try again."; |
|
24 | + if ($addressRand['is_depot']) { |
|
25 | + echo "Random chosen address is depot, it cannot be marked!.. Try again."; |
|
26 | 26 | |
27 | - return; |
|
28 | - } |
|
27 | + return; |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $address_id = $addressRand['route_destination_id']; |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | |
35 | 35 | // Mark the address as detected as visited |
36 | 36 | $addressParameters = (array) Address::fromArray([ |
37 | - 'route_id' => $routeId, |
|
38 | - 'route_destination_id' => $address_id, |
|
39 | - 'is_visited' => true, |
|
37 | + 'route_id' => $routeId, |
|
38 | + 'route_destination_id' => $address_id, |
|
39 | + 'is_visited' => true, |
|
40 | 40 | ]); |
41 | 41 | |
42 | 42 | $address = new Address(); |
@@ -14,8 +14,8 @@ discard block |
||
14 | 14 | $route = new Route(); |
15 | 15 | |
16 | 16 | $grParams = [ |
17 | - 'offset' => 0, |
|
18 | - 'limit' => 10, |
|
17 | + 'offset' => 0, |
|
18 | + 'limit' => 10, |
|
19 | 19 | ]; |
20 | 20 | |
21 | 21 | $routes = $route->getRoutes($grParams); |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | echo '<br> From the route -> '.$route_id0.'<br>'; |
31 | 31 | |
32 | 32 | if (is_null($route_id0)) { |
33 | - echo "Cannot retrieve random route_id! Try again."; |
|
33 | + echo "Cannot retrieve random route_id! Try again."; |
|
34 | 34 | |
35 | - return; |
|
35 | + return; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | // Get random source destination from selected source route above |
@@ -47,15 +47,15 @@ discard block |
||
47 | 47 | $to_route_id = $route_id0; |
48 | 48 | |
49 | 49 | while ($to_route_id == $route_id0) { |
50 | - $to_route_id = $routes[rand(0, sizeof($routes) - 1)]->route_id; |
|
50 | + $to_route_id = $routes[rand(0, sizeof($routes) - 1)]->route_id; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | echo '<br> to the route -> '.$to_route_id.'<br>'; |
54 | 54 | |
55 | 55 | if (is_null($to_route_id)) { |
56 | - echo "Cannot retrieve random route_id! Try again."; |
|
56 | + echo "Cannot retrieve random route_id! Try again."; |
|
57 | 57 | |
58 | - return; |
|
58 | + return; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // Get random destination destination from selected source route above |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | $after_destination_id = $addressRand2['route_destination_id']; |
65 | 65 | |
66 | 66 | if (is_null($after_destination_id)) { |
67 | - echo "Cannot retrieve random address! Try again."; |
|
67 | + echo "Cannot retrieve random address! Try again."; |
|
68 | 68 | |
69 | - return; |
|
69 | + return; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | echo "after_destination_id = $after_destination_id <br>"; |
73 | 73 | |
74 | 74 | // Move the destination to the route |
75 | 75 | $routeParams = [ |
76 | - 'to_route_id' => $to_route_id, |
|
77 | - 'route_destination_id' => strval($route_destination_id), |
|
78 | - 'after_destination_id' => strval($after_destination_id), |
|
76 | + 'to_route_id' => $to_route_id, |
|
77 | + 'route_destination_id' => strval($route_destination_id), |
|
78 | + 'after_destination_id' => strval($after_destination_id), |
|
79 | 79 | ]; |
80 | 80 | |
81 | 81 | $address = new Address(); |
@@ -23,20 +23,20 @@ discard block |
||
23 | 23 | $addresses = []; |
24 | 24 | |
25 | 25 | $params = [ |
26 | - 'route_id' => $routeId, |
|
27 | - 'addresses' => [ |
|
28 | - '0' => [ |
|
29 | - 'address' => 'Cabo Rojo, Cabo Rojo 00623, Puerto Rico', |
|
30 | - 'alias' => '', |
|
31 | - 'lat' => 18.086627, |
|
32 | - 'lng' => -67.145735, |
|
33 | - 'curbside_lat' => 18.086627, |
|
34 | - 'curbside_lng' => -67.145735, |
|
35 | - 'is_departed' => false, |
|
36 | - 'is_visited' => false, |
|
37 | - ], |
|
38 | - ], |
|
39 | - 'optimal_position' => true, |
|
26 | + 'route_id' => $routeId, |
|
27 | + 'addresses' => [ |
|
28 | + '0' => [ |
|
29 | + 'address' => 'Cabo Rojo, Cabo Rojo 00623, Puerto Rico', |
|
30 | + 'alias' => '', |
|
31 | + 'lat' => 18.086627, |
|
32 | + 'lng' => -67.145735, |
|
33 | + 'curbside_lat' => 18.086627, |
|
34 | + 'curbside_lng' => -67.145735, |
|
35 | + 'is_departed' => false, |
|
36 | + 'is_visited' => false, |
|
37 | + ], |
|
38 | + ], |
|
39 | + 'optimal_position' => true, |
|
40 | 40 | ]; |
41 | 41 | |
42 | 42 | $route1 = new Route(); |
@@ -50,5 +50,5 @@ discard block |
||
50 | 50 | assert(isset($result->addresses), "Cannot insert a destination into the route"); |
51 | 51 | |
52 | 52 | foreach ($result->addresses as $address) { |
53 | - echo 'Address -> '.$address->address, ', Sequence number -> '.$address->sequence_no.'<br>'; |
|
53 | + echo 'Address -> '.$address->address, ', Sequence number -> '.$address->sequence_no.'<br>'; |
|
54 | 54 | } |
@@ -27,10 +27,10 @@ |
||
27 | 27 | $address = new Address(); |
28 | 28 | |
29 | 29 | $params = [ |
30 | - 'route_id' => $routeId, |
|
31 | - 'address_id' => $route_destination_id, |
|
32 | - 'is_departed' => 1, |
|
33 | - 'member_id' => 1, |
|
30 | + 'route_id' => $routeId, |
|
31 | + 'address_id' => $route_destination_id, |
|
32 | + 'is_departed' => 1, |
|
33 | + 'member_id' => 1, |
|
34 | 34 | ]; |
35 | 35 | |
36 | 36 | $result = $address->markAsDeparted($params); |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | $addressRand = (array) $route->GetRandomAddressFromRoute($routeId); |
22 | 22 | |
23 | 23 | if (isset($addressRand['is_depot'])) { |
24 | - if ($addressRand['is_depot']) { |
|
25 | - echo "Random chosen address is depot, it cannot be marked! Try again."; |
|
24 | + if ($addressRand['is_depot']) { |
|
25 | + echo "Random chosen address is depot, it cannot be marked! Try again."; |
|
26 | 26 | |
27 | - return; |
|
28 | - } |
|
27 | + return; |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | // Get random address's id from selected route above |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | $address = new Address(); |
39 | 39 | |
40 | 40 | $params = [ |
41 | - 'route_id' => $routeId, |
|
42 | - 'address_id' => $route_destination_id, |
|
43 | - 'is_visited' => 1, |
|
44 | - 'member_id' => 1, |
|
41 | + 'route_id' => $routeId, |
|
42 | + 'address_id' => $route_destination_id, |
|
43 | + 'is_visited' => 1, |
|
44 | + 'member_id' => 1, |
|
45 | 45 | ]; |
46 | 46 | |
47 | 47 | $result = $address->markAsVisited($params); |
@@ -25,21 +25,21 @@ discard block |
||
25 | 25 | $addresses = []; |
26 | 26 | |
27 | 27 | foreach ($json as $address) { |
28 | - $addresses[] = Address::fromArray($address); |
|
28 | + $addresses[] = Address::fromArray($address); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $parameters = RouteParameters::fromArray([ |
32 | - 'route_name' => 'Oprimization Without FineTuning. '.date('Y-m-d H:i'), |
|
33 | - 'algorithm_type' => AlgorithmType::CVRP_TW_SD, |
|
34 | - 'distance_unit' => DistanceUnit::MILES, |
|
35 | - 'device_type' => DeviceType::WEB, |
|
36 | - 'optimize' => OptimizationType::DISTANCE, |
|
37 | - 'metric' => Metric::GEODESIC, |
|
38 | - 'route_max_duration' => 86400 * 2, |
|
39 | - 'travel_mode' => TravelMode::DRIVING, |
|
40 | - 'vehicle_capacity' => 50, |
|
41 | - 'vehicle_max_distance_mi' => 10000, |
|
42 | - 'parts' => 50, |
|
32 | + 'route_name' => 'Oprimization Without FineTuning. '.date('Y-m-d H:i'), |
|
33 | + 'algorithm_type' => AlgorithmType::CVRP_TW_SD, |
|
34 | + 'distance_unit' => DistanceUnit::MILES, |
|
35 | + 'device_type' => DeviceType::WEB, |
|
36 | + 'optimize' => OptimizationType::DISTANCE, |
|
37 | + 'metric' => Metric::GEODESIC, |
|
38 | + 'route_max_duration' => 86400 * 2, |
|
39 | + 'travel_mode' => TravelMode::DRIVING, |
|
40 | + 'vehicle_capacity' => 50, |
|
41 | + 'vehicle_max_distance_mi' => 10000, |
|
42 | + 'parts' => 50, |
|
43 | 43 | |
44 | 44 | ]); |
45 | 45 | |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | $duplicatedRoute->parameters = new \stdClass(); |
70 | 70 | |
71 | 71 | $duplicatedRoute->parameters = [ |
72 | - 'target_duration' => 100, |
|
73 | - 'target_distance' => 1, |
|
74 | - 'target_wait_by_tail_size' => 1, |
|
75 | - 'route_name' => 'Oprimization With Duration Priority FineTuning. '.date('m-d-Y') |
|
72 | + 'target_duration' => 100, |
|
73 | + 'target_distance' => 1, |
|
74 | + 'target_wait_by_tail_size' => 1, |
|
75 | + 'route_name' => 'Oprimization With Duration Priority FineTuning. '.date('m-d-Y') |
|
76 | 76 | ]; |
77 | 77 | |
78 | 78 | $duplicatedRoute->httpheaders = 'Content-type: application/json'; |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | $duplicatedRoute2->parameters = new \stdClass(); |
106 | 106 | |
107 | 107 | $duplicatedRoute2->parameters = [ |
108 | - 'target_duration' => 1, |
|
109 | - 'target_distance' => 100, |
|
110 | - 'target_wait_by_tail_size' => 1, |
|
111 | - 'route_name' => 'Oprimization With Distance Priority FineTuning. '.date('m-d-Y') |
|
108 | + 'target_duration' => 1, |
|
109 | + 'target_distance' => 100, |
|
110 | + 'target_wait_by_tail_size' => 1, |
|
111 | + 'route_name' => 'Oprimization With Distance Priority FineTuning. '.date('m-d-Y') |
|
112 | 112 | ]; |
113 | 113 | |
114 | 114 | $duplicatedRoute2->httpheaders = 'Content-type: application/json'; |
@@ -128,5 +128,5 @@ discard block |
||
128 | 128 | echo "Route ID: ".$problems->getRoutes()[0]->route_id.'<br>'; |
129 | 129 | foreach ($problems as $problem) { |
130 | 130 | |
131 | - //Route4Me::simplePrint($problem, true); |
|
131 | + //Route4Me::simplePrint($problem, true); |
|
132 | 132 | } |
@@ -18,40 +18,40 @@ |
||
18 | 18 | $vehicle = new Vehicle(); |
19 | 19 | |
20 | 20 | $vehicleParameters = Vehicle::fromArray([ |
21 | - 'vehicle_name' => 'ISUZU FTR', |
|
22 | - 'vehicle_alias' => 'ISUZU FTR', |
|
23 | - 'vehicle_vin' => '1NP5DB9X93N507873', |
|
24 | - 'vehicle_license_plate' => 'IFT6253', |
|
25 | - 'license_start_date' => '2008-05-14', |
|
26 | - 'license_end_date' => '2020-09-24', |
|
27 | - 'vehicle_model' => 'FTR', |
|
28 | - 'vehicle_model_year' => 2008, |
|
29 | - 'vehicle_year_acquired' => 2008, |
|
30 | - 'vehicle_reg_country_id' => '223', |
|
31 | - 'vehicle_type_id' => 'bigrig', |
|
32 | - 'has_trailer' => false, |
|
33 | - 'vehicle_axle_count' => 2, |
|
34 | - 'mpg_city' => 5, |
|
35 | - 'mpg_highway' => 15, |
|
36 | - 'fuel_type' => 'diesel', |
|
37 | - 'height_inches' => 112, |
|
38 | - 'height_metric' => 280, |
|
39 | - 'weight_lb' => 25950, |
|
40 | - 'maxWeightPerAxleGroupInPounds' => 19000, |
|
41 | - 'max_weight_per_axle_group_metric' => 8620, |
|
42 | - 'widthInInches' => 94, |
|
43 | - 'width_metric' => 235, |
|
44 | - 'lengthInInches' => 384, |
|
45 | - 'length_metric' => 960, |
|
46 | - 'Use53FootTrailerRouting' => 'NO', |
|
47 | - 'UseTruckRestrictions' => 'YES', |
|
48 | - 'DividedHighwayAvoidPreference' => 'NEUTRAL', |
|
49 | - 'FreewayAvoidPreference' => 'NEUTRAL', |
|
50 | - 'TollRoadUsage' => 'ALWAYS_AVOID', |
|
51 | - 'truck_config' => '26_STRAIGHT_TRUCK', |
|
52 | - 'InternationalBordersOpen' => 'YES', |
|
53 | - 'purchased_new' => true, |
|
54 | - 'HazmatType' => 'FLAMMABLE', |
|
21 | + 'vehicle_name' => 'ISUZU FTR', |
|
22 | + 'vehicle_alias' => 'ISUZU FTR', |
|
23 | + 'vehicle_vin' => '1NP5DB9X93N507873', |
|
24 | + 'vehicle_license_plate' => 'IFT6253', |
|
25 | + 'license_start_date' => '2008-05-14', |
|
26 | + 'license_end_date' => '2020-09-24', |
|
27 | + 'vehicle_model' => 'FTR', |
|
28 | + 'vehicle_model_year' => 2008, |
|
29 | + 'vehicle_year_acquired' => 2008, |
|
30 | + 'vehicle_reg_country_id' => '223', |
|
31 | + 'vehicle_type_id' => 'bigrig', |
|
32 | + 'has_trailer' => false, |
|
33 | + 'vehicle_axle_count' => 2, |
|
34 | + 'mpg_city' => 5, |
|
35 | + 'mpg_highway' => 15, |
|
36 | + 'fuel_type' => 'diesel', |
|
37 | + 'height_inches' => 112, |
|
38 | + 'height_metric' => 280, |
|
39 | + 'weight_lb' => 25950, |
|
40 | + 'maxWeightPerAxleGroupInPounds' => 19000, |
|
41 | + 'max_weight_per_axle_group_metric' => 8620, |
|
42 | + 'widthInInches' => 94, |
|
43 | + 'width_metric' => 235, |
|
44 | + 'lengthInInches' => 384, |
|
45 | + 'length_metric' => 960, |
|
46 | + 'Use53FootTrailerRouting' => 'NO', |
|
47 | + 'UseTruckRestrictions' => 'YES', |
|
48 | + 'DividedHighwayAvoidPreference' => 'NEUTRAL', |
|
49 | + 'FreewayAvoidPreference' => 'NEUTRAL', |
|
50 | + 'TollRoadUsage' => 'ALWAYS_AVOID', |
|
51 | + 'truck_config' => '26_STRAIGHT_TRUCK', |
|
52 | + 'InternationalBordersOpen' => 'YES', |
|
53 | + 'purchased_new' => true, |
|
54 | + 'HazmatType' => 'FLAMMABLE', |
|
55 | 55 | ]); |
56 | 56 | |
57 | 57 | $result = $vehicle->createVehicle($vehicleParameters); |