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::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};
|
|
|
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, 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
|
/// 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>;
/// 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>
where
P: FirstOrderProblem,
M: master::Builder,
{
/// The first order problem description.
problem: P,
|
|
<
<
<
<
<
<
<
<
<
|
|
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 = master::boxed::Builder<master::cpx::Builder>;
/**
* Implementation of a bundle method.
*/
pub struct Solver<P, T = StandardTerminator, W = HKWeighter, M = FullMasterBuilder>
where
P: FirstOrderProblem,
M: master::Builder,
{
/// The first order problem description.
problem: P,
|