RsBundle  Diff

Differences From Artifact [327a9fd3a1]:

  • File src/solver.rs — part of check-in [5ee9fe59e5] at 2019-07-22 08:52:58 on branch master-builder — Introduce master problem builder (user: fifr size: 35668)

To Artifact [9d49695f1b]:

  • File src/solver.rs — part of check-in [adb6de0ae8] at 2019-07-22 09:05:02 on branch master-builder — Move convenience typs to crate level (user: fifr size: 35297) [more...]

15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29







-
+







//

//! The main bundle method solver.

use crate::{Aggregatable, DVector, Real};
use crate::{Evaluation, FirstOrderProblem, Update};

use crate::master::{self, boxed, cpx, minimal, MasterProblem};
use crate::master::{self, MasterProblem};
use crate::terminator::{StandardTerminatable, StandardTerminator, Terminator};
use crate::weighter::{HKWeightable, HKWeighter, Weighter};

use log::{debug, info, warn};

use std::error::Error;
use std::f64::{INFINITY, NEG_INFINITY};
346
347
348
349
350
351
352
353

354
355
356
357
358
359
360
361
362
363
364
365
366
367

368
369
370
371
372
373
374
346
347
348
349
350
351
352

353









354
355
356
357

358
359
360
361
362
363
364
365







-
+
-
-
-
-
-
-
-
-
-




-
+







    /// This is the last primal generated by the oracle.
    pub fn last_primal(&self, fidx: usize) -> Option<&Pr> {
        self.minorants[fidx].last().and_then(|m| m.primal.as_ref())
    }
}

/// The default builder.
pub type FullMasterBuilder = boxed::Builder<cpx::Builder>;
pub type FullMasterBuilder = master::boxed::Builder<master::cpx::Builder>;

/// The minimal bundle builder.
pub type MinimalMasterBuilder = boxed::Builder<minimal::Builder>;

/// The default bundle solver with general master problem.
pub type DefaultSolver<P> = Solver<P, StandardTerminator, HKWeighter, FullMasterBuilder>;

/// A bundle solver with a minimal cutting plane model.
pub type NoBundleSolver<P> = Solver<P, StandardTerminator, HKWeighter, MinimalMasterBuilder>;

/**
 * Implementation of a bundle method.
 */
pub struct Solver<P, T, W, M = FullMasterBuilder>
pub struct Solver<P, T = StandardTerminator, W = HKWeighter, M = FullMasterBuilder>
where
    P: FirstOrderProblem,
    M: master::Builder,
{
    /// The first order problem description.
    problem: P,