Commit d5596b15 authored by Mac Newbold's avatar Mac Newbold

Small changes done while working on the genetic algorithm. Added some...

Small changes done while working on the genetic algorithm. Added some debugging output options, cleaned up the make file a bit...
parent 371a614e
......@@ -17,11 +17,14 @@ LEDA=@LEDA@
OBJS=score.o parse_top.o parse_ptop.o config.o
LIBS+=-L${LEDA} -lD3 -lW -lP -lG -lL -L/usr/X11R6/lib -lX11 -lm -L.
LDFLAGS+= -O3 -fomit-frame-pointer -m486
CXXFLAGS = -I${LEDA}/incl
# Pick one of the few below.
CXXFLAGS += -Wall -O3 -fomit-frame-pointer -m486
#CXXFLAGS += -O0 -g -Wall -DSCORE_DEBUG -DVERBOSE -DSCORE_DEBUG
#CXXFLAGS += -O0 -g -Wall -DSCORE_DEBUG -DVERBOSE -DSCORE_DEBUG_MORE
CXXFLAGS = -I${LEDA}/incl -fomit-frame-pointer -m486
# Pick one of the following:
CXXFLAGS += -Wall -O3
#CXXFLAGS += -O0 -g -Wall -DVERBOSE #-DSTATS
#CXXFLAGS += -O0 -g -Wall -DVERBOSE -DGRAPH_DEBUG #=DSTATS
#CXXFLAGS += -O0 -g -Wall -DVERBOSE -DSCORE_DEBUG #-DSTATS
#CXXFLAGS += -O0 -g -Wall -DVERBOSE -DSCORE_DEBUG -DSCORE_DEBUG_MORE #-DSTATS
# If you're looking to turn on or off USE_OPTIMAL, its now a cmdline
# option. Use OP={0,1} on the command line at run time... :)
......
......@@ -134,12 +134,22 @@ int assign()
int absbestv;
float temp = init_temp;
#ifdef VERBOSE
cout << "Initialized to cycles="<<cycles<<" optimal="<<optimal<<" mintrans="
<< mintrans<<" naccepts="<<naccepts<<" nnodes="<<nnodes<<"\n";
#endif
/* Set up the initial counts */
init_score();
bestscore = get_score();
bestviolated = violated;
#ifdef VERBOSE
cout << "Problem started with score "<<bestscore<<" and "<< violated
<< " violations.\n";
#endif
absbest = bestscore;
absbestv = bestviolated;
node n3;
......@@ -248,7 +258,8 @@ int assign()
temp *= temp_rate;
}
cout << "Done.\n";
DONE:
forall_nodes(n, G) {
bestnodes[n] = absnodes[n];
......@@ -442,7 +453,7 @@ int main(int argc, char **argv)
*/
parse_options(argv, options, noptions);
#ifdef SCORE_DEBUG
dump_options("Send options", options, noptions);
dump_options("Configuration options:", options, noptions);
#endif
int seed = time(NULL)+getpid();
......@@ -456,13 +467,14 @@ int main(int argc, char **argv)
* Allow the user to specify a topology in ".top" format.
*/
if (argc == 1) {
if (argc >= 1) {
ifstream infile;
infile.open(argv[0]);
if (!infile || !infile.good()) {
cerr << "Error opening file: " << argv[0] << endl;
exit(-11);
}
cout << "Parsing top\n";
parse_top(G, infile);
}
......
......@@ -63,6 +63,9 @@ int parse_ptop(tb_pgraph &PG, istream& i)
snode = scur;
string s(snode);
no1 = PG.new_node();
#ifdef GRAPH_DEBUG
cout << "Found phys. node '"<<snode<<"'\n";
#endif
PG[no1].name=strdup(snode);
PG[no1].typed = false;
PG[no1].max_load = 0;
......
......@@ -50,6 +50,9 @@ int parse_top(tb_vgraph &G, istream& i)
string s1(scur);
no1 = G.new_node();
unassigned_nodes.insert(no1,random());
#ifdef GRAPH_DEBUG
cout << "Found virt. node '"<<scur<<"'\n";
#endif
G[no1].name=strdup(scur);
G[no1].posistion = 0;
G[no1].no_connections=0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment