@@ -19,7 +19,7 @@ |
||
19 | 19 | assert(!is_null($optimization_problem_id), "Cannot retrieve random optimization_problem_id"); |
20 | 20 | |
21 | 21 | // Get random destination from selected optimization above |
22 | -$addressRand = (array) $optimization->getRandomAddressFromOptimization($optimization_problem_id); |
|
22 | +$addressRand = (array)$optimization->getRandomAddressFromOptimization($optimization_problem_id); |
|
23 | 23 | |
24 | 24 | assert(!is_null($addressRand), "Cannot retrieve random address"); |
25 | 25 |
@@ -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']) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | assert(!is_null($address_id), "Cannot retrieve random address"); |
34 | 34 | |
35 | 35 | // Mark the address as detected as visited |
36 | -$addressParameters = (array) Address::fromArray([ |
|
36 | +$addressParameters = (array)Address::fromArray([ |
|
37 | 37 | 'route_id' => $routeId, |
38 | 38 | 'route_destination_id' => $address_id, |
39 | 39 | 'is_visited' => true, |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | $routes = $route->getRoutes($grParams); |
22 | 22 | assert(!is_null($routes), 'There are no routes in the account for this example. Please, create at last two routes first.'); |
23 | -assert(sizeof($routes) > 1, 'This example requires at last 2 routes. Please, create them first.'); |
|
23 | +assert(sizeof($routes)>1, 'This example requires at last 2 routes. Please, create them first.'); |
|
24 | 24 | |
25 | 25 | // Get random source route from test routes |
26 | 26 | $route = new Route(); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | // Get random source destination from selected source route above |
39 | -$addressRand = (array) $route->GetRandomAddressFromRoute($route_id0); |
|
39 | +$addressRand = (array)$route->GetRandomAddressFromRoute($route_id0); |
|
40 | 40 | $route_destination_id = $addressRand['route_destination_id']; |
41 | 41 | |
42 | 42 | assert(!is_null($route_destination_id), "Cannot retrieve random address."); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // Get random destination route from test routes |
47 | 47 | $to_route_id = $route_id0; |
48 | 48 | |
49 | -while ($to_route_id == $route_id0) { |
|
49 | +while ($to_route_id==$route_id0) { |
|
50 | 50 | $to_route_id = $routes[rand(0, sizeof($routes) - 1)]->route_id; |
51 | 51 | } |
52 | 52 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | // Get random destination destination from selected source route above |
62 | -$addressRand2 = (array) $route->GetRandomAddressFromRoute($to_route_id); |
|
62 | +$addressRand2 = (array)$route->GetRandomAddressFromRoute($to_route_id); |
|
63 | 63 | |
64 | 64 | $after_destination_id = $addressRand2['route_destination_id']; |
65 | 65 |
@@ -18,7 +18,7 @@ |
||
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 | $route_destination_id = $addressRand['route_destination_id']; |
23 | 23 | |
24 | 24 | assert(!is_null($route_destination_id), "Cannot retrieve random address"); |
@@ -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"); |
@@ -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'; |
@@ -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; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $problems = OptimizationProblem::optimize($optimizationParams); |
55 | 55 | assert(!is_null($problems), "Cannot generate an optimization with duration priority fine-tuning"); |
56 | 56 | |
57 | -$routes=$problems->getRoutes(); |
|
57 | +$routes = $problems->getRoutes(); |
|
58 | 58 | assert(sizeof($routes)==2, "The generated optimization hasn't two routes"); |
59 | 59 | |
60 | 60 | $totalTripDistanceByDuration = $routes[0]->trip_distance + $routes[1]->trip_distance; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $problems = OptimizationProblem::optimize($optimizationParams); |
96 | 96 | assert(!is_null($problems), "Cannot generate an optimization with the distance priority fine-tuning"); |
97 | 97 | |
98 | -$routes=$problems->getRoutes(); |
|
98 | +$routes = $problems->getRoutes(); |
|
99 | 99 | assert(sizeof($routes)==2, "The generated optimization hasn't two routes"); |
100 | 100 | |
101 | 101 | $totalTripDistanceByDistance = $routes[0]->trip_distance + $routes[1]->trip_distance; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $problems = OptimizationProblem::optimize($optimizationParams); |
137 | 137 | assert(!is_null($problems), "Cannot generate an optimization with the waiting time priority fine-tuning"); |
138 | 138 | |
139 | -$routes=$problems->getRoutes(); |
|
139 | +$routes = $problems->getRoutes(); |
|
140 | 140 | assert(sizeof($routes)==2, "The generated optimization hasn't two routes"); |
141 | 141 | |
142 | 142 | $totalTripDistanceByTimeWaiting = $routes[0]->trip_distance + $routes[1]->trip_distance; |
@@ -25,6 +25,6 @@ |
||
25 | 25 | |
26 | 26 | $optimizationProblem = $optimization->get($optimizationProblemParams); |
27 | 27 | |
28 | -foreach ((array) $optimizationProblem as $probParts) { |
|
29 | - Route4Me::simplePrint((array) $probParts); |
|
28 | +foreach ((array)$optimizationProblem as $probParts) { |
|
29 | + Route4Me::simplePrint((array)$probParts); |
|
30 | 30 | } |