@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | assert(!is_null($addressRand), "Can't retrieve random address"); |
| 28 | 28 | |
| 29 | 29 | if (isset($addressRand['is_depot'])) { |
| 30 | - if ($addressRand['is_depot']) { |
|
| 31 | - echo "This address is depot!.. Try again."; |
|
| 32 | - return; |
|
| 33 | - } |
|
| 30 | + if ($addressRand['is_depot']) { |
|
| 31 | + echo "This address is depot!.. Try again."; |
|
| 32 | + return; |
|
| 33 | + } |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $route_destination_id = $addressRand['route_destination_id']; |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Remove the destination from the optimization |
| 41 | 41 | $params = array ( |
| 42 | - "optimization_problem_id" => $optimization_problem_id, |
|
| 43 | - "route_destination_id" => $route_destination_id |
|
| 42 | + "optimization_problem_id" => $optimization_problem_id, |
|
| 43 | + "route_destination_id" => $route_destination_id |
|
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | 46 | $result = $optimization->removeAddress($params); |
@@ -30,19 +30,19 @@ |
||
| 30 | 30 | $addresses = array(); |
| 31 | 31 | |
| 32 | 32 | $address1 = (array)Address::fromArray(array( |
| 33 | - 'address' => '717 5th Ave New York, NY 10021', |
|
| 34 | - 'alias' => 'Giorgio Armani', |
|
| 35 | - 'lat' => 40.7669692, |
|
| 36 | - 'lng' => 73.9693864, |
|
| 37 | - 'time' => 0 |
|
| 33 | + 'address' => '717 5th Ave New York, NY 10021', |
|
| 34 | + 'alias' => 'Giorgio Armani', |
|
| 35 | + 'lat' => 40.7669692, |
|
| 36 | + 'lng' => 73.9693864, |
|
| 37 | + 'time' => 0 |
|
| 38 | 38 | )); |
| 39 | 39 | |
| 40 | 40 | $addresses[0] = $address1; |
| 41 | 41 | |
| 42 | 42 | $OptimizationParameters = (array)OptimizationProblem::fromArray(array( |
| 43 | - "optimization_problem_id" => $optimization_problem_id, |
|
| 44 | - "addresses" => $addresses, |
|
| 45 | - "reoptimize" => 1, |
|
| 43 | + "optimization_problem_id" => $optimization_problem_id, |
|
| 44 | + "addresses" => $addresses, |
|
| 45 | + "reoptimize" => 1, |
|
| 46 | 46 | )); |
| 47 | 47 | |
| 48 | 48 | $optimizationproblem = new OptimizationProblem(); |
@@ -25,20 +25,20 @@ |
||
| 25 | 25 | $addresses = array(); |
| 26 | 26 | |
| 27 | 27 | $params = array( |
| 28 | - "route_id" => $routeId, |
|
| 29 | - "addresses" => array( |
|
| 30 | - "0" => array( |
|
| 31 | - "address" => "Cabo Rojo, Cabo Rojo 00623, Puerto Rico", |
|
| 32 | - "alias" => "", |
|
| 33 | - "lat" => 18.086627, |
|
| 34 | - "lng" => -67.145735, |
|
| 35 | - "curbside_lat" => 18.086627, |
|
| 36 | - "curbside_lng" => -67.145735, |
|
| 37 | - "is_departed" => false, |
|
| 38 | - "is_visited" => false |
|
| 39 | - ) |
|
| 40 | - ), |
|
| 41 | - "optimal_position" => true |
|
| 28 | + "route_id" => $routeId, |
|
| 29 | + "addresses" => array( |
|
| 30 | + "0" => array( |
|
| 31 | + "address" => "Cabo Rojo, Cabo Rojo 00623, Puerto Rico", |
|
| 32 | + "alias" => "", |
|
| 33 | + "lat" => 18.086627, |
|
| 34 | + "lng" => -67.145735, |
|
| 35 | + "curbside_lat" => 18.086627, |
|
| 36 | + "curbside_lng" => -67.145735, |
|
| 37 | + "is_departed" => false, |
|
| 38 | + "is_visited" => false |
|
| 39 | + ) |
|
| 40 | + ), |
|
| 41 | + "optimal_position" => true |
|
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | 44 | $route1 = new Route(); |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | if (isset($addressRand['is_depot'])) |
| 27 | 27 | { |
| 28 | - if ($addressRand['is_depot']) { |
|
| 29 | - echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 30 | - return; |
|
| 31 | - } |
|
| 28 | + if ($addressRand['is_depot']) { |
|
| 29 | + echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 30 | + return; |
|
| 31 | + } |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $address_id = $addressRand['route_destination_id']; |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | // Mark the address as detected as visited |
| 39 | 39 | $addressParameters=(array)Address::fromArray(array( |
| 40 | - "route_id" => $routeId, |
|
| 41 | - "route_destination_id" => $address_id, |
|
| 40 | + "route_id" => $routeId, |
|
| 41 | + "route_destination_id" => $address_id, |
|
| 42 | 42 | )); |
| 43 | 43 | |
| 44 | 44 | $body= array( |
| 45 | - "is_visited" => TRUE, |
|
| 45 | + "is_visited" => TRUE, |
|
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | 48 | $address = new Address(); |
@@ -29,10 +29,10 @@ |
||
| 29 | 29 | $address=new Address(); |
| 30 | 30 | |
| 31 | 31 | $params = array( |
| 32 | - "route_id" => $routeId, |
|
| 33 | - "address_id" => $route_destination_id, |
|
| 34 | - "is_departed" => 1, |
|
| 35 | - "member_id" => 1 |
|
| 32 | + "route_id" => $routeId, |
|
| 33 | + "address_id" => $route_destination_id, |
|
| 34 | + "is_departed" => 1, |
|
| 35 | + "member_id" => 1 |
|
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | $result = $address->markAsDeparted($params); |
@@ -23,25 +23,25 @@ |
||
| 23 | 23 | $addresses = array(); |
| 24 | 24 | |
| 25 | 25 | $address1 = (array)Address::fromArray(array( |
| 26 | - 'address' => '146 Bill Johnson Rd NE Milledgeville GA 31061', |
|
| 27 | - 'lat' => 33.143526, |
|
| 28 | - 'lng' => -83.240354, |
|
| 29 | - 'time' => 0 |
|
| 26 | + 'address' => '146 Bill Johnson Rd NE Milledgeville GA 31061', |
|
| 27 | + 'lat' => 33.143526, |
|
| 28 | + 'lng' => -83.240354, |
|
| 29 | + 'time' => 0 |
|
| 30 | 30 | )); |
| 31 | 31 | |
| 32 | 32 | $address2 = (array)Address::fromArray(array( |
| 33 | - 'address' => '222 Blake Cir Milledgeville GA 31061', |
|
| 34 | - 'lat' => 33.177852, |
|
| 35 | - 'lng' => -83.263535, |
|
| 36 | - 'time' => 0 |
|
| 33 | + 'address' => '222 Blake Cir Milledgeville GA 31061', |
|
| 34 | + 'lat' => 33.177852, |
|
| 35 | + 'lng' => -83.263535, |
|
| 36 | + 'time' => 0 |
|
| 37 | 37 | )); |
| 38 | 38 | |
| 39 | 39 | $addresses[] = $address1; |
| 40 | 40 | $addresses[] = $address2; |
| 41 | 41 | |
| 42 | 42 | $routeParameters = array( |
| 43 | - "route_id" => $routeId, |
|
| 44 | - "addresses" => array($address1, $address2) |
|
| 43 | + "route_id" => $routeId, |
|
| 44 | + "addresses" => array($address1, $address2) |
|
| 45 | 45 | ); |
| 46 | 46 | |
| 47 | 47 | $route1 = new Route(); |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $route = new Route(); |
| 17 | 17 | |
| 18 | 18 | $grParams = array( |
| 19 | - 'offset' => 0, |
|
| 20 | - 'limit' => 10 |
|
| 19 | + 'offset' => 0, |
|
| 20 | + 'limit' => 10 |
|
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | 23 | $routes = $route->getRoutes(null, $grParams); |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | echo "<br> From the route -> " . $route_id0 ."<br>"; |
| 33 | 33 | |
| 34 | 34 | if (is_null($route_id0)) { |
| 35 | - echo "Can't retrieve random route_id!.. Try again."; |
|
| 36 | - return; |
|
| 35 | + echo "Can't retrieve random route_id!.. Try again."; |
|
| 36 | + return; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Get random source destination from selected source route above |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | $to_route_id = $route_id0; |
| 49 | 49 | |
| 50 | 50 | while ($to_route_id == $route_id0) { |
| 51 | - $to_route_id = $routes[rand(0, sizeof($routes)-1)]->route_id; |
|
| 51 | + $to_route_id = $routes[rand(0, sizeof($routes)-1)]->route_id; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | echo "<br> to the route -> " . $to_route_id ."<br>"; |
| 55 | 55 | |
| 56 | 56 | if (is_null($to_route_id)) { |
| 57 | - echo "Can't retrieve random route_id!.. Try again."; |
|
| 58 | - return; |
|
| 57 | + echo "Can't retrieve random route_id!.. Try again."; |
|
| 58 | + return; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // Get random destination destination from selected source route above |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | $after_destination_id = $addressRand2['route_destination_id']; |
| 65 | 65 | |
| 66 | 66 | if (is_null($after_destination_id)) { |
| 67 | - echo "can't retrieve random address!.. Try again."; |
|
| 68 | - return; |
|
| 67 | + echo "can't retrieve random address!.. Try again."; |
|
| 68 | + return; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | echo "after_destination_id = $after_destination_id <br>"; |
| 72 | 72 | |
| 73 | 73 | // Move the destination to the route |
| 74 | 74 | $routeparams = array( |
| 75 | - 'to_route_id' => $to_route_id, |
|
| 76 | - 'route_destination_id' => strval($route_destination_id), |
|
| 77 | - 'after_destination_id' => strval($after_destination_id) |
|
| 75 | + 'to_route_id' => $to_route_id, |
|
| 76 | + 'route_destination_id' => strval($route_destination_id), |
|
| 77 | + 'after_destination_id' => strval($after_destination_id) |
|
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | 80 | $address = new Address(); |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | if (isset($addressRand['is_depot'])) |
| 27 | 27 | { |
| 28 | - if ($addressRand['is_depot']) { |
|
| 29 | - echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 30 | - return; |
|
| 31 | - } |
|
| 28 | + if ($addressRand['is_depot']) { |
|
| 29 | + echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 30 | + return; |
|
| 31 | + } |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | // Get random address's id from selected route above |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | // Mark the address as detected as deoarted |
| 41 | 41 | $addressParameters = (array)Address::fromArray(array( |
| 42 | - "route_id" => $routeId, |
|
| 43 | - "route_destination_id" => $route_destination_id, |
|
| 42 | + "route_id" => $routeId, |
|
| 43 | + "route_destination_id" => $route_destination_id, |
|
| 44 | 44 | )); |
| 45 | 45 | |
| 46 | 46 | $body= array( |
| 47 | - "is_departed" => TRUE, |
|
| 47 | + "is_departed" => TRUE, |
|
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | 50 | $address = new Address(); |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | $addressRand=(array)$route->GetRandomAddressFromRoute($routeId); |
| 24 | 24 | |
| 25 | 25 | if (isset($addressRand['is_depot'])) { |
| 26 | - if ($addressRand['is_depot']) { |
|
| 27 | - echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 28 | - return; |
|
| 29 | - } |
|
| 26 | + if ($addressRand['is_depot']) { |
|
| 27 | + echo "Random choosed address is depot, it can't be marked!.. Try again."; |
|
| 28 | + return; |
|
| 29 | + } |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | // Get random address's id from selected route above |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | $address = new Address(); |
| 40 | 40 | |
| 41 | 41 | $params = array( |
| 42 | - "route_id" => $routeId, |
|
| 43 | - "address_id" => $route_destination_id, |
|
| 44 | - "is_visited" => 1, |
|
| 45 | - "member_id" => 1 |
|
| 42 | + "route_id" => $routeId, |
|
| 43 | + "address_id" => $route_destination_id, |
|
| 44 | + "is_visited" => 1, |
|
| 45 | + "member_id" => 1 |
|
| 46 | 46 | ); |
| 47 | 47 | |
| 48 | 48 | $result = $address->markAsVisited($params); |