pub struct Finder(/* private fields */);Expand description
A search for the instances, or traces, of one problem, one after another. With changing relations, it tries the shapes of LOGIC.md 13.4 in order: by number of states, then by loop target.
use elinvar_engine::logic::{Bounds, Expr, Relation, Universe};
use elinvar_engine::{Finder, Next, Options};
let u = Universe::new(["A", "B"]).unwrap();
let s = Relation::unary("S");
let mut b = Bounds::new(&u);
b.bound_upper(&s, u.all(1).unwrap()).unwrap();
let mut finder = Finder::new(&b, &Expr::relation(&s).some(), &Options::default()).unwrap();
let mut found = 0;
while let Next::Instance(_) = finder.next_instance() {
found += 1;
}
assert!(found >= 1);Implementations§
Source§impl Finder
impl Finder
Sourcepub fn new(
bounds: &Bounds,
formula: &Formula,
options: &Options,
) -> Result<Finder, Vec<Error>>
pub fn new( bounds: &Bounds, formula: &Formula, options: &Options, ) -> Result<Finder, Vec<Error>>
Translates a problem: bounds and a formula with no free variables, using the default solver.
Errors: every error of the formula against the bounds, together.
Sourcepub fn with_solver<S, F>(
bounds: &Bounds,
formula: &Formula,
options: &Options,
make_solver: F,
) -> Result<Finder, Vec<Error>>
pub fn with_solver<S, F>( bounds: &Bounds, formula: &Formula, options: &Options, make_solver: F, ) -> Result<Finder, Vec<Error>>
Translates a problem using a solver built by make_solver (R9,
DESIGN.md section 7.4). Each trace shape asks for a fresh solver.
Every returned instance or trace is still refereed by elinvar-logic.
Errors: every error of the formula against the bounds, together.
Sourcepub fn stats(&self) -> Stats
pub fn stats(&self) -> Stats
Statistics so far: the size of the last translation, and the conflicts of every solve.
Sourcepub fn next_instance(&mut self) -> Next
pub fn next_instance(&mut self) -> Next
The next instance or trace, after ruling out those already given (LOGIC.md 12.6 and 13.4).