Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
f6ec47a9
Commit
f6ec47a9
authored
Feb 05, 2003
by
Robert Ricci
Browse files
Merge in '-r' and '-p' options from the assign-paper branch.
parent
e62637d2
Changes
5
Hide whitespace changes
Inline
Side-by-side
assign/assign.cc
View file @
f6ec47a9
...
...
@@ -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
();
}
...
...
assign/pclass.cc
View file @
f6ec47a9
...
...
@@ -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
...
...
assign/pclass.h
View file @
f6ec47a9
#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*.
...
...
assign/score.cc
View file @
f6ec47a9
...
...
@@ -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
);
...
...
assign/score.h
View file @
f6ec47a9
...
...
@@ -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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment