Prize collecting TSP with integer programming, branch & bound and revised simplex.
Problem similar to prize-collecting TSP solved with implementation of branch & bound and revised simplex algorithm
as a project for the course of Combinatorial Decision Making and Optimization (Master’s degree in AI) of University of Bologna.
Tested on python3.6 and python3.8, a few changes in the code are required for it to work with python2.
python3 -m pip install numpy matplotlib
The main class can be found in mission_optimizer.py, it requires a few information about the map and the agent,
in particular, it needs:
All these parameters should be written in json files, as shown in “main.py”.
In order to change the constraints one would need to work on the method “create_A_b”, in “mission_optimizer.py”.
The trajectories are computed by the script “a_star.py” taken from PythonRobotics
and adapted in order to work with multiple goals, the script is called internally by the “MissionPlanOptimizer” class.
The path which maximizes the collected price, while minimizing the cost and keeping the energy
and time requirements under the given thresholds, will be printed on the terminal.
An example of usage is given in the script main.py:
python3 main.py
In the following paragraph are describe the json files used to represent map, obstacles, goals and agent parameters.
The map description, along with the grid size with which to discretize the map, should be written in “map.json”, as:
"walls": {"x": [0, 0, 100, 100],"y": [0, 100, 100, 0]}
"obs_1": {"x": [10, 10, 30, 30],"y": [10, 30, 30, 10]}
The problem parameters, i.e. goals’ coordinates, rewards, difficulties and max time and energy, should be written
in the file “problem_par.json”, as:
The file “agent_par.json” contains the parameters associated to the agent, such as:
More information can be found in the pdf report available in the repository.
This repo uses a home-made implementation of branch & bound and revised simplex algorithm, required for the course, but it is not without problem,
these are the first that come to mind:
Obviously, one could use a python library, such as pulp, to write the constraints and solve the problem in a more efficient way.