84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
}
/// The variable index is out of bounds.
InvalidVariable(index: usize, nvars: usize) {
description("invalid variable")
display("Variable index out of bounds, got:{} must be < {}", index, nvars)
}
}
}
/// Result type for solvers.
pub type Result<T> = result::Result<T, Error>;
|
>
>
>
>
>
>
|
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
}
/// The variable index is out of bounds.
InvalidVariable(index: usize, nvars: usize) {
description("invalid variable")
display("Variable index out of bounds, got:{} must be < {}", index, nvars)
}
/// Iteration limit has been reached.
IterationLimit(limit: usize) {
description("iteration limit reached")
display("The iteration limit of {} has been reached.", limit)
}
}
}
/// Result type for solvers.
pub type Result<T> = result::Result<T, Error>;
|
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
|
self.start_time = Instant::now();
Ok(())
}
/// Solve the problem.
pub fn solve(&mut self) -> Result<()> {
try!(self.init());
for _ in 0..100000 {
let mut term = try!(self.step());
let changed = try!(self.update_problem(term));
// do not stop if the problem has been changed
if changed && term == Step::Term {
term = Step::Null
}
self.show_info(term);
if term == Step::Term {
break;
}
}
Ok(())
}
/// Solve the problem but stop after `niter` iterations.
///
/// The function returns `Ok(true)` if the termination criterion
/// has been satisfied. Otherwise it returns `Ok(false)` or an
/// error code.
|
<
|
<
<
<
<
<
|
|
<
|
|
>
<
|
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
|
self.start_time = Instant::now();
Ok(())
}
/// Solve the problem.
pub fn solve(&mut self) -> Result<()> {
const LIMIT: usize = 10000;
if self.solve_iter(LIMIT)? {
Ok(())
} else {
Err(Error::IterationLimit(LIMIT))
}
}
/// Solve the problem but stop after `niter` iterations.
///
/// The function returns `Ok(true)` if the termination criterion
/// has been satisfied. Otherwise it returns `Ok(false)` or an
/// error code.
|