Skip to content

Commit 21a7535

Browse files
author
Mikael Zayenz Lagerkvist
committed
Fix zero-cost edges in TSP example
1 parent 51d3b54 commit 21a7535

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

changelog.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ Thanks: Yuri Victorovich
116116
Do not create empty MiniZinc directories when FlatZinc is disabled in an
117117
Autotools build.
118118

119+
[ENTRY]
120+
Module: example
121+
What: bug
122+
Rank: minor
123+
Issue: 151
124+
Thanks: Ioannis Papatsoris
125+
[DESCRIPTION]
126+
Treat zero entries in the TSP example as valid zero-cost edges. This lets the
127+
br17 instance reach its optimum.
128+
119129
[ENTRY]
120130
Module: flatzinc
121131
What: new

examples/tsp.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,6 @@ class TSP : public IntMinimizeScript {
244244
// Cost matrix
245245
IntArgs c(n*n, p.d());
246246

247-
// Disallow disconnected nodes
248-
for (int i=0; i<n; i++)
249-
for (int j=0; j<n; j++)
250-
if (p.d(i,j) == 0)
251-
rel(*this, succ[i], IRT_NQ, j);
252-
253247
// Cost of each edge
254248
IntVarArgs costs(*this, n, Int::Limits::min, Int::Limits::max);
255249

0 commit comments

Comments
 (0)