PySCIPOpt  4.3.0
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 95 of file tsp.py.

◆ make_data()

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

Definition at line 99 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 19 of file tsp.py.

References pyscipopt.expr.quicksum().

Variable Documentation

◆ c

c

Definition at line 122 of file tsp.py.

◆ edges

edges

Definition at line 131 of file tsp.py.

◆ n

int n = 200

Definition at line 119 of file tsp.py.

◆ obj

obj

Definition at line 131 of file tsp.py.

◆ seed

int seed = 1

Definition at line 120 of file tsp.py.

◆ V

V

Definition at line 122 of file tsp.py.

◆ x

x

Definition at line 126 of file tsp.py.

◆ y

y

Definition at line 126 of file tsp.py.