Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | BoxedMasterProblem is now constructed with wrapped unconstrainted master. It is more idiomatic to pass the wrapped UnconstrainedMasterProblem to the constructor instead of constructing the wrapped master in the constructor. An advantage is that errors raised by the construction of the unconstrainted master can be handled more directly. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
7293704f87249a0305f3a2b2e0c746f5 |
| User & Date: | fifr 2017-11-20 09:24:12.299 |
Context
|
2017-11-20
| ||
| 09:39 | boxed: refactor `update_box_multipliers` check-in: 9104ca9fdf user: fifr tags: trunk | |
| 09:24 | BoxedMasterProblem is now constructed with wrapped unconstrainted master. check-in: 7293704f87 user: fifr tags: trunk | |
| 09:15 | Improve dimension check in master initialization. check-in: 443fb2dfa5 user: fifr tags: trunk | |
Changes
Changes to src/master/boxed.rs.
| ︙ | ︙ | |||
56 57 58 59 60 61 62 |
/// The unconstrained master problem solver.
master: M,
}
impl<M: UnconstrainedMasterProblem> BoxedMasterProblem<M> {
| | | | < > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
/// The unconstrained master problem solver.
master: M,
}
impl<M: UnconstrainedMasterProblem> BoxedMasterProblem<M> {
pub fn new(master: M) -> BoxedMasterProblem<M> {
BoxedMasterProblem {
lb: dvec![],
ub: dvec![],
eta: dvec![],
primopt: dvec![],
primoptval: 0.0,
dualoptnorm2: 0.0,
model_eps: 0.6,
max_updates: 100,
cnt_updates: 0,
need_new_candidate: true,
master: master,
}
}
pub fn set_max_updates(&mut self, max_updates: usize) -> Result<(), Error> {
assert!(max_updates > 0);
self.max_updates = max_updates;
Ok(())
}
|
| ︙ | ︙ |
Changes to src/solver.rs.
| ︙ | ︙ | |||
15 16 17 18 19 20 21 |
//
//! The main bundle method solver.
use {Real, DVector};
use {FirstOrderProblem, Update, Evaluation, HKWeighter};
| > | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
//
//! The main bundle method solver.
use {Real, DVector};
use {FirstOrderProblem, Update, Evaluation, HKWeighter};
use master::{MasterProblem, UnconstrainedMasterProblem, BoxedMasterProblem};
use master::{MinimalMaster, CplexMaster};
use std::mem::swap;
use std::f64::{INFINITY, NEG_INFINITY};
use std::time::Instant;
use std::result::Result;
use failure::Error;
|
| ︙ | ︙ | |||
450 451 452 453 454 455 456 |
nxt_mods: dvec![],
new_cutval: 0.0,
sgnorm: 0.0,
expected_progress: 0.0,
cnt_descent: 0,
cnt_null: 0,
start_time: Instant::now(),
| | | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
nxt_mods: dvec![],
new_cutval: 0.0,
sgnorm: 0.0,
expected_progress: 0.0,
cnt_descent: 0,
cnt_null: 0,
start_time: Instant::now(),
master: Box::new(BoxedMasterProblem::new(MinimalMaster::new().map_err(SolverError::Master)?)),
minorants: vec![],
iterinfos: vec![],
})
}
/// A new solver with default parameter.
pub fn new(problem: P) -> Result<Solver<P, Pr, E>, SolverError> {
|
| ︙ | ︙ | |||
710 711 712 713 714 715 716 |
* information.
*/
fn init_master(&mut self) -> Result<(), SolverError> {
let m = self.problem.num_subproblems();
self.master = if m == 1 && self.params.max_bundle_size == 2 {
debug!("Use minimal master problem");
| | | | 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 |
* information.
*/
fn init_master(&mut self) -> Result<(), SolverError> {
let m = self.problem.num_subproblems();
self.master = if m == 1 && self.params.max_bundle_size == 2 {
debug!("Use minimal master problem");
Box::new(BoxedMasterProblem::new(MinimalMaster::new().map_err(SolverError::Master)?))
} else {
debug!("Use CPLEX master problem");
Box::new(BoxedMasterProblem::new(CplexMaster::new().map_err(SolverError::Master)?))
};
let lb = self.problem.lower_bounds().map(DVector);
let ub = self.problem.upper_bounds().map(DVector);
if lb.as_ref().map(|lb| lb.len() != self.problem.num_variables()).unwrap_or(false) {
return Err(SolverError::Dimension);
|
| ︙ | ︙ |