Beispiel #1
0
func runBench(file string, b dpll.BranchRule, d db.ClauseDBMS) *guess.Guess {

	runtime.GOMAXPROCS(3)
	timeout := time.After(20 * time.Minute)

	// Prepare the specific run
	br := dpll.NewBrancher()
	br.SetRule(b)
	ma := db.NewManager()
	ma.SetStrat(d)

	// Initialize the cdb and assignment
	cdb, a, err := initSolver(file)
	if err != nil {
		log.Fatal(err)
	}
	// Set the proper max db size
	ma.MaxLearned = cdb.NGiven() / 3

	g := dpll.DpllTimeout(cdb, a, br, ma, nil, timeout)
	return g
}
Beispiel #2
0
func runAdaptiveBench(file string, jsonFile string, chooseOnce bool, extraStats bool) (*guess.Guess, *dpll.Adapter) {

	runtime.GOMAXPROCS(3)
	timeout := time.After(20 * time.Minute)

	// Initialize the cdb and assignment
	cdb, a, err := initSolver(file)
	if err != nil {
		log.Fatal(err)
	}
	// Set the proper max db size
	manage.MaxLearned = cdb.NGiven() / 3
	// Read the data from the file and make the adapter
	adapt := dpll.NewAdapter(jsonFile, chooseOnce, extraStats)
	// Use the adapter to set the initial state
	b := dpll.NewBrancher()
	m := db.NewManager()
	adapt.Reconfigure(cdb, b, m)

	g := dpll.DpllTimeout(cdb, a, b, m, adapt, timeout)
	return g, adapt
}
Beispiel #3
0
)

// flags
var (
	seed       int64
	file       string
	logFile    string
	cpuprof    string
	quiet      bool
	analyze    bool
	extraStats bool
	chooseOnce bool
	benchmark  bool
	adaptive   string
	branch     *dpll.Brancher = dpll.NewBrancher()
	manage     *db.Manager    = db.NewManager()
)

func main() {

	flag.Int64Var(&seed, "seed", time.Now().Unix(), "random number generator seed")
	flag.StringVar(&file, "file", "", "dimacs file containing formula")
	flag.StringVar(&logFile, "log", "", "Log output file")
	flag.StringVar(&cpuprof, "cpuprofile", "", "write cpu profile to file")
	flag.BoolVar(&quiet, "q", false, "True for quiet output. States \"SAT\" or \"UNSAT\"")
	flag.BoolVar(&analyze, "e", false, "True for examination output. If true, will not actually run solver.")
	flag.BoolVar(&benchmark, "b", false, "True for benchmark output.")
	flag.BoolVar(&extraStats, "s", false, "True for extra statistics.")
	flag.BoolVar(&chooseOnce, "c", false, "True for choosing once, then not adapting.")
	flag.StringVar(&adaptive, "a", "", "Path to analysis json file. Enables adaptive solving")
	flag.Var(branch, "branch", "DPLL branching rule")