%diff --color -u vrp_with_fuelanddroppedvisits.py vrp_with_fuelanddroppedvisits_new.py
--- vrp_with_fuelanddroppedvisits.py 2021-01-21 21:21:06.223665222 +0100
+++ vrp_with_fuelanddroppedvisits_new.py 2021-01-21 21:06:52.350242086 +0100
@@ -1,11 +1,11 @@
-from __future__ import print_function
+#!/usr/bin/env python3
+
from ortools.constraint_solver import routing_enums_pb2
from ortools.constraint_solver import pywrapcp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from ortools.constraint_solver import routing_enums_pb2 | |
from ortools.constraint_solver import pywrapcp | |
def create_data_model(): | |
"""Stores the data for the problem.""" | |
data = {} | |
data['time_matrix'] = [ | |
[0, 6, 9, 8, 7, 3, 6, 2, 3, 2], | |
[6, 0, 8, 3, 2, 6, 8, 4, 8, 8], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Copyright 2010-2021 Google LLC | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from ortools.constraint_solver import routing_enums_pb2 | |
from ortools.constraint_solver import pywrapcp | |
import math | |
import numpy as np | |
def create_data_model(): | |
data = {} | |
fuel_capacity = 40000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Test Multiple route chains constraint | |
We have several chain [A, B, C], [U, V, W], [X,Y] etc.. | |
and a bunch of regular nodes [1,2,3,...] | |
constraints: | |
* Can't interleave chains e.g. "A -> B -> X -> C -> Y" is forbidden | |
* Can have regular node inside a chain e.g. "A -> 3 -> B -> 1 -> C" is OK | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""Vehicles Routing Problem (VRP).""" | |
import sys | |
from ortools.constraint_solver import routing_enums_pb2, pywrapcp | |
# Model | |
dim_name = 'Dimension' | |
def duration_callback(from_index, to_index): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from __future__ import print_function | |
from ortools.constraint_solver import routing_enums_pb2 | |
from ortools.constraint_solver import pywrapcp | |
import math | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def create_data_model(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from __future__ import print_function | |
from ortools.constraint_solver import routing_enums_pb2 | |
from ortools.constraint_solver import pywrapcp | |
import numpy as np | |
import math | |
def create_data_model(): | |
"""Stores the data for the problem.""" | |
data = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from ortools.constraint_solver import pywrapcp | |
from ortools.constraint_solver import routing_enums_pb2 | |
def create_data_model(input_data=None): | |
"""Stores the data for the problem.""" | |
data = {} | |
data['distance_matrix'] = [ | |
[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
"""Capacited Vehicles Routing Problem (CVRP). | |
Here we simulate a vehicle already loaded with 4 orders and on its way to deliver them | |
When a new order (node 5 -> 6) arrives. | |
""" | |
from ortools.constraint_solver import routing_enums_pb2 | |
from ortools.constraint_solver import pywrapcp | |
def print_solution(manager, routing, solution): |