- For our TSP problem, the subdirectory is called TSP and the objective
function is defined in TSP/tsp.cpp. The data structures are
declared and defined TSP/tsp_graphs.h and TSP/tsp_graph.cpp.
- TSP/Makefile serves as the standard template. Two flags
PROBLEM_FLAG and REPRESENTATION_FLAG must be set correctly; look
into problem_defs.h for detailed information. For TSP, these
two flags are set in TSP/Makefile as follows:
export PROBLEM_FLAG = TSP
export REPRESENTATION_FLAG = CIRCULARPERMUTATION
- To let TSP/Makefile know the appropriate files, we specify
where the objective function is defined (stored in obj_func_file
variable) and where the data structure is defined (stored in the
search_space_file variable). The output program name is stored in PROG.
obj_func_file = tsp
search_space_file = tsp_graphs
PROG = tsp
Note that the files are declared without extension (e.g. .cpp).
- Since we use the Graph Library Template (GTL) to implement the graph
data structure, we must specify where the GTL libraries are:
LINKING=dynamic
GTL_DIR=/home/phan
ifeq ($(LINKING),static)
GTL_LIB=$(GTL_DIR)/lib/libGTL.a
else
GTL_LIB=-L$(GTL_DIR)/lib -lGTL
endif
- To let DISCROPT know about the files, the user must define appropriate
entries in problem_defs.h. For TSP, it is:
#if TSP
#include "TSP/tsp_graphs.h"
typedef Graph InputType;
#endif
The general form is:
#if PROBLEM_FLAG
#include "ProblemDirectory/search_space_data_structure.h"
typedef DataStructureClass InputType;
#endif