@@ -19,7 +19,7 @@ |
||
19 | 19 | assert(!is_null($route_id), "Cannot retrieve random route_id"); |
20 | 20 | |
21 | 21 | // Get random destination from selected route above |
22 | -$addressRand = (array) $route->GetRandomAddressFromRoute($route_id); |
|
22 | +$addressRand = (array)$route->GetRandomAddressFromRoute($route_id); |
|
23 | 23 | $route_destination_id = $addressRand['route_destination_id']; |
24 | 24 | |
25 | 25 | assert(!is_null($route_destination_id), "Cannot retrieve random address"); |
@@ -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); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | assert(!is_null($routeId), "Cannot retrieve random route_id"); |
19 | 19 | |
20 | 20 | // Get random address's id from selected route above |
21 | -$addressRand = (array) $route->GetRandomAddressFromRoute($routeId); |
|
21 | +$addressRand = (array)$route->GetRandomAddressFromRoute($routeId); |
|
22 | 22 | |
23 | 23 | if (isset($addressRand['is_depot'])) { |
24 | 24 | if ($addressRand['is_depot']) { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | // Get random address's id from selected route above |
32 | -$addressRand = (array) $route->GetRandomAddressFromRoute($routeId); |
|
32 | +$addressRand = (array)$route->GetRandomAddressFromRoute($routeId); |
|
33 | 33 | $route_destination_id = $addressRand['route_destination_id']; |
34 | 34 | |
35 | 35 | assert(!is_null($route_destination_id), "Cannot retrieve random address"); |
@@ -46,6 +46,6 @@ discard block |
||
46 | 46 | |
47 | 47 | $result = $address->markAsVisited($params); |
48 | 48 | |
49 | -assert(1 == $result, 'Cannot marked the address as visited'); |
|
49 | +assert(1==$result, 'Cannot marked the address as visited'); |
|
50 | 50 | |
51 | 51 | echo '<br> The address '.$route_destination_id.' was marked as visited'; |
@@ -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 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | $problems = OptimizationProblem::optimize($optimizationParams); |
51 | 51 | |
52 | -$route=$problems->getRoutes()[0]; |
|
52 | +$route = $problems->getRoutes()[0]; |
|
53 | 53 | |
54 | 54 | $routeId = $problems->getRoutes()[0]->route_id; |
55 | 55 | assert(!is_null($routeId), "Cannot get route ID"); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $duplicatedRouteId1 = $duplicateResult1['route_ids'][0]; |
65 | 65 | |
66 | 66 | $duplicatedRoute = $route->getRoutes(['route_id' => $duplicatedRouteId1]); |
67 | -assert($duplicatedRoute instanceof Route,'Cannot get the duplicated route.'); |
|
67 | +assert($duplicatedRoute instanceof Route, 'Cannot get the duplicated route.'); |
|
68 | 68 | |
69 | 69 | $duplicatedRoute->parameters = new \stdClass(); |
70 | 70 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | $result1 = $duplicatedRoute->update(); |
81 | 81 | |
82 | -assert($result1 instanceof Route,'Cannot fine-tune the route with the duration priority.'); |
|
82 | +assert($result1 instanceof Route, 'Cannot fine-tune the route with the duration priority.'); |
|
83 | 83 | |
84 | 84 | $tripDistance1 = $result1->trip_distance; |
85 | 85 | $routeDurationSec1 = $result1->route_duration_sec; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $duplicatedRouteId2 = $duplicateResult2['route_ids'][0]; |
101 | 101 | |
102 | 102 | $duplicatedRoute2 = $route->getRoutes(['route_id' => $duplicatedRouteId2]); |
103 | -assert($duplicatedRoute2 instanceof Route,'Cannot get the duplicated route.'); |
|
103 | +assert($duplicatedRoute2 instanceof Route, 'Cannot get the duplicated route.'); |
|
104 | 104 | |
105 | 105 | $duplicatedRoute2->parameters = new \stdClass(); |
106 | 106 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | $result2 = $duplicatedRoute2->update(); |
117 | 117 | |
118 | -assert($result2 instanceof Route,'Cannot fine-tune the route with the duration priority.'); |
|
118 | +assert($result2 instanceof Route, 'Cannot fine-tune the route with the duration priority.'); |
|
119 | 119 | |
120 | 120 | $tripDistance2 = $result2->trip_distance; |
121 | 121 | $routeDurationSec2 = $result2->route_duration_sec; |
@@ -59,7 +59,9 @@ discard block |
||
59 | 59 | |
60 | 60 | assert(is_array($duplicateResult1), "Cannot duplicate the route<br>"); |
61 | 61 | |
62 | -if (!$duplicateResult1['status'] || sizeof($duplicateResult1['route_ids'])<1) die("Cannot duplicate the route<br>"); |
|
62 | +if (!$duplicateResult1['status'] || sizeof($duplicateResult1['route_ids'])<1) { |
|
63 | + die("Cannot duplicate the route<br>"); |
|
64 | +} |
|
63 | 65 | |
64 | 66 | $duplicatedRouteId1 = $duplicateResult1['route_ids'][0]; |
65 | 67 | |
@@ -95,7 +97,9 @@ discard block |
||
95 | 97 | |
96 | 98 | assert(is_array($duplicateResult2), "Cannot duplicate the route<br>"); |
97 | 99 | |
98 | -if (!$duplicateResult2['status'] || sizeof($duplicateResult2['route_ids'])<1) die("Cannot duplicate the route<br>"); |
|
100 | +if (!$duplicateResult2['status'] || sizeof($duplicateResult2['route_ids'])<1) { |
|
101 | + die("Cannot duplicate the route<br>"); |
|
102 | +} |
|
99 | 103 | |
100 | 104 | $duplicatedRouteId2 = $duplicateResult2['route_ids'][0]; |
101 | 105 |
@@ -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); |
@@ -23,15 +23,15 @@ |
||
23 | 23 | |
24 | 24 | // Update the vehicle |
25 | 25 | $vehicleParameters = Vehicle::fromArray([ |
26 | - 'vehicle_id' => $randomVehicleID, |
|
27 | - 'vehicle_model_year' => 2013, |
|
28 | - 'vehicle_year_acquired' => 2016, |
|
29 | - 'vehicle_reg_country_id' => '223', |
|
30 | - 'vehicle_make' => 'Ford', |
|
31 | - 'vehicle_axle_count' => 3, |
|
32 | - 'fuel_type' => 'unleaded 93', |
|
33 | - 'height_inches' => 74, |
|
34 | - 'weight_lb' => 2098, |
|
26 | + 'vehicle_id' => $randomVehicleID, |
|
27 | + 'vehicle_model_year' => 2013, |
|
28 | + 'vehicle_year_acquired' => 2016, |
|
29 | + 'vehicle_reg_country_id' => '223', |
|
30 | + 'vehicle_make' => 'Ford', |
|
31 | + 'vehicle_axle_count' => 3, |
|
32 | + 'fuel_type' => 'unleaded 93', |
|
33 | + 'height_inches' => 74, |
|
34 | + 'weight_lb' => 2098, |
|
35 | 35 | ]); |
36 | 36 | |
37 | 37 | $result = $vehicle->updateVehicle($vehicleParameters); |
@@ -15,14 +15,14 @@ |
||
15 | 15 | $vehicle = new Vehicle(); |
16 | 16 | |
17 | 17 | $vehicleParameters = [ |
18 | - 'with_pagination' => true, |
|
19 | - 'page' => 2, |
|
20 | - 'perPage' => 10, |
|
21 | - ]; |
|
18 | + 'with_pagination' => true, |
|
19 | + 'page' => 2, |
|
20 | + 'perPage' => 10, |
|
21 | + ]; |
|
22 | 22 | |
23 | 23 | $response = $vehicle->getVehicles($vehicleParameters); |
24 | 24 | |
25 | 25 | foreach ($response['data'] as $key => $vehicle) { |
26 | - Route4Me::simplePrint($vehicle); |
|
27 | - echo '<br>'; |
|
26 | + Route4Me::simplePrint($vehicle); |
|
27 | + echo '<br>'; |
|
28 | 28 | } |
@@ -18,18 +18,18 @@ |
||
18 | 18 | $vehicle = new Vehicle(); |
19 | 19 | |
20 | 20 | $vehicleParameters = Vehicle::fromArray([ |
21 | - 'vehicle_name' => 'Ford Transit Test 4', |
|
22 | - 'vehicle_alias' => 'Ford Transit Test 4', |
|
23 | - 'vehicle_vin' => 'JS3TD62V1Y4107898', |
|
24 | - 'vehicle_reg_country_id' => '223', |
|
25 | - 'vehicle_make' => 'Ford', |
|
26 | - 'vehicle_model_year' => 2013, |
|
27 | - 'vehicle_axle_count' => 2, |
|
28 | - 'mpg_city' => 8, |
|
29 | - 'mpg_highway' => 14, |
|
30 | - 'fuel_type' => 'unleaded 93', |
|
31 | - 'height_inches' => 72, |
|
32 | - 'weight_lb' => 2000, |
|
21 | + 'vehicle_name' => 'Ford Transit Test 4', |
|
22 | + 'vehicle_alias' => 'Ford Transit Test 4', |
|
23 | + 'vehicle_vin' => 'JS3TD62V1Y4107898', |
|
24 | + 'vehicle_reg_country_id' => '223', |
|
25 | + 'vehicle_make' => 'Ford', |
|
26 | + 'vehicle_model_year' => 2013, |
|
27 | + 'vehicle_axle_count' => 2, |
|
28 | + 'mpg_city' => 8, |
|
29 | + 'mpg_highway' => 14, |
|
30 | + 'fuel_type' => 'unleaded 93', |
|
31 | + 'height_inches' => 72, |
|
32 | + 'weight_lb' => 2000, |
|
33 | 33 | ]); |
34 | 34 | |
35 | 35 | $result = $vehicle->createVehicle($vehicleParameters); |
@@ -18,34 +18,34 @@ |
||
18 | 18 | $vehicle = new Vehicle(); |
19 | 19 | |
20 | 20 | $vehicleParameters = Vehicle::fromArray([ |
21 | - 'vehicle_name' => 'GMC TopKick C5500 Light', |
|
22 | - 'vehicle_alias' => 'GMC TopKick C5500 Light', |
|
23 | - 'vehicle_vin' => 'SAJXA01A06FN08012', |
|
24 | - 'vehicle_license_plate' => 'CVH4561', |
|
25 | - 'vehicle_model' => 'TopKick C5500', |
|
26 | - 'vehicle_model_year' => 1995, |
|
27 | - 'vehicle_year_acquired' => 2008, |
|
28 | - 'vehicle_reg_country_id' => '223', |
|
29 | - 'vehicle_make' => 'GMC', |
|
30 | - 'vehicle_type_id' => 'pickup_truck', |
|
31 | - 'vehicle_axle_count' => 2, |
|
32 | - 'mpg_city' => 7, |
|
33 | - 'mpg_highway' => 14, |
|
34 | - 'fuel_type' => 'diesel', |
|
35 | - 'height_inches' => 97, |
|
36 | - 'height_metric' => 243, |
|
37 | - 'weight_lb' => 19000, |
|
38 | - 'maxWeightPerAxleGroupInPounds' => 9500, |
|
39 | - 'max_weight_per_axle_group_metric' => 4300, |
|
40 | - 'widthInInches' => 96, |
|
41 | - 'width_metric' => 240, |
|
42 | - 'lengthInInches' => 244, |
|
43 | - 'length_metric' => 610, |
|
44 | - 'Use53FootTrailerRouting' => 'NO', |
|
45 | - 'UseTruckRestrictions' => 'NO', |
|
46 | - 'DividedHighwayAvoidPreference' => 'NEUTRAL', |
|
47 | - 'FreewayAvoidPreference' => 'NEUTRAL', |
|
48 | - 'truck_config' => 'FULLSIZEVAN', |
|
21 | + 'vehicle_name' => 'GMC TopKick C5500 Light', |
|
22 | + 'vehicle_alias' => 'GMC TopKick C5500 Light', |
|
23 | + 'vehicle_vin' => 'SAJXA01A06FN08012', |
|
24 | + 'vehicle_license_plate' => 'CVH4561', |
|
25 | + 'vehicle_model' => 'TopKick C5500', |
|
26 | + 'vehicle_model_year' => 1995, |
|
27 | + 'vehicle_year_acquired' => 2008, |
|
28 | + 'vehicle_reg_country_id' => '223', |
|
29 | + 'vehicle_make' => 'GMC', |
|
30 | + 'vehicle_type_id' => 'pickup_truck', |
|
31 | + 'vehicle_axle_count' => 2, |
|
32 | + 'mpg_city' => 7, |
|
33 | + 'mpg_highway' => 14, |
|
34 | + 'fuel_type' => 'diesel', |
|
35 | + 'height_inches' => 97, |
|
36 | + 'height_metric' => 243, |
|
37 | + 'weight_lb' => 19000, |
|
38 | + 'maxWeightPerAxleGroupInPounds' => 9500, |
|
39 | + 'max_weight_per_axle_group_metric' => 4300, |
|
40 | + 'widthInInches' => 96, |
|
41 | + 'width_metric' => 240, |
|
42 | + 'lengthInInches' => 244, |
|
43 | + 'length_metric' => 610, |
|
44 | + 'Use53FootTrailerRouting' => 'NO', |
|
45 | + 'UseTruckRestrictions' => 'NO', |
|
46 | + 'DividedHighwayAvoidPreference' => 'NEUTRAL', |
|
47 | + 'FreewayAvoidPreference' => 'NEUTRAL', |
|
48 | + 'truck_config' => 'FULLSIZEVAN', |
|
49 | 49 | ]); |
50 | 50 | |
51 | 51 | $result = $vehicle->createVehicle($vehicleParameters); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | // Remove the vehicle |
25 | 25 | $vehicleParameters = Vehicle::fromArray([ |
26 | - 'vehicle_id' => $randomVehicleID, |
|
26 | + 'vehicle_id' => $randomVehicleID, |
|
27 | 27 | ]); |
28 | 28 | |
29 | 29 | $result = $vehicle->removeVehicle($vehicleParameters); |