@@ -10,24 +10,24 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | //region // Add a location, scheduled daily with custom data. |
| 12 | 12 | $AddressBookLocationParameters = AddressBookLocation::fromArray([ |
| 13 | - 'address_1' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214', |
|
| 14 | - 'address_alias' => '1604 PARKRIDGE PKWY 40214', |
|
| 15 | - 'address_group' => 'Scheduled daily', |
|
| 16 | - 'first_name' => 'Peter', |
|
| 17 | - 'last_name' => 'Newman', |
|
| 18 | - 'address_email' => '[email protected]', |
|
| 19 | - 'address_phone_number' => '65432178', |
|
| 20 | - 'cached_lat' => 38.141598, |
|
| 21 | - 'cached_lng' => -85.793846, |
|
| 22 | - 'address_city' => 'Louisville', |
|
| 23 | - 'address_custom_data' => ['scheduled' => 'yes', |
|
| 24 | - 'serice type' => 'publishing', ], |
|
| 25 | - 'schedule' => [[ |
|
| 26 | - 'enabled' => true, |
|
| 27 | - 'mode' => 'daily', |
|
| 28 | - 'daily' => ['every' => 1], |
|
| 29 | - ]], |
|
| 30 | - 'service_time' => 900, |
|
| 13 | + 'address_1' => '1604 PARKRIDGE PKWY, Louisville, KY, 40214', |
|
| 14 | + 'address_alias' => '1604 PARKRIDGE PKWY 40214', |
|
| 15 | + 'address_group' => 'Scheduled daily', |
|
| 16 | + 'first_name' => 'Peter', |
|
| 17 | + 'last_name' => 'Newman', |
|
| 18 | + 'address_email' => '[email protected]', |
|
| 19 | + 'address_phone_number' => '65432178', |
|
| 20 | + 'cached_lat' => 38.141598, |
|
| 21 | + 'cached_lng' => -85.793846, |
|
| 22 | + 'address_city' => 'Louisville', |
|
| 23 | + 'address_custom_data' => ['scheduled' => 'yes', |
|
| 24 | + 'serice type' => 'publishing', ], |
|
| 25 | + 'schedule' => [[ |
|
| 26 | + 'enabled' => true, |
|
| 27 | + 'mode' => 'daily', |
|
| 28 | + 'daily' => ['every' => 1], |
|
| 29 | + ]], |
|
| 30 | + 'service_time' => 900, |
|
| 31 | 31 | ]); |
| 32 | 32 | |
| 33 | 33 | $abContacts1 = new AddressBookLocation(); |
@@ -42,27 +42,27 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | //region // Add a location, scheduled weekly. |
| 44 | 44 | $AddressBookLocationParameters = AddressBookLocation::fromArray([ |
| 45 | - 'address_1' => '1407 MCCOY, Louisville, KY, 40215', |
|
| 46 | - 'address_alias' => '1407 MCCOY 40215', |
|
| 47 | - 'address_group' => 'Scheduled weekly', |
|
| 48 | - 'first_name' => 'Bart', |
|
| 49 | - 'last_name' => 'Douglas', |
|
| 50 | - 'address_email' => '[email protected]', |
|
| 51 | - 'address_phone_number' => '95487454', |
|
| 52 | - 'cached_lat' => 38.202496, |
|
| 53 | - 'cached_lng' => -85.786514, |
|
| 54 | - 'curbside_lat' => 38.202496, |
|
| 55 | - 'curbside_lng' => -85.786514, |
|
| 56 | - 'address_city' => 'Louisville', |
|
| 57 | - 'schedule' => [[ |
|
| 58 | - 'enabled' => true, |
|
| 59 | - 'mode' => 'weekly', |
|
| 60 | - 'weekly' => [ |
|
| 61 | - 'every' => 1, |
|
| 62 | - 'weekdays' => [1, 2, 3, 4, 5], |
|
| 63 | - ], |
|
| 64 | - ]], |
|
| 65 | - 'service_time' => 600, |
|
| 45 | + 'address_1' => '1407 MCCOY, Louisville, KY, 40215', |
|
| 46 | + 'address_alias' => '1407 MCCOY 40215', |
|
| 47 | + 'address_group' => 'Scheduled weekly', |
|
| 48 | + 'first_name' => 'Bart', |
|
| 49 | + 'last_name' => 'Douglas', |
|
| 50 | + 'address_email' => '[email protected]', |
|
| 51 | + 'address_phone_number' => '95487454', |
|
| 52 | + 'cached_lat' => 38.202496, |
|
| 53 | + 'cached_lng' => -85.786514, |
|
| 54 | + 'curbside_lat' => 38.202496, |
|
| 55 | + 'curbside_lng' => -85.786514, |
|
| 56 | + 'address_city' => 'Louisville', |
|
| 57 | + 'schedule' => [[ |
|
| 58 | + 'enabled' => true, |
|
| 59 | + 'mode' => 'weekly', |
|
| 60 | + 'weekly' => [ |
|
| 61 | + 'every' => 1, |
|
| 62 | + 'weekdays' => [1, 2, 3, 4, 5], |
|
| 63 | + ], |
|
| 64 | + ]], |
|
| 65 | + 'service_time' => 600, |
|
| 66 | 66 | ]); |
| 67 | 67 | |
| 68 | 68 | $abContacts2 = new AddressBookLocation(); |
@@ -77,33 +77,33 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | //region // Add a location, scheduled monthly (dates mode). |
| 79 | 79 | $AddressBookLocationParameters = AddressBookLocation::fromArray([ |
| 80 | - 'address_1' => '4805 BELLEVUE AVE, Louisville, KY, 40215', |
|
| 81 | - 'address_2' => '4806 BELLEVUE AVE, Louisville, KY, 40215', |
|
| 82 | - 'address_alias' => '4805 BELLEVUE AVE 40215', |
|
| 83 | - 'address_group' => 'Scheduled monthly', |
|
| 84 | - 'first_name' => 'Bart', |
|
| 85 | - 'last_name' => 'Douglas', |
|
| 86 | - 'address_email' => '[email protected]', |
|
| 87 | - 'address_phone_number' => '95487454', |
|
| 88 | - 'cached_lat' => 38.178844, |
|
| 89 | - 'cached_lng' => -85.774864, |
|
| 90 | - 'curbside_lat' => 38.178844, |
|
| 91 | - 'curbside_lng' => -85.774864, |
|
| 92 | - 'address_city' => 'Louisville', |
|
| 93 | - 'address_country_id' => 'US', |
|
| 94 | - 'address_state_id' => 'KY', |
|
| 95 | - 'address_zip' => '40215', |
|
| 96 | - 'schedule' => [[ |
|
| 97 | - 'enabled' => true, |
|
| 98 | - 'mode' => 'monthly', |
|
| 99 | - 'monthly' => [ |
|
| 100 | - 'every' => 1, |
|
| 101 | - 'mode' => 'dates', |
|
| 102 | - 'dates' => [20, 22, 23, 24, 25], |
|
| 103 | - ], |
|
| 104 | - ]], |
|
| 105 | - 'service_time' => 750, |
|
| 106 | - 'color' => 'red', |
|
| 80 | + 'address_1' => '4805 BELLEVUE AVE, Louisville, KY, 40215', |
|
| 81 | + 'address_2' => '4806 BELLEVUE AVE, Louisville, KY, 40215', |
|
| 82 | + 'address_alias' => '4805 BELLEVUE AVE 40215', |
|
| 83 | + 'address_group' => 'Scheduled monthly', |
|
| 84 | + 'first_name' => 'Bart', |
|
| 85 | + 'last_name' => 'Douglas', |
|
| 86 | + 'address_email' => '[email protected]', |
|
| 87 | + 'address_phone_number' => '95487454', |
|
| 88 | + 'cached_lat' => 38.178844, |
|
| 89 | + 'cached_lng' => -85.774864, |
|
| 90 | + 'curbside_lat' => 38.178844, |
|
| 91 | + 'curbside_lng' => -85.774864, |
|
| 92 | + 'address_city' => 'Louisville', |
|
| 93 | + 'address_country_id' => 'US', |
|
| 94 | + 'address_state_id' => 'KY', |
|
| 95 | + 'address_zip' => '40215', |
|
| 96 | + 'schedule' => [[ |
|
| 97 | + 'enabled' => true, |
|
| 98 | + 'mode' => 'monthly', |
|
| 99 | + 'monthly' => [ |
|
| 100 | + 'every' => 1, |
|
| 101 | + 'mode' => 'dates', |
|
| 102 | + 'dates' => [20, 22, 23, 24, 25], |
|
| 103 | + ], |
|
| 104 | + ]], |
|
| 105 | + 'service_time' => 750, |
|
| 106 | + 'color' => 'red', |
|
| 107 | 107 | ]); |
| 108 | 108 | |
| 109 | 109 | $abContacts3 = new AddressBookLocation(); |
@@ -118,36 +118,36 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | //region // AAdd a location, scheduled monthly (nth mode). |
| 120 | 120 | $AddressBookLocationParameters = AddressBookLocation::fromArray([ |
| 121 | - 'address_1' => '730 CECIL AVENUE, Louisville, KY, 40211', |
|
| 122 | - 'address_alias' => '730 CECIL AVENUE 40211', |
|
| 123 | - 'address_group' => 'Scheduled monthly', |
|
| 124 | - 'first_name' => 'David', |
|
| 125 | - 'last_name' => 'Silvester', |
|
| 126 | - 'address_email' => '[email protected]', |
|
| 127 | - 'address_phone_number' => '36985214', |
|
| 128 | - 'cached_lat' => 38.248684, |
|
| 129 | - 'cached_lng' => -85.821121, |
|
| 130 | - 'curbside_lat' => 38.248684, |
|
| 131 | - 'curbside_lng' => -85.821121, |
|
| 132 | - 'address_city' => 'Louisville', |
|
| 133 | - 'address_custom_data' => [ |
|
| 134 | - 'scheduled' => 'yes', |
|
| 135 | - 'service type' => 'library', |
|
| 136 | - ], |
|
| 137 | - 'schedule' => [[ |
|
| 138 | - 'enabled' => true, |
|
| 139 | - 'mode' => 'monthly', |
|
| 140 | - 'monthly' => [ |
|
| 141 | - 'every' => 1, |
|
| 142 | - 'mode' => 'nth', |
|
| 143 | - 'nth' => [ |
|
| 144 | - 'n' => 1, |
|
| 145 | - 'what' => 4, |
|
| 146 | - ], |
|
| 147 | - ], |
|
| 148 | - ]], |
|
| 149 | - 'service_time' => 450, |
|
| 150 | - 'address_icon' => 'emoji/emoji-bus', |
|
| 121 | + 'address_1' => '730 CECIL AVENUE, Louisville, KY, 40211', |
|
| 122 | + 'address_alias' => '730 CECIL AVENUE 40211', |
|
| 123 | + 'address_group' => 'Scheduled monthly', |
|
| 124 | + 'first_name' => 'David', |
|
| 125 | + 'last_name' => 'Silvester', |
|
| 126 | + 'address_email' => '[email protected]', |
|
| 127 | + 'address_phone_number' => '36985214', |
|
| 128 | + 'cached_lat' => 38.248684, |
|
| 129 | + 'cached_lng' => -85.821121, |
|
| 130 | + 'curbside_lat' => 38.248684, |
|
| 131 | + 'curbside_lng' => -85.821121, |
|
| 132 | + 'address_city' => 'Louisville', |
|
| 133 | + 'address_custom_data' => [ |
|
| 134 | + 'scheduled' => 'yes', |
|
| 135 | + 'service type' => 'library', |
|
| 136 | + ], |
|
| 137 | + 'schedule' => [[ |
|
| 138 | + 'enabled' => true, |
|
| 139 | + 'mode' => 'monthly', |
|
| 140 | + 'monthly' => [ |
|
| 141 | + 'every' => 1, |
|
| 142 | + 'mode' => 'nth', |
|
| 143 | + 'nth' => [ |
|
| 144 | + 'n' => 1, |
|
| 145 | + 'what' => 4, |
|
| 146 | + ], |
|
| 147 | + ], |
|
| 148 | + ]], |
|
| 149 | + 'service_time' => 450, |
|
| 150 | + 'address_icon' => 'emoji/emoji-bus', |
|
| 151 | 151 | ]); |
| 152 | 152 | |
| 153 | 153 | $abContacts4 = new AddressBookLocation(); |
@@ -162,29 +162,29 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | //region // Add a location with the daily scheduling and blacklist. |
| 164 | 164 | $AddressBookLocationParameters = AddressBookLocation::fromArray([ |
| 165 | - 'address_1' => '4629 HILLSIDE DRIVE, Louisville, KY, 40216', |
|
| 166 | - 'address_alias' => '4629 HILLSIDE DRIVE 40216', |
|
| 167 | - 'address_group' => 'Scheduled daily', |
|
| 168 | - 'first_name' => 'Kim', |
|
| 169 | - 'last_name' => 'Shandor', |
|
| 170 | - 'address_email' => '[email protected]', |
|
| 171 | - 'address_phone_number' => '9874152', |
|
| 172 | - 'cached_lat' => 38.176067, |
|
| 173 | - 'cached_lng' => -85.824638, |
|
| 174 | - 'curbside_lat' => 38.176067, |
|
| 175 | - 'curbside_lng' => -85.824638, |
|
| 176 | - 'address_city' => 'Louisville', |
|
| 177 | - 'address_custom_data' => [ |
|
| 178 | - 'scheduled' => 'yes', |
|
| 179 | - 'serice type' => 'appliance', |
|
| 180 | - ], |
|
| 181 | - 'schedule' => [ |
|
| 182 | - 'enabled' => true, |
|
| 183 | - 'mode' => 'daily', |
|
| 184 | - 'daily' => ['every' => 1], |
|
| 185 | - ], |
|
| 186 | - 'schedule_blacklist' => ['2017-02-24', '2017-02-25'], |
|
| 187 | - 'service_time' => 300, |
|
| 165 | + 'address_1' => '4629 HILLSIDE DRIVE, Louisville, KY, 40216', |
|
| 166 | + 'address_alias' => '4629 HILLSIDE DRIVE 40216', |
|
| 167 | + 'address_group' => 'Scheduled daily', |
|
| 168 | + 'first_name' => 'Kim', |
|
| 169 | + 'last_name' => 'Shandor', |
|
| 170 | + 'address_email' => '[email protected]', |
|
| 171 | + 'address_phone_number' => '9874152', |
|
| 172 | + 'cached_lat' => 38.176067, |
|
| 173 | + 'cached_lng' => -85.824638, |
|
| 174 | + 'curbside_lat' => 38.176067, |
|
| 175 | + 'curbside_lng' => -85.824638, |
|
| 176 | + 'address_city' => 'Louisville', |
|
| 177 | + 'address_custom_data' => [ |
|
| 178 | + 'scheduled' => 'yes', |
|
| 179 | + 'serice type' => 'appliance', |
|
| 180 | + ], |
|
| 181 | + 'schedule' => [ |
|
| 182 | + 'enabled' => true, |
|
| 183 | + 'mode' => 'daily', |
|
| 184 | + 'daily' => ['every' => 1], |
|
| 185 | + ], |
|
| 186 | + 'schedule_blacklist' => ['2017-02-24', '2017-02-25'], |
|
| 187 | + 'service_time' => 300, |
|
| 188 | 188 | ]); |
| 189 | 189 | |
| 190 | 190 | $abContacts5 = new AddressBookLocation(); |
@@ -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 | |