PySCIPOpt  5.1.1
Python Interface for the SCIP Optimization Suite
tsp Namespace Reference

Classes

class  ConshdlrSubtour
 
class  EventhdlrNewSol
 
class  Heur2opt
 
class  HeurFarthestInsert
 
class  HeurFrats
 
class  ProbDataTSP
 
class  ReaderTSP
 

Functions

def distance (x1, y1, x2, y2)
 
def make_data (n)
 
SCIP_RETCODE SCIPcreateConsSubtour (SCIP *scip, SCIP_CONS **cons, const char *name, GRAPH *graph, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable)
 
def solve_tsp (V, c)
 

Variables

 c
 
 edges
 
int n = 200
 
 obj
 
int seed = 1
 
 V
 
 x
 
 y
 

Function Documentation

◆ distance()

def tsp.distance (   x1,
  y1,
  x2,
  y2 
)
distance: euclidean distance between (x1,y1) and (x2,y2)

Definition at line 96 of file tsp.py.

◆ make_data()

def tsp.make_data (   n)
make_data: compute matrix distance based on euclidean distance

Definition at line 101 of file tsp.py.

References distance().

◆ solve_tsp()

def tsp.solve_tsp (   V,
  c 
)
solve_tsp -- solve the traveling salesman problem
   - start with assignment model
   - add cuts until there are no sub-cycles
Parameters:
    - V: set/list of nodes in the graph
    - c[i,j]: cost for traversing edge (i,j)
Returns the optimum objective value and the list of edges used.

Definition at line 21 of file tsp.py.

References pyscipopt.expr.quicksum().

Variable Documentation

◆ c

c

Definition at line 124 of file tsp.py.

◆ edges

edges

Definition at line 134 of file tsp.py.

◆ n

int n = 200

Definition at line 121 of file tsp.py.

◆ obj

obj

Definition at line 134 of file tsp.py.

◆ seed

int seed = 1

Definition at line 122 of file tsp.py.

◆ V

V

Definition at line 124 of file tsp.py.

◆ x

x

Definition at line 129 of file tsp.py.

◆ y

y

Definition at line 129 of file tsp.py.