RsBundle  Diff

Differences From Artifact [ba9aceeb6f]:

  • File src/solver.rs — part of check-in [c73935e202] at 2019-07-19 14:05:34 on branch async — Basic implementation of parallel solver (user: fifr size: 36771)

To Artifact [afb993eaa5]:

  • File src/solver.rs — part of check-in [6253cbde2b] at 2019-07-19 14:14:41 on branch async — Implement `Default` for `StandardTerminator` (user: fifr size: 36889)

187
188
189
190
191
192
193








194
195
196
197
198
199
200
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208







+
+
+
+
+
+
+
+







impl Terminator for StandardTerminator {
    #[allow(unused_variables)]
    fn terminate(&mut self, state: &BundleState, params: &SolverParams) -> bool {
        assert!(self.termination_precision >= 0.0);
        state.expected_progress <= self.termination_precision * (state.cur_val.abs() + 1.0)
    }
}

impl Default for StandardTerminator {
    fn default() -> StandardTerminator {
        StandardTerminator {
            termination_precision: 1e-3,
        }
    }
}

/**
 * Bundle weight controller.
 *
 * Given the current state of the bundle method, this function determines the
 * weight factor of the quadratic term for the next iteration.
 */
496
497
498
499
500
501
502
503

504
505
506
507
508
509
510
511
512
504
505
506
507
508
509
510

511


512
513
514
515
516
517
518







-
+
-
-







     * the solver. However, it is possible to get a reference to the
     * internally stored problem using `Solver::problem()`.
     */
    pub fn new_params(problem: P, params: SolverParams) -> Result<Solver<P, M>, SolverError<P::Err, M::Err>> {
        Ok(Solver {
            problem,
            params,
            terminator: Box::new(StandardTerminator {
            terminator: Box::new(StandardTerminator::default()),
                termination_precision: 1e-3,
            }),
            weighter: Box::new(HKWeighter::new()),
            bounds: vec![],
            cur_y: dvec![],
            cur_val: 0.0,
            cur_mod: 0.0,
            cur_vals: dvec![],
            cur_mods: dvec![],