Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
473 B
5
Indexable
Never
Minimize
  // Objective function: Total distance
  10 x12 + 15 x13 + 20 x14 + 35 x23 + 25 x24 + 30 x34

Subject To
  // Each city is visited exactly once
  c1: x12 + x13 + x14 = 1
  c2: x12 + x23 + x24 = 1
  c3: x13 + x23 + x34 = 1
  c4: x14 + x24 + x34 = 1

Bounds
  // Binary decision variables (0 or 1)
  0 <= x12 <= 1
  0 <= x13 <= 1
  0 <= x14 <= 1
  0 <= x23 <= 1
  0 <= x24 <= 1
  0 <= x34 <= 1

Binaries
  // List of binary variables
  x12 x13 x14 x23 x24 x34

End