- Added support for different attack heuristics. Disable with --prune=2.

This commit is contained in:
ccremers 2006-07-06 15:52:13 +00:00
parent 784304ed65
commit a8dee79504
4 changed files with 41 additions and 15 deletions

View File

@ -1916,7 +1916,7 @@ makeTraceClass (const System sys, Termlist varlist)
void
attackOutputStart (void)
{
if (switches.prune == 2)
if (switches.prune != 0)
{
FILE *fd;
@ -2181,7 +2181,7 @@ iterate ()
int
iterate_buffer_attacks (void)
{
if (switches.prune != 2)
if (switches.prune == 0)
{
return iterate ();
}

View File

@ -8,6 +8,7 @@
*/
#include "switches.h"
#include "system.h"
#include <limits.h>
//************************************************************************
// Private methods
@ -28,6 +29,13 @@
int
attackCost (const System sys)
{
if (switches.prune == 0)
{
return 0;
}
if (switches.prune == 1)
{
// Use nice heuristic cf. work of Gijs Hollestelle. Hand-picked parameters.
int cost;
cost = 0;
@ -43,3 +51,21 @@ attackCost (const System sys)
return cost;
}
if (switches.prune == 2)
{
// Select the first attack.
// Implied by having the cost of traces after finding an attack to be always higher.
//
if (sys->current_claim->failed > 0)
{
// we already have an attack
return INT_MAX;
}
else
{
// return some value relating to the cost (anything less than int_max will do)
return 1;
}
}
error ("Unknown pruning method (cost function not found)");
}

View File

@ -137,7 +137,7 @@ prune_bounds (const System sys)
}
/* prune for cheaper */
if (switches.prune == 2 && attack_leastcost <= attackCost (sys))
if (switches.prune != 0 && attack_leastcost <= attackCost (sys))
{
// We already had an attack at least this cheap.
if (switches.output == PROOF)

View File

@ -41,7 +41,7 @@ switchesInit (int argc, char **argv)
switches.tupling = 0;
// Pruning and Bounding
switches.prune = 2; // default pruning method (just output a single one)
switches.prune = 1; // default pruning method (use heuristic)
switches.maxproofdepth = INT_MAX;
switches.maxtracelength = INT_MAX;
switches.runs = 5; // default is 5 for usability, but -r 0 or --maxruns=0 will set it back to INT_MAX
@ -711,7 +711,7 @@ switcher (const int process, int index, int commandline)
if (!process)
{
/* not very important
helptext (" --prune=<int>", "pruning method when an attack is found [2]");
helptext (" --prune=<int>", "pruning method when an attack is found [1]");
*/
}
else