- Improved cost function: now also avoids using initiators when
possible.
This commit is contained in:
parent
52708d09b4
commit
e1890ddc9f
@ -35,6 +35,7 @@ attackCost (const System sys)
|
|||||||
cost += get_semitrace_length ();
|
cost += get_semitrace_length ();
|
||||||
cost += 8 * selfInitiators (sys);
|
cost += 8 * selfInitiators (sys);
|
||||||
cost += 4 * selfResponders (sys);
|
cost += 4 * selfResponders (sys);
|
||||||
|
cost += 2 * countInitiators (sys);
|
||||||
|
|
||||||
return cost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
18
src/system.c
18
src/system.c
@ -1399,6 +1399,24 @@ eventRoledef (const System sys, const int run, const int ev)
|
|||||||
return roledef_shift (sys->runs[run].start, ev);
|
return roledef_shift (sys->runs[run].start, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! count the number of initiators
|
||||||
|
int
|
||||||
|
countInitiators (const System sys)
|
||||||
|
{
|
||||||
|
int run;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
for (run = 0; run < sys->maxruns; run++)
|
||||||
|
{
|
||||||
|
if (sys->runs[run].role->initiator)
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
//! determine whether a run talks to itself
|
//! determine whether a run talks to itself
|
||||||
int
|
int
|
||||||
selfSession (const System sys, const int run)
|
selfSession (const System sys, const int run)
|
||||||
|
@ -201,6 +201,7 @@ int iterateLocalToOther (const System sys, const int myrun,
|
|||||||
int (*callback) (Term t));
|
int (*callback) (Term t));
|
||||||
int firstOccurrence (const System sys, const int r, Term t, int evtype);
|
int firstOccurrence (const System sys, const int r, Term t, int evtype);
|
||||||
Roledef eventRoledef (const System sys, const int run, const int ev);
|
Roledef eventRoledef (const System sys, const int run, const int ev);
|
||||||
|
int countInitiators (const System sys);
|
||||||
int selfResponder (const System sys, const int run);
|
int selfResponder (const System sys, const int run);
|
||||||
int selfResponders (const System sys);
|
int selfResponders (const System sys);
|
||||||
int selfInitiator (const System sys, const int run);
|
int selfInitiator (const System sys, const int run);
|
||||||
|
Loading…
Reference in New Issue
Block a user