Maximum penetration!
A Pen by Jamie Coulter on CodePen.
Maximum penetration!
A Pen by Jamie Coulter on CodePen.
| #!/usr/bin/env python3 | |
| # [START program] | |
| """Vehicles Routing Problem (VRP) for delivering items from any suppliers. | |
| Description: | |
| Need to deliver some item X and Y at end nodes (at least 11 X and 13 Y). | |
| Several locations provide them and even few provide both. | |
| * fleet | |
| * vehicles: 2 | |
| * x capacity: 15 | |
| * y capacity: 15 |
| #!/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['distance_matrix'] = [ | |
| [ |
| #!/usr/bin/env python3 | |
| """Example of a simple team scheduling problem.""" | |
| from ortools.sat.python import cp_model | |
| def main(n): | |
| # Data. | |
| num_teams = 2 * n | |
| num_rounds = n | |
| num_games = n | |
| all_teams = range(num_teams) |
| #!/usr/bin/env bash | |
| # First, disable the workflow you want to delete (via Github console) before executing this script. | |
| # This script need gh cli and jq | |
| # ref: https://github.com/cli/cli | |
| # ref: https://github.com/stedolan/jq | |
| set -euo pipefail | |
| command -v gh | |
| command -v jq |
| #!/usr/bin/env python3 | |
| """Capacitated Vehicle Routing Problem""" | |
| from six.moves import xrange | |
| from ortools.constraint_solver import pywrapcp | |
| from ortools.constraint_solver import routing_enums_pb2 | |
| import networkx as nx | |
| import matplotlib.pyplot as plt | |
| import random | |
| import math | |
| import pandas as pd |
| from ortools.constraint_solver import routing_enums_pb2 | |
| from ortools.constraint_solver import pywrapcp | |
| # Create Data Model | |
| def create_data_model(): | |
| """Stores the data for the problem.""" | |
| data = {} | |
| data['time_matrix'] = [ | |
| [0,77,157,140,258,233,289,175,202,479,209,275,641,299,108,83,151,198,246,0,125,319,321,607,408,336,274,502,268,227,461,393,505,445,373,835,725,325,82,27,180,186,388,193,29,29,29,575,23,163,117,672,79], | |
| [77,0,234,217,221,189,272,144,280,556,286,248,718,376,175,53,154,265,209,77,203,283,277,684,485,413,351,579,345,304,538,376,582,522,440,912,802,402,159,104,257,142,465,270,106,106,106,652,100,126,184,749,82], |
| #!/usr/bin/env python3 | |
| #### dial-a-ride problem with time window and maximum riding time | |
| from ortools.constraint_solver import routing_enums_pb2 | |
| from ortools.constraint_solver import pywrapcp | |
| #import pandas as pd | |
| import math | |
| # Create Data Model |
| #!/usr/bin/env python3 | |
| from ortools.constraint_solver import routing_enums_pb2 | |
| from ortools.constraint_solver import pywrapcp | |
| time_mat = [ | |
| [ | |
| 0, 998, 940, 336, 4003, 2039, 1786, 791, 651, 1027, 470, 1143, 761, | |
| 1390, 118, 3525 | |
| ], | |
| [ |
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """vrp_plot.py | |
| Simple Vehicle Routing Problem with display using plotlib | |
| In the *Vehicle Routing Problem (VRP)*, the goal is to find optimal routes for multiple vehicles visiting a set of locations. (When there's only one vehicle, it reduces to the Traveling Salesman Problem.) | |
| This example of a VRP in which the goal is to minimize the longest single route. | |
| Imagine a company that needs to visit its customers in a city made up of identical rectangular blocks. |