Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • orobworld/robot
1 result
Show changes
Commits on Source (3)
......@@ -4,7 +4,7 @@
This project contains Java code for integer programming (IP) model to solve a [bicriterion routing problem](https://or.stackexchange.com/questions/12451/coverage-path-planning-dilemma-trade-off) posted on Operations Research Stack Exchange. The problem routes a robot over a rectangular grid, with moves (at constant speed) restricted to adjacent squares. Each square has a nonpositive weight, and one criterion is to minimize the sum of the first arrival time at each square multiplied by its weight. The other criterion is to minimize the number of moves required to visit all squares at least once and then return to the origin.
Details of the model can be found in my [blog post](). The code requires a recent version of CPLEX.
Details of the model can be found in my [blog post](). The code requires CPLEX version 12.9 or later.
### License ###
The code here is copyrighted by Paul A. Rubin (yours truly) and licensed under a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/deed.en).
......
......@@ -98,6 +98,8 @@ public final class Model implements AutoCloseable {
}
model.addEq(expr, 1.0, "node_" + n + "_first_visit");
}
// Constraint: the first visit to the origin is at time 0.
model.addEq(first[0][0], 1.0, "origin_first_visit");
// Constraint: the first visit to a node requires being at the node.
for (int t = 0; t < maxMoves; t++) {
for (int n = 0; n < nNodes; n++) {
......