@@ -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 |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | |
37 | 37 | // Mark the address as detected as deoarted |
38 | 38 | $addressParameters = (array) Address::fromArray([ |
39 | - 'route_id' => $routeId, |
|
40 | - 'route_destination_id' => $route_destination_id, |
|
41 | - 'is_departed' => true, |
|
39 | + 'route_id' => $routeId, |
|
40 | + 'route_destination_id' => $route_destination_id, |
|
41 | + 'is_departed' => true, |
|
42 | 42 | ]); |
43 | 43 | |
44 | 44 | $address = new 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,13 +29,13 @@ 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"); |
36 | 36 | |
37 | 37 | // Mark the address as detected as deoarted |
38 | -$addressParameters = (array) Address::fromArray([ |
|
38 | +$addressParameters = (array)Address::fromArray([ |
|
39 | 39 | 'route_id' => $routeId, |
40 | 40 | 'route_destination_id' => $route_destination_id, |
41 | 41 | 'is_departed' => true, |
@@ -27,19 +27,19 @@ |
||
27 | 27 | $addresses = []; |
28 | 28 | |
29 | 29 | $address1 = (array) Address::fromArray([ |
30 | - 'address' => '717 5th Ave New York, NY 10021', |
|
31 | - 'alias' => 'Giorgio Armani', |
|
32 | - 'lat' => 40.7669692, |
|
33 | - 'lng' => 73.9693864, |
|
34 | - 'time' => 0, |
|
30 | + 'address' => '717 5th Ave New York, NY 10021', |
|
31 | + 'alias' => 'Giorgio Armani', |
|
32 | + 'lat' => 40.7669692, |
|
33 | + 'lng' => 73.9693864, |
|
34 | + 'time' => 0, |
|
35 | 35 | ]); |
36 | 36 | |
37 | 37 | $addresses[0] = $address1; |
38 | 38 | |
39 | 39 | $OptimizationParameters = (array) OptimizationProblem::fromArray([ |
40 | - 'optimization_problem_id' => $optimization_problem_id, |
|
41 | - 'addresses' => $addresses, |
|
42 | - 'reoptimize' => 1, |
|
40 | + 'optimization_problem_id' => $optimization_problem_id, |
|
41 | + 'addresses' => $addresses, |
|
42 | + 'reoptimize' => 1, |
|
43 | 43 | ]); |
44 | 44 | |
45 | 45 | $optimizationProblem = new OptimizationProblem(); |
@@ -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 | $optimization_problem_id = $addressRand['optimization_problem_id']; |
23 | 23 | |
24 | 24 | assert(!is_null($optimization_problem_id), "Cannot retrieve random address"); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // Add an address to the optimization |
27 | 27 | $addresses = []; |
28 | 28 | |
29 | -$address1 = (array) Address::fromArray([ |
|
29 | +$address1 = (array)Address::fromArray([ |
|
30 | 30 | 'address' => '717 5th Ave New York, NY 10021', |
31 | 31 | 'alias' => 'Giorgio Armani', |
32 | 32 | 'lat' => 40.7669692, |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | |
37 | 37 | $addresses[0] = $address1; |
38 | 38 | |
39 | -$OptimizationParameters = (array) OptimizationProblem::fromArray([ |
|
39 | +$OptimizationParameters = (array)OptimizationProblem::fromArray([ |
|
40 | 40 | 'optimization_problem_id' => $optimization_problem_id, |
41 | 41 | 'addresses' => $addresses, |
42 | 42 | 'reoptimize' => 1, |
@@ -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 | $route_destination_id = $addressRand['route_destination_id']; |
23 | 23 | |
24 | 24 | assert(!is_null($route_destination_id), "Cannot retrieve random address"); |
@@ -28,4 +28,4 @@ discard block |
||
28 | 28 | |
29 | 29 | $addressRetrieved = $address->getAddress($routeId, $route_destination_id); |
30 | 30 | |
31 | -Route4Me::simplePrint((array) $addressRetrieved); |
|
31 | +Route4Me::simplePrint((array)$addressRetrieved); |
@@ -21,25 +21,25 @@ |
||
21 | 21 | $addresses = []; |
22 | 22 | |
23 | 23 | $address1 = (array) Address::fromArray([ |
24 | - 'address' => '146 Bill Johnson Rd NE Milledgeville GA 31061', |
|
25 | - 'lat' => 33.143526, |
|
26 | - 'lng' => -83.240354, |
|
27 | - 'time' => 0, |
|
24 | + 'address' => '146 Bill Johnson Rd NE Milledgeville GA 31061', |
|
25 | + 'lat' => 33.143526, |
|
26 | + 'lng' => -83.240354, |
|
27 | + 'time' => 0, |
|
28 | 28 | ]); |
29 | 29 | |
30 | 30 | $address2 = (array) Address::fromArray([ |
31 | - 'address' => '222 Blake Cir Milledgeville GA 31061', |
|
32 | - 'lat' => 33.177852, |
|
33 | - 'lng' => -83.263535, |
|
34 | - 'time' => 0, |
|
31 | + 'address' => '222 Blake Cir Milledgeville GA 31061', |
|
32 | + 'lat' => 33.177852, |
|
33 | + 'lng' => -83.263535, |
|
34 | + 'time' => 0, |
|
35 | 35 | ]); |
36 | 36 | |
37 | 37 | $addresses[] = $address1; |
38 | 38 | $addresses[] = $address2; |
39 | 39 | |
40 | 40 | $routeParameters = [ |
41 | - 'route_id' => $routeId, |
|
42 | - 'addresses' => [$address1, $address2], |
|
41 | + 'route_id' => $routeId, |
|
42 | + 'addresses' => [$address1, $address2], |
|
43 | 43 | ]; |
44 | 44 | |
45 | 45 | $route1 = new Route(); |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | // Add the destinations to the route |
21 | 21 | $addresses = []; |
22 | 22 | |
23 | -$address1 = (array) Address::fromArray([ |
|
23 | +$address1 = (array)Address::fromArray([ |
|
24 | 24 | 'address' => '146 Bill Johnson Rd NE Milledgeville GA 31061', |
25 | 25 | 'lat' => 33.143526, |
26 | 26 | 'lng' => -83.240354, |
27 | 27 | 'time' => 0, |
28 | 28 | ]); |
29 | 29 | |
30 | -$address2 = (array) Address::fromArray([ |
|
30 | +$address2 = (array)Address::fromArray([ |
|
31 | 31 | 'address' => '222 Blake Cir Milledgeville GA 31061', |
32 | 32 | 'lat' => 33.177852, |
33 | 33 | 'lng' => -83.263535, |
@@ -48,4 +48,4 @@ discard block |
||
48 | 48 | |
49 | 49 | $result = $route1->addAddresses($routeParameters); |
50 | 50 | |
51 | -Route4Me::simplePrint((array) $result); |
|
51 | +Route4Me::simplePrint((array)$result); |
@@ -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); |
@@ -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 |
@@ -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(); |
@@ -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, |
@@ -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(); |
@@ -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 |
@@ -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 | } |