Commit f6ec47a9 authored by Robert Ricci's avatar Robert Ricci

Merge in '-r' and '-p' options from the assign-paper branch.

parent e62637d2
......@@ -168,6 +168,12 @@ int iters_to_best = 0; // iters
int npnodes;
// Whether or not assign is allowed to generate trivial links
bool allow_trivial_links = true;
// Whether or not assign should use pclasses
bool use_pclasses = true;
// Determines whether to accept a change of score difference 'change' at
// temperature 'temperature'.
inline int accept(double change, double temperature)
......@@ -1517,9 +1523,11 @@ void print_help()
cerr << " -s <seed> - Set the seed." << endl;
cerr << " -v <viz> - Produce graphviz files with given prefix." <<
endl;
cerr << " -r - Don't allow trivial links." << endl;
cerr << " -p - Disable pclasses." << endl;
exit(0);
}
int main(int argc,char **argv)
{
int seed = 0;
......@@ -1529,7 +1537,7 @@ int main(int argc,char **argv)
char ch;
timelimit = 0.0;
timetarget = 0.0;
while ((ch = getopt(argc,argv,"s:v:l:t:")) != -1) {
while ((ch = getopt(argc,argv,"s:v:l:t:rp")) != -1) {
switch (ch) {
case 's':
if (sscanf(optarg,"%d",&seed) != 1) {
......@@ -1553,6 +1561,10 @@ int main(int argc,char **argv)
}
break;
#endif
case 'r':
allow_trivial_links = false; break;
case 'p':
use_pclasses = false; break;
default:
print_help();
}
......
......@@ -54,9 +54,12 @@ struct hashlinkinfo {
// mapping between links that preserves bw, and destination.
int pclass_equiv(tb_pgraph &PG, tb_pnode *a,tb_pnode *b)
{
#ifdef NO_PCLASSES
return 0;
#else
// We disable pclasses by simply never considering any two nodes to be
// equivalent
if (!use_pclasses) {
return 0;
}
typedef hash_multiset<link_info,hashlinkinfo> link_set;
// check type information
......@@ -111,7 +114,6 @@ int pclass_equiv(tb_pgraph &PG, tb_pnode *a,tb_pnode *b)
}
if (b_links.size() != 0) return 0;
return 1;
#endif
}
/* This function takes a physical graph and generates the set of
......
#ifndef __PCLASS_H
#define __PCLASS_H
// Declared in assign.cc - indicated whether or not we should use pclasses
extern bool use_pclasses;
// tb pnode list is a data structure that acts like list but has
// O(1) removal. It is a list of tb_pnode*.
......
......@@ -525,6 +525,12 @@ int add_node(vvertex vv,pvertex pv, bool deterministic)
if (dest_pv == pv) {
SDEBUG(cerr << " trivial link" << endl);
if (!allow_trivial_links) {
SADD(SCORE_NO_CONNECTION);
vlink->no_connection=true;
vinfo.no_connection++;
violated++;
}
vlink->link_info.type = tb_link_info::LINK_TRIVIAL;
} else {
SDEBUG(cerr << " finding link resolutions" << endl);
......
......@@ -19,6 +19,7 @@ typedef struct {
extern double score;
extern int violated;
extern violated_info vinfo;
extern bool allow_trivial_links;
void init_score();
void remove_node(vvertex vv);
......
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