RsBundle  Check-in [6253cbde2b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Implement `Default` for `StandardTerminator`
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | async
Files: files | file ages | folders
SHA1: 6253cbde2b085ab02ee77bdfee531bd727617cf2
User & Date: fifr 2019-07-19 14:14:41.598
Context
2019-07-19
14:15
parallel: specify terminator and weighter as type parameter check-in: bb5abc7e28 user: fifr tags: async
14:14
Implement `Default` for `StandardTerminator` check-in: 6253cbde2b user: fifr tags: async
14:05
Basic implementation of parallel solver check-in: c73935e202 user: fifr tags: async
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/solver.rs.
187
188
189
190
191
192
193








194
195
196
197
198
199
200
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)
    }
}









/**
 * 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.
 */







>
>
>
>
>
>
>
>







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
     * 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 {
                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![],







|
<
<







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::default()),


            weighter: Box::new(HKWeighter::new()),
            bounds: vec![],
            cur_y: dvec![],
            cur_val: 0.0,
            cur_mod: 0.0,
            cur_vals: dvec![],
            cur_mods: dvec![],