Skip to content

Commit 47b4732

Browse files
committed
time_limit
1 parent d3e2657 commit 47b4732

4 files changed

Lines changed: 60 additions & 14 deletions

File tree

‎Samples/REST Services/MIO/mio.html‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@
204204
var optimizerBody = {
205205
requestBody: {
206206
data: {
207+
"solver_config": {
208+
"time_limit": 1 // This will limit the optimizer to give a response back in around a second reducing the processing time for this demo.
209+
},
207210
cost_matrix_data:
208211
{
209212
data:
@@ -353,7 +356,34 @@
353356
});
354357
};
355358
}
359+
360+
function loadText(url, elementId) {
361+
fetch(url)
362+
.then(response => response.text())
363+
.then(data => {
364+
document.getElementById(elementId).value = data;
365+
})
366+
.catch(error => console.error('Error:', error));
367+
}
368+
369+
loadText('/data/geojson/mio_stops.json', 'textArea1');
370+
loadText('/data/geojson/mio_depots.json', 'textArea2');
371+
loadText('/data/geojson/mio_vehicles.json', 'textArea3');
356372
</script>
373+
374+
<style>
375+
.container {
376+
display: flex;
377+
justify-content: space-around;
378+
margin: 0;
379+
}
380+
381+
textarea {
382+
width: 100%;
383+
height: 400px;
384+
margin: 0;
385+
}
386+
</style>
357387
</head>
358388
<body onload="getMap()">
359389
<div id="myMap" style="position:relative;width:100%;min-width:290px;height:600px;"></div>
@@ -371,5 +401,21 @@
371401
<br />
372402
The scenario outlined includes 8 delivery points, 4 transport units, with each of the 2 storage hubs providing 2 vehicles.
373403
</fieldset>
404+
405+
<div class="container">
406+
<div style="width: 33%;">
407+
<h3>8 delivery points [stops]</h3>
408+
<textarea id="textArea1"></textarea>
409+
</div>
410+
<div style="width: 33%;">
411+
<h3>2 storage hubs [depots]</h3>
412+
<textarea id="textArea2"></textarea>
413+
</div>
414+
<div style="width: 33%;">
415+
<h3>4 transport units [vehicles]</h3>
416+
<textarea id="textArea3"></textarea>
417+
</div>
418+
</div>
419+
374420
</body>
375421
</html>

‎Static/data/geojson/mio_depots.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"features": [
44
{
55
"type": "Feature",
6-
"id": 11,
6+
"id": 0,
77
"geometry": {
88
"type": "Point",
99
"coordinates": [ -105.072334, 40.581108 ]
@@ -14,7 +14,7 @@
1414
},
1515
{
1616
"type": "Feature",
17-
"id": 22,
17+
"id": 1,
1818
"geometry": {
1919
"type": "Point",
2020
"coordinates": [ -105.040072, 40.542962 ]

‎Static/data/geojson/mio_stops.json‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"features": [
44
{
55
"type": "Feature",
6-
"id": 11,
6+
"id": 0,
77
"geometry": {
88
"type": "Point",
99
"coordinates": [ -105.0783007, 40.5601487 ]
@@ -16,7 +16,7 @@
1616
},
1717
{
1818
"type": "Feature",
19-
"id": 22,
19+
"id": 1,
2020
"geometry": {
2121
"type": "Point",
2222
"coordinates": [ -105.0573299, 40.5628491 ]
@@ -29,7 +29,7 @@
2929
},
3030
{
3131
"type": "Feature",
32-
"id": 33,
32+
"id": 2,
3333
"geometry": {
3434
"type": "Point",
3535
"coordinates": [ -105.0351322, 40.5679378 ]
@@ -42,7 +42,7 @@
4242
},
4343
{
4444
"type": "Feature",
45-
"id": 44,
45+
"id": 3,
4646
"geometry": {
4747
"type": "Point",
4848
"coordinates": [ -105.0332723, 40.550293 ]
@@ -55,7 +55,7 @@
5555
},
5656
{
5757
"type": "Feature",
58-
"id": 55,
58+
"id": 4,
5959
"geometry": {
6060
"type": "Point",
6161
"coordinates": [ -105.0306531, 40.5638493 ]
@@ -68,7 +68,7 @@
6868
},
6969
{
7070
"type": "Feature",
71-
"id": 66,
71+
"id": 5,
7272
"geometry": {
7373
"type": "Point",
7474
"coordinates": [ -105.1001173, 40.5472442 ]
@@ -81,7 +81,7 @@
8181
},
8282
{
8383
"type": "Feature",
84-
"id": 77,
84+
"id": 6,
8585
"geometry": {
8686
"type": "Point",
8787
"coordinates": [ -105.1212113, 40.5867356 ]
@@ -94,7 +94,7 @@
9494
},
9595
{
9696
"type": "Feature",
97-
"id": 88,
97+
"id": 7,
9898
"geometry": {
9999
"type": "Point",
100100
"coordinates": [ -105.1245675, 40.5897754 ]

‎Static/data/geojson/mio_vehicles.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[
22
{
3-
"id": 1,
3+
"id": 0,
44
"name": "Car A",
55
"start_end_location_ids": [ 0, 0 ],
66
"capacity": 75,
@@ -10,7 +10,7 @@
1010
"working_hours": [ 8, 17 ]
1111
},
1212
{
13-
"id": 2,
13+
"id": 1,
1414
"name": "Car B",
1515
"start_end_location_ids": [ 0, 0 ],
1616
"capacity": 75,
@@ -20,7 +20,7 @@
2020
"working_hours": [ 8, 17 ]
2121
},
2222
{
23-
"id": 3,
23+
"id": 2,
2424
"name": "Car C",
2525
"start_end_location_ids": [ 1, 1 ],
2626
"capacity": 75,
@@ -30,7 +30,7 @@
3030
"working_hours": [ 8, 17 ]
3131
},
3232
{
33-
"id": 4,
33+
"id": 3,
3434
"name": "Car D",
3535
"start_end_location_ids": [ 1, 1 ],
3636
"capacity": 75,

0 commit comments

Comments
 (0)