@@ -6,157 +6,157 @@ |
||
6 | 6 | |
7 | 7 | class Vehicle extends Common |
8 | 8 | { |
9 | - public $vehicle_id; |
|
10 | - public $member_id; |
|
11 | - public $is_deleted; |
|
12 | - public $vehicle_alias; |
|
13 | - public $vehicle_vin; |
|
14 | - public $vehicle_reg_state_id; |
|
15 | - public $vehicle_reg_country_id; |
|
16 | - public $vehicle_license_plate; |
|
17 | - public $vehicle_type_id; |
|
18 | - public $vehicle_make; |
|
19 | - public $vehicle_model_year; |
|
20 | - public $vehicle_model; |
|
21 | - public $vehicle_year_acquired; |
|
22 | - public $vehicle_cost_new; |
|
23 | - public $purchased_new; |
|
24 | - public $license_start_date; |
|
25 | - public $license_end_date; |
|
26 | - public $vehicle_axle_count; |
|
27 | - public $is_operational; |
|
28 | - public $mpg_city; |
|
29 | - public $mpg_highway; |
|
30 | - public $fuel_type; |
|
31 | - public $height_inches; |
|
32 | - public $weight_lb; |
|
33 | - public $external_telematics_vehicle_id; |
|
34 | - public $has_trailer; |
|
35 | - public $heightInInches; |
|
36 | - public $lengthInInches; |
|
37 | - public $widthInInches; |
|
38 | - public $maxWeightPerAxleGroupInPounds; |
|
39 | - public $numAxles; |
|
40 | - public $weightInPounds; |
|
41 | - public $HazmatType; |
|
42 | - public $LowEmissionZonePref; |
|
43 | - public $Use53FootTrailerRouting; |
|
44 | - public $UseNationalNetwork; |
|
45 | - public $UseTruckRestrictions; |
|
46 | - public $AvoidFerries; |
|
47 | - public $DividedHighwayAvoidPreference; |
|
48 | - public $FreewayAvoidPreference; |
|
49 | - public $InternationalBordersOpen; |
|
50 | - public $TollRoadUsage; |
|
51 | - public $hwy_only; |
|
52 | - public $long_combination_vehicle; |
|
53 | - public $avoid_highways; |
|
54 | - public $side_street_adherence; |
|
55 | - public $truck_config; |
|
56 | - public $height_metric; |
|
57 | - public $length_metric; |
|
58 | - public $width_metric; |
|
59 | - public $weight_metric; |
|
60 | - public $max_weight_per_axle_group_metric; |
|
9 | + public $vehicle_id; |
|
10 | + public $member_id; |
|
11 | + public $is_deleted; |
|
12 | + public $vehicle_alias; |
|
13 | + public $vehicle_vin; |
|
14 | + public $vehicle_reg_state_id; |
|
15 | + public $vehicle_reg_country_id; |
|
16 | + public $vehicle_license_plate; |
|
17 | + public $vehicle_type_id; |
|
18 | + public $vehicle_make; |
|
19 | + public $vehicle_model_year; |
|
20 | + public $vehicle_model; |
|
21 | + public $vehicle_year_acquired; |
|
22 | + public $vehicle_cost_new; |
|
23 | + public $purchased_new; |
|
24 | + public $license_start_date; |
|
25 | + public $license_end_date; |
|
26 | + public $vehicle_axle_count; |
|
27 | + public $is_operational; |
|
28 | + public $mpg_city; |
|
29 | + public $mpg_highway; |
|
30 | + public $fuel_type; |
|
31 | + public $height_inches; |
|
32 | + public $weight_lb; |
|
33 | + public $external_telematics_vehicle_id; |
|
34 | + public $has_trailer; |
|
35 | + public $heightInInches; |
|
36 | + public $lengthInInches; |
|
37 | + public $widthInInches; |
|
38 | + public $maxWeightPerAxleGroupInPounds; |
|
39 | + public $numAxles; |
|
40 | + public $weightInPounds; |
|
41 | + public $HazmatType; |
|
42 | + public $LowEmissionZonePref; |
|
43 | + public $Use53FootTrailerRouting; |
|
44 | + public $UseNationalNetwork; |
|
45 | + public $UseTruckRestrictions; |
|
46 | + public $AvoidFerries; |
|
47 | + public $DividedHighwayAvoidPreference; |
|
48 | + public $FreewayAvoidPreference; |
|
49 | + public $InternationalBordersOpen; |
|
50 | + public $TollRoadUsage; |
|
51 | + public $hwy_only; |
|
52 | + public $long_combination_vehicle; |
|
53 | + public $avoid_highways; |
|
54 | + public $side_street_adherence; |
|
55 | + public $truck_config; |
|
56 | + public $height_metric; |
|
57 | + public $length_metric; |
|
58 | + public $width_metric; |
|
59 | + public $weight_metric; |
|
60 | + public $max_weight_per_axle_group_metric; |
|
61 | 61 | |
62 | - public function __construct () |
|
63 | - { |
|
64 | - Route4Me::setBaseUrl(Endpoint::WH_BASE_URL); |
|
65 | - } |
|
62 | + public function __construct () |
|
63 | + { |
|
64 | + Route4Me::setBaseUrl(Endpoint::WH_BASE_URL); |
|
65 | + } |
|
66 | 66 | |
67 | - public static function fromArray(array $params) { |
|
68 | - $vehicle= new Vehicle(); |
|
69 | - foreach ($params as $key => $value) { |
|
70 | - if (property_exists($vehicle, $key)) { |
|
71 | - $vehicle->{$key} = $value; |
|
72 | - } |
|
73 | - } |
|
67 | + public static function fromArray(array $params) { |
|
68 | + $vehicle= new Vehicle(); |
|
69 | + foreach ($params as $key => $value) { |
|
70 | + if (property_exists($vehicle, $key)) { |
|
71 | + $vehicle->{$key} = $value; |
|
72 | + } |
|
73 | + } |
|
74 | 74 | |
75 | - return $vehicle; |
|
76 | - } |
|
75 | + return $vehicle; |
|
76 | + } |
|
77 | 77 | |
78 | - public static function getVehicles($params) |
|
79 | - { |
|
80 | - $allQueryFields = array('with_pagination', 'page', 'perPage'); |
|
78 | + public static function getVehicles($params) |
|
79 | + { |
|
80 | + $allQueryFields = array('with_pagination', 'page', 'perPage'); |
|
81 | 81 | |
82 | - $response = Route4Me::makeRequst(array( |
|
83 | - 'url' => Endpoint::VEHICLE_V4, |
|
84 | - 'method' => 'GET', |
|
85 | - 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
86 | - )); |
|
82 | + $response = Route4Me::makeRequst(array( |
|
83 | + 'url' => Endpoint::VEHICLE_V4, |
|
84 | + 'method' => 'GET', |
|
85 | + 'query' => Route4Me::generateRequestParameters($allQueryFields, $params) |
|
86 | + )); |
|
87 | 87 | |
88 | - return $response; |
|
89 | - } |
|
88 | + return $response; |
|
89 | + } |
|
90 | 90 | |
91 | - public function getRandomVehicleId($page,$perPage) |
|
92 | - { |
|
93 | - $params = array( |
|
94 | - 'page' => isset($page) ? $page : 1, |
|
95 | - 'perPage' => isset($perPage) ? $perPage : 10, |
|
96 | - 'with_pagination' => true |
|
97 | - ); |
|
91 | + public function getRandomVehicleId($page,$perPage) |
|
92 | + { |
|
93 | + $params = array( |
|
94 | + 'page' => isset($page) ? $page : 1, |
|
95 | + 'perPage' => isset($perPage) ? $perPage : 10, |
|
96 | + 'with_pagination' => true |
|
97 | + ); |
|
98 | 98 | |
99 | - $vehicles = $this->getVehicles($params); |
|
99 | + $vehicles = $this->getVehicles($params); |
|
100 | 100 | |
101 | - if (is_null($vehicles) || !isset($vehicles['data']) || sizeof($vehicles['data'])<1) { |
|
102 | - return null; |
|
103 | - } |
|
101 | + if (is_null($vehicles) || !isset($vehicles['data']) || sizeof($vehicles['data'])<1) { |
|
102 | + return null; |
|
103 | + } |
|
104 | 104 | |
105 | - $randomIndex = rand(0, sizeof($vehicles['data']) - 1); |
|
105 | + $randomIndex = rand(0, sizeof($vehicles['data']) - 1); |
|
106 | 106 | |
107 | - return $vehicles['data'][$randomIndex]['vehicle_id']; |
|
108 | - } |
|
107 | + return $vehicles['data'][$randomIndex]['vehicle_id']; |
|
108 | + } |
|
109 | 109 | |
110 | - public function getVehicleByID($vehicleID) |
|
111 | - { |
|
112 | - $response = Route4Me::makeRequst(array( |
|
113 | - 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
114 | - 'method' => 'GET' |
|
115 | - )); |
|
110 | + public function getVehicleByID($vehicleID) |
|
111 | + { |
|
112 | + $response = Route4Me::makeRequst(array( |
|
113 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
114 | + 'method' => 'GET' |
|
115 | + )); |
|
116 | 116 | |
117 | - return $response; |
|
118 | - } |
|
117 | + return $response; |
|
118 | + } |
|
119 | 119 | |
120 | - public function updateVehicle($params) |
|
121 | - { |
|
122 | - $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
|
120 | + public function updateVehicle($params) |
|
121 | + { |
|
122 | + $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
|
123 | 123 | |
124 | - $allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id')); |
|
124 | + $allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id')); |
|
125 | 125 | |
126 | - $response = Route4Me::makeRequst(array( |
|
127 | - 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
128 | - 'method' => 'PUT', |
|
129 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
130 | - 'HTTPHEADER' => 'Content-Type: application/json' |
|
131 | - )); |
|
126 | + $response = Route4Me::makeRequst(array( |
|
127 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
128 | + 'method' => 'PUT', |
|
129 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
130 | + 'HTTPHEADER' => 'Content-Type: application/json' |
|
131 | + )); |
|
132 | 132 | |
133 | - return $response; |
|
134 | - } |
|
133 | + return $response; |
|
134 | + } |
|
135 | 135 | |
136 | - public function createVehicle($params) |
|
137 | - { |
|
138 | - $allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id')); |
|
136 | + public function createVehicle($params) |
|
137 | + { |
|
138 | + $allBodyFields = Route4Me::getObjectProperties(new Vehicle(), array('vehicle_id')); |
|
139 | 139 | |
140 | - $response = Route4Me::makeRequst(array( |
|
141 | - 'url' => Endpoint::VEHICLE_V4, |
|
142 | - 'method' => 'POST', |
|
143 | - 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
144 | - 'HTTPHEADER' => 'Content-Type: application/json' |
|
145 | - )); |
|
140 | + $response = Route4Me::makeRequst(array( |
|
141 | + 'url' => Endpoint::VEHICLE_V4, |
|
142 | + 'method' => 'POST', |
|
143 | + 'body' => Route4Me::generateRequestParameters($allBodyFields, $params), |
|
144 | + 'HTTPHEADER' => 'Content-Type: application/json' |
|
145 | + )); |
|
146 | 146 | |
147 | - return $response; |
|
148 | - } |
|
147 | + return $response; |
|
148 | + } |
|
149 | 149 | |
150 | - public function removeVehicle($params) |
|
151 | - { |
|
152 | - $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
|
150 | + public function removeVehicle($params) |
|
151 | + { |
|
152 | + $vehicleID = isset($params->vehicle_id) ? $params->vehicle_id : null; |
|
153 | 153 | |
154 | - $response = Route4Me::makeRequst(array( |
|
155 | - 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
156 | - 'method' => 'DELETE', |
|
157 | - 'HTTPHEADER' => 'Content-Type: application/json' |
|
158 | - )); |
|
154 | + $response = Route4Me::makeRequst(array( |
|
155 | + 'url' => Endpoint::VEHICLE_V4.'/'.$vehicleID, |
|
156 | + 'method' => 'DELETE', |
|
157 | + 'HTTPHEADER' => 'Content-Type: application/json' |
|
158 | + )); |
|
159 | 159 | |
160 | - return $response; |
|
161 | - } |
|
160 | + return $response; |
|
161 | + } |
|
162 | 162 | } |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | public $weight_metric; |
60 | 60 | public $max_weight_per_axle_group_metric; |
61 | 61 | |
62 | - public function __construct () |
|
62 | + public function __construct() |
|
63 | 63 | { |
64 | 64 | Route4Me::setBaseUrl(Endpoint::WH_BASE_URL); |
65 | 65 | } |
66 | 66 | |
67 | 67 | public static function fromArray(array $params) { |
68 | - $vehicle= new Vehicle(); |
|
68 | + $vehicle = new Vehicle(); |
|
69 | 69 | foreach ($params as $key => $value) { |
70 | 70 | if (property_exists($vehicle, $key)) { |
71 | 71 | $vehicle->{$key} = $value; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | return $response; |
89 | 89 | } |
90 | 90 | |
91 | - public function getRandomVehicleId($page,$perPage) |
|
91 | + public function getRandomVehicleId($page, $perPage) |
|
92 | 92 | { |
93 | 93 | $params = array( |
94 | 94 | 'page' => isset($page) ? $page : 1, |
@@ -5,74 +5,74 @@ |
||
5 | 5 | |
6 | 6 | class RouteParameters extends Common |
7 | 7 | { |
8 | - public $is_upload; |
|
9 | - public $rt; |
|
10 | - public $route_name; |
|
11 | - public $route_date; |
|
12 | - public $route_time; |
|
13 | - public $shared_publicly; |
|
14 | - public $disable_optimization; |
|
15 | - public $optimize; |
|
16 | - public $lock_last; |
|
17 | - public $vehicle_capacity; |
|
18 | - public $vehicle_max_distance_mi; |
|
19 | - public $distance_unit; |
|
20 | - public $travel_mode; |
|
21 | - public $avoid; |
|
22 | - public $vehicle_id; |
|
23 | - public $dev_lat; |
|
24 | - public $dev_lng; |
|
25 | - public $route_max_duration; |
|
26 | - public $route_email; |
|
27 | - public $route_type = "api"; |
|
28 | - public $store_route = true; |
|
29 | - public $metric; |
|
30 | - public $algorithm_type; |
|
31 | - public $member_id; |
|
32 | - public $ip; |
|
33 | - public $dm; |
|
34 | - public $dirm; |
|
35 | - public $parts; |
|
36 | - public $device_id; |
|
37 | - public $device_type; |
|
38 | - public $has_trailer; |
|
39 | - public $trailer_weight_t; |
|
40 | - public $limited_weight_t; |
|
41 | - public $weight_per_axle_t; |
|
42 | - public $truck_height_meters; |
|
43 | - public $truck_width_meters; |
|
44 | - public $truck_length_meters; |
|
45 | - public $truck_hazardous_goods; |
|
8 | + public $is_upload; |
|
9 | + public $rt; |
|
10 | + public $route_name; |
|
11 | + public $route_date; |
|
12 | + public $route_time; |
|
13 | + public $shared_publicly; |
|
14 | + public $disable_optimization; |
|
15 | + public $optimize; |
|
16 | + public $lock_last; |
|
17 | + public $vehicle_capacity; |
|
18 | + public $vehicle_max_distance_mi; |
|
19 | + public $distance_unit; |
|
20 | + public $travel_mode; |
|
21 | + public $avoid; |
|
22 | + public $vehicle_id; |
|
23 | + public $dev_lat; |
|
24 | + public $dev_lng; |
|
25 | + public $route_max_duration; |
|
26 | + public $route_email; |
|
27 | + public $route_type = "api"; |
|
28 | + public $store_route = true; |
|
29 | + public $metric; |
|
30 | + public $algorithm_type; |
|
31 | + public $member_id; |
|
32 | + public $ip; |
|
33 | + public $dm; |
|
34 | + public $dirm; |
|
35 | + public $parts; |
|
36 | + public $device_id; |
|
37 | + public $device_type; |
|
38 | + public $has_trailer; |
|
39 | + public $trailer_weight_t; |
|
40 | + public $limited_weight_t; |
|
41 | + public $weight_per_axle_t; |
|
42 | + public $truck_height_meters; |
|
43 | + public $truck_width_meters; |
|
44 | + public $truck_length_meters; |
|
45 | + public $truck_hazardous_goods; |
|
46 | 46 | |
47 | - public $vehicle_max_cargo_weight; |
|
48 | - public $vehicle_max_cargo_volume; |
|
49 | - public $subtour_max_revenue; |
|
50 | - public $avoidance_zones; |
|
51 | - public $driver_id; |
|
52 | - public $parts_min; |
|
53 | - public $first_drive_then_wait_between_stops; |
|
54 | - public $truck_height; |
|
55 | - public $truck_width; |
|
56 | - public $truck_length; |
|
57 | - public $optimization_quality; |
|
58 | - public $override_addresses; |
|
59 | - public $max_tour_size; |
|
60 | - public $min_tour_size; |
|
61 | - public $uturn; |
|
62 | - public $leftturn; |
|
63 | - public $rightturn; |
|
47 | + public $vehicle_max_cargo_weight; |
|
48 | + public $vehicle_max_cargo_volume; |
|
49 | + public $subtour_max_revenue; |
|
50 | + public $avoidance_zones; |
|
51 | + public $driver_id; |
|
52 | + public $parts_min; |
|
53 | + public $first_drive_then_wait_between_stops; |
|
54 | + public $truck_height; |
|
55 | + public $truck_width; |
|
56 | + public $truck_length; |
|
57 | + public $optimization_quality; |
|
58 | + public $override_addresses; |
|
59 | + public $max_tour_size; |
|
60 | + public $min_tour_size; |
|
61 | + public $uturn; |
|
62 | + public $leftturn; |
|
63 | + public $rightturn; |
|
64 | 64 | |
65 | - public $optimized_callback_url; |
|
65 | + public $optimized_callback_url; |
|
66 | 66 | |
67 | - public static function fromArray(array $params) |
|
68 | - { |
|
69 | - $routeParams = new RouteParameters(); |
|
70 | - foreach ($params as $key => $value) { |
|
71 | - if (property_exists($routeParams, $key)) { |
|
72 | - $routeParams->{$key} = $value; |
|
73 | - } |
|
74 | - } |
|
67 | + public static function fromArray(array $params) |
|
68 | + { |
|
69 | + $routeParams = new RouteParameters(); |
|
70 | + foreach ($params as $key => $value) { |
|
71 | + if (property_exists($routeParams, $key)) { |
|
72 | + $routeParams->{$key} = $value; |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | - return $routeParams; |
|
77 | - } |
|
76 | + return $routeParams; |
|
77 | + } |
|
78 | 78 | } |
@@ -4,17 +4,17 @@ |
||
4 | 4 | |
5 | 5 | class Common |
6 | 6 | { |
7 | - public static function getValue($array, $item, $default = null) |
|
8 | - { |
|
9 | - return (isset($array[$item])) ? $array[$item] : $default; |
|
10 | - } |
|
7 | + public static function getValue($array, $item, $default = null) |
|
8 | + { |
|
9 | + return (isset($array[$item])) ? $array[$item] : $default; |
|
10 | + } |
|
11 | 11 | |
12 | - public function toArray() |
|
13 | - { |
|
14 | - $params = array_filter(get_object_vars($this), function($item) { |
|
15 | - return ($item!==null) && !(is_array($item) && !count($item)); |
|
16 | - }); |
|
12 | + public function toArray() |
|
13 | + { |
|
14 | + $params = array_filter(get_object_vars($this), function($item) { |
|
15 | + return ($item!==null) && !(is_array($item) && !count($item)); |
|
16 | + }); |
|
17 | 17 | |
18 | - return $params; |
|
19 | - } |
|
18 | + return $params; |
|
19 | + } |
|
20 | 20 | } |
@@ -26,22 +26,22 @@ discard block |
||
26 | 26 | |
27 | 27 | $addresses = array(); |
28 | 28 | foreach ($json as $address) { |
29 | - $addresses[] = Address::fromArray($address); |
|
29 | + $addresses[] = Address::fromArray($address); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $parameters = RouteParameters::fromArray(array( |
33 | - "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
34 | - "route_name" => "Multiple Depot, Multiple Driver with 24 Stops, Time Window", |
|
35 | - "route_date" => time() + 24*60*60, |
|
36 | - "route_time" => 60 * 60 * 7, |
|
37 | - "distance_unit" => DistanceUnit::MILES, |
|
38 | - "device_type" => DeviceType::WEB, |
|
39 | - "optimize" => OptimizationType::DISTANCE, |
|
40 | - "metric" => Metric::GEODESIC, |
|
41 | - "route_max_duration" => 86400, |
|
42 | - "travel_mode" => TravelMode::DRIVING, |
|
43 | - "vehicle_capacity" => 1, |
|
44 | - "vehicle_max_distance_mi" => 10000 |
|
33 | + "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
34 | + "route_name" => "Multiple Depot, Multiple Driver with 24 Stops, Time Window", |
|
35 | + "route_date" => time() + 24*60*60, |
|
36 | + "route_time" => 60 * 60 * 7, |
|
37 | + "distance_unit" => DistanceUnit::MILES, |
|
38 | + "device_type" => DeviceType::WEB, |
|
39 | + "optimize" => OptimizationType::DISTANCE, |
|
40 | + "metric" => Metric::GEODESIC, |
|
41 | + "route_max_duration" => 86400, |
|
42 | + "travel_mode" => TravelMode::DRIVING, |
|
43 | + "vehicle_capacity" => 1, |
|
44 | + "vehicle_max_distance_mi" => 10000 |
|
45 | 45 | )); |
46 | 46 | |
47 | 47 | $optimizationParams = new OptimizationProblemParams; |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | $problem = OptimizationProblem::optimize($optimizationParams); |
52 | 52 | |
53 | 53 | foreach ((array)$problem as $key => $value) { |
54 | - if (is_string($value)) { |
|
55 | - echo $key." --> ".$value."<br>"; |
|
56 | - } else { |
|
57 | - echo "************ $key ************* <br>"; |
|
58 | - Route4Me::simplePrint((array)$value, true); |
|
59 | - echo "******************************* <br>"; |
|
60 | - } |
|
54 | + if (is_string($value)) { |
|
55 | + echo $key." --> ".$value."<br>"; |
|
56 | + } else { |
|
57 | + echo "************ $key ************* <br>"; |
|
58 | + Route4Me::simplePrint((array)$value, true); |
|
59 | + echo "******************************* <br>"; |
|
60 | + } |
|
61 | 61 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | $parameters = RouteParameters::fromArray(array( |
33 | 33 | "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
34 | 34 | "route_name" => "Multiple Depot, Multiple Driver with 24 Stops, Time Window", |
35 | - "route_date" => time() + 24*60*60, |
|
35 | + "route_date" => time() + 24 * 60 * 60, |
|
36 | 36 | "route_time" => 60 * 60 * 7, |
37 | 37 | "distance_unit" => DistanceUnit::MILES, |
38 | 38 | "device_type" => DeviceType::WEB, |
@@ -26,18 +26,18 @@ |
||
26 | 26 | |
27 | 27 | $addresses = array(); |
28 | 28 | foreach ($json as $address) { |
29 | - $addresses[] = Address::fromArray($address); |
|
29 | + $addresses[] = Address::fromArray($address); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $parameters = RouteParameters::fromArray(array( |
33 | - "algorithm_type" => AlgorithmType::TSP, |
|
34 | - "distance_unit" => DistanceUnit::MILES, |
|
35 | - "device_type" => DeviceType::WEB, |
|
36 | - "optimize" => OptimizationType::DISTANCE, |
|
37 | - "travel_mode" => TravelMode::DRIVING, |
|
38 | - "route_max_duration" => 86400, |
|
39 | - "vehicle_capacity" => 1, |
|
40 | - "vehicle_max_distance_mi" => 10000 |
|
33 | + "algorithm_type" => AlgorithmType::TSP, |
|
34 | + "distance_unit" => DistanceUnit::MILES, |
|
35 | + "device_type" => DeviceType::WEB, |
|
36 | + "optimize" => OptimizationType::DISTANCE, |
|
37 | + "travel_mode" => TravelMode::DRIVING, |
|
38 | + "route_max_duration" => 86400, |
|
39 | + "vehicle_capacity" => 1, |
|
40 | + "vehicle_max_distance_mi" => 10000 |
|
41 | 41 | )); |
42 | 42 | |
43 | 43 | $optimizationParams = new OptimizationProblemParams; |
@@ -26,20 +26,20 @@ |
||
26 | 26 | |
27 | 27 | $addresses = array(); |
28 | 28 | foreach ($json as $address) { |
29 | - $addresses[] = Address::fromArray($address); |
|
29 | + $addresses[] = Address::fromArray($address); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $parameters = RouteParameters::fromArray(array( |
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 |
|
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 | $optimizationParams = new OptimizationProblemParams; |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | |
26 | 26 | $addresses = array(); |
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(array( |
32 | - "algorithm_type" => Algorithmtype::TSP, |
|
33 | - "route_name" => "Single Driver Multiple TimeWindows 12 Stops", |
|
34 | - "route_date" => time() + 24 * 60 * 60, |
|
35 | - "route_time" => 5 * 3600 + 30 * 60, |
|
36 | - "distance_unit" => DistanceUnit::MILES, |
|
37 | - "device_type" => DeviceType::WEB, |
|
38 | - "optimize" => OptimizationType::DISTANCE, |
|
39 | - "metric" => Metric::GEODESIC |
|
32 | + "algorithm_type" => Algorithmtype::TSP, |
|
33 | + "route_name" => "Single Driver Multiple TimeWindows 12 Stops", |
|
34 | + "route_date" => time() + 24 * 60 * 60, |
|
35 | + "route_time" => 5 * 3600 + 30 * 60, |
|
36 | + "distance_unit" => DistanceUnit::MILES, |
|
37 | + "device_type" => DeviceType::WEB, |
|
38 | + "optimize" => OptimizationType::DISTANCE, |
|
39 | + "metric" => Metric::GEODESIC |
|
40 | 40 | )); |
41 | 41 | |
42 | 42 | $optimizationParams = new OptimizationProblemParams; |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | $problem = OptimizationProblem::optimize($optimizationParams); |
47 | 47 | |
48 | 48 | foreach ((array)$problem as $key => $value) { |
49 | - if (is_string($value)) { |
|
50 | - echo $key." --> ".$value."<br>"; |
|
51 | - } else { |
|
52 | - echo "************ $key ************* <br>"; |
|
53 | - Route4Me::simplePrint((array)$value, true); |
|
54 | - echo "******************************* <br>"; |
|
55 | - } |
|
49 | + if (is_string($value)) { |
|
50 | + echo $key." --> ".$value."<br>"; |
|
51 | + } else { |
|
52 | + echo "************ $key ************* <br>"; |
|
53 | + Route4Me::simplePrint((array)$value, true); |
|
54 | + echo "******************************* <br>"; |
|
55 | + } |
|
56 | 56 | } |
@@ -26,24 +26,24 @@ discard block |
||
26 | 26 | |
27 | 27 | $addresses = array(); |
28 | 28 | foreach ($json as $address) { |
29 | - $addresses[] = Address::fromArray($address); |
|
29 | + $addresses[] = Address::fromArray($address); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $parameters = RouteParameters::fromArray(array( |
33 | - "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
34 | - "route_name" => "Single Depot, Multiple Driver, No Time Window", |
|
35 | - "route_date" => time() + 24 * 60 * 60, |
|
36 | - "route_time" => 60 * 60 * 7, |
|
37 | - "rt" => TRUE, |
|
38 | - "distance_unit" => DistanceUnit::MILES, |
|
39 | - "device_type" => DeviceType::WEB, |
|
40 | - "optimize" => OptimizationType::TIME, |
|
41 | - "metric" => Metric::GEODESIC, |
|
42 | - "route_max_duration" => 86400, |
|
43 | - "travel_mode" => TravelMode::DRIVING, |
|
44 | - "vehicle_capacity" => 20, |
|
45 | - "vehicle_max_distance_mi" => 99999, |
|
46 | - "parts" => 4 |
|
33 | + "algorithm_type" => Algorithmtype::CVRP_TW_SD, |
|
34 | + "route_name" => "Single Depot, Multiple Driver, No Time Window", |
|
35 | + "route_date" => time() + 24 * 60 * 60, |
|
36 | + "route_time" => 60 * 60 * 7, |
|
37 | + "rt" => TRUE, |
|
38 | + "distance_unit" => DistanceUnit::MILES, |
|
39 | + "device_type" => DeviceType::WEB, |
|
40 | + "optimize" => OptimizationType::TIME, |
|
41 | + "metric" => Metric::GEODESIC, |
|
42 | + "route_max_duration" => 86400, |
|
43 | + "travel_mode" => TravelMode::DRIVING, |
|
44 | + "vehicle_capacity" => 20, |
|
45 | + "vehicle_max_distance_mi" => 99999, |
|
46 | + "parts" => 4 |
|
47 | 47 | )); |
48 | 48 | |
49 | 49 | $optimizationParams = new OptimizationProblemParams; |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | $problem = OptimizationProblem::optimize($optimizationParams); |
54 | 54 | |
55 | 55 | foreach ((array)$problem as $key => $value) { |
56 | - if (is_string($value)) { |
|
57 | - echo $key." --> ".$value."<br>"; |
|
58 | - } else { |
|
59 | - echo "************ $key ************* <br>"; |
|
60 | - Route4Me::simplePrint((array)$value, true); |
|
61 | - echo "******************************* <br>"; |
|
62 | - } |
|
56 | + if (is_string($value)) { |
|
57 | + echo $key." --> ".$value."<br>"; |
|
58 | + } else { |
|
59 | + echo "************ $key ************* <br>"; |
|
60 | + Route4Me::simplePrint((array)$value, true); |
|
61 | + echo "******************************* <br>"; |
|
62 | + } |
|
63 | 63 | } |
@@ -27,19 +27,19 @@ discard block |
||
27 | 27 | $addresses = array(); |
28 | 28 | |
29 | 29 | foreach ($json as $address) { |
30 | - $addresses[] = Address::fromArray($address); |
|
30 | + $addresses[] = Address::fromArray($address); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | $parameters = RouteParameters::fromArray(array( |
34 | - "algorithm_type" => AlgorithmType::TSP, |
|
35 | - "distance_unit" => DistanceUnit::MILES, |
|
36 | - "device_type" => DeviceType::WEB, |
|
37 | - "optimize" => OptimizationType::DISTANCE, |
|
38 | - "travel_mode" => TravelMode::DRIVING, |
|
39 | - "route_max_duration" => 86400, |
|
40 | - "vehicle_capacity" => 1, |
|
41 | - "vehicle_max_distance_mi" => 10000, |
|
42 | - "rt" => true |
|
34 | + "algorithm_type" => AlgorithmType::TSP, |
|
35 | + "distance_unit" => DistanceUnit::MILES, |
|
36 | + "device_type" => DeviceType::WEB, |
|
37 | + "optimize" => OptimizationType::DISTANCE, |
|
38 | + "travel_mode" => TravelMode::DRIVING, |
|
39 | + "route_max_duration" => 86400, |
|
40 | + "vehicle_capacity" => 1, |
|
41 | + "vehicle_max_distance_mi" => 10000, |
|
42 | + "rt" => true |
|
43 | 43 | )); |
44 | 44 | |
45 | 45 | $optimizationParams = new OptimizationProblemParams; |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | $problems = OptimizationProblem::optimize($optimizationParams); |
50 | 50 | |
51 | 51 | foreach ($problems as $problem) { |
52 | - if (is_array($problem) || is_object($problem)) { |
|
53 | - foreach ($problem as $key => $value) { |
|
54 | - if (!is_object($value)) { |
|
55 | - echo $key." --> ".$value."<br>"; |
|
56 | - } |
|
57 | - } |
|
58 | - } |
|
52 | + if (is_array($problem) || is_object($problem)) { |
|
53 | + foreach ($problem as $key => $value) { |
|
54 | + if (!is_object($value)) { |
|
55 | + echo $key." --> ".$value."<br>"; |
|
56 | + } |
|
57 | + } |
|
58 | + } |
|
59 | 59 | } |