Пример #1
0
func runAdaptiveSolver(file string, json string, chooseOnce bool, extraStats, quiet bool) {
	// 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(json, chooseOnce, extraStats)
	// Use the adapter to set the initial state
	b := dpll.NewBrancher()
	adapt.Reconfigure(cdb, b, manage)

	g := dpll.Dpll(cdb, a, b, manage, adapt)

	printResults(g, cdb, adapt, !quiet)
}
Пример #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
}