RsBundle  Check-in [07f16d6a13]

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

Overview
Comment:Document some modules
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 07f16d6a13826bad8daba8fbbfaecb5dfd895a11
User & Date: fifr 2016-09-28 08:42:58.615
Context
2016-09-28
08:43
firstorderproblem: Fix doc check-in: f9a0d0b9b2 user: fifr tags: trunk
08:42
Document some modules check-in: 07f16d6a13 user: fifr tags: trunk
08:42
Improve `cpx!` to `trycpx!` check-in: 5f0f9fa968 user: fifr tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/cplex.rs.
11
12
13
14
15
16
17
18
19
20





















21
22
23
24
25
26
27
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

/**!
 * Low-level CPLEX interface.
 */






















use libc::{c_int, c_double, c_char};
use std::ptr;
use std::fmt;
use std::error;

pub use std::result::Result as cplex_std_Result;







<
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */


//! Low-level CPLEX interface.
//!
//! This module contains plain, unsafe functions to the CPLEX
//! C-interface.
//!
//! Most CPLEX functions require an environment pointer as first
//! argument. This environment corresponds to available licenses, so
//! you must be careful to not exhaust them by opening too many
//! environment. The helper function `cplex::env` can be used to
//! return a single global environment to be reused for different
//! models.
//!
//! CPLEX error handling depends on returned status codes. The helper
//! macro `trycpx!` wraps the call to a low-level CPLEX function with
//! status return code by additional error checking code. This
//! error-checking code returns either `Ok(())` or a
//! `Err(CplexError(...))`.
//!
//! ```
//! fn myfunc(net : *mut CPXnet) -> Result<()> {
//!   cpx!(CPXNetchgobj(cplex::env(), net, CPX_MAX))
//! }
//! ```

use libc::{c_int, c_double, c_char};
use std::ptr;
use std::fmt;
use std::error;

pub use std::result::Result as cplex_std_Result;
Changes to src/firstorderproblem.rs.
10
11
12
13
14
15
16


17
18
19
20
21
22
23
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */



use {Real, Vector, DVector, Minorant};

use std::error;
use std::vec::IntoIter;

/**







>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

//! Problem description of a first-order convex optimisation problem.

use {Real, Vector, DVector, Minorant};

use std::error;
use std::vec::IntoIter;

/**
Changes to src/hkweighter.rs.
11
12
13
14
15
16
17









18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */










use Real;
use {Weighter, BundleState, SolverParams, Step};

use std::f64::NEG_INFINITY;
use std::cmp::{min, max};

const FACTOR : Real = 2.0;

/**
 * Weight updating rule according to Helmberg and Kiwiel.
 *
 * The procedure is described in
 *
 *    Helmberg, C. and Kiwiel, K.C. (2002): A spectral bundle method
 *    with bounds, Math. Programming A 93, 173--194
 */
pub struct HKWeighter {
    eps_weight : Real,
    m_r : Real,
    iter : isize,
    model_max : Real,
}







>
>
>
>
>
>
>
>
>













|
|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */


//! Weight updating rule according to Helmberg and Kiwiel.
//!
//! The procedure is described in
//!
//!     Helmberg, C. and Kiwiel, K.C. (2002): A spectral bundle method
//!     with bounds, Math. Programming A 93, 173--194
//!

use Real;
use {Weighter, BundleState, SolverParams, Step};

use std::f64::NEG_INFINITY;
use std::cmp::{min, max};

const FACTOR : Real = 2.0;

/**
 * Weight updating rule according to Helmberg and Kiwiel.
 *
 * The procedure is described in
 *
 *     Helmberg, C. and Kiwiel, K.C. (2002): A spectral bundle method
 *     with bounds, Math. Programming A 93, 173--194
 */
pub struct HKWeighter {
    eps_weight : Real,
    m_r : Real,
    iter : isize,
    model_max : Real,
}
Changes to src/lib.rs.
10
11
12
13
14
15
16


17
18
19
20
21
22
23
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */



#[macro_use]
extern crate quick_error;
extern crate libc;

#[macro_use]
extern crate log;







>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

//! Proximal bundle method implementation.

#[macro_use]
extern crate quick_error;
extern crate libc;

#[macro_use]
extern crate log;
Changes to src/master/mod.rs.
11
12
13
14
15
16
17






















18
19
20
21
22
23
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */























mod master;
pub use self::master::{MasterProblem, Error, Result};

mod boxed;
pub use self::boxed::BoxedMasterProblem;

mod unconstrained;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

//! Bundle master problem solver.
//!
//! This module contains solvers for the bundle master problem, i.e.
//! for solving convex optimization problems of the form
//!
//! \\[ \min \left\\{ \hat{f}(d) + \frac{w}{2} \\|d\\|\^2 \colon d \in [l,u] \right\\}, \\]
//!
//! with $u > 0$ and $l,u \in (\mathbb{R} \cup \\{ -\infty, \infty
//! \\})\^n$. The function $\hat{f}$ is a piecewise linear, convex
//! function
//!
//! \\[ \hat{f}(d) := \max \left\\{ \ell_i(d) = c_i + \langle g_i, d \rangle \colon i=1, \dotsc, k \right\\}. \\]
//!
//! A master problem solver must provide several operations:
//!
//! * solving the problem,
//! * changing the weight parameter $w$,
//! * modifying $\hat{f}$ by adding or removing linear functions $\ell_i$,
//! * moving the center of the linear functions $\ell_i$ (and the
//!   bounds), i.e. replacing $\hat{f}$ by $d \mapsto \hat{f}(d -
//!   \hat{d})$ for some given $\hat{d} \in \mathbb{R}\^n$.

mod master;
pub use self::master::{MasterProblem, Error, Result};

mod boxed;
pub use self::boxed::BoxedMasterProblem;

mod unconstrained;
Changes to src/mcf/mod.rs.
10
11
12
13
14
15
16


17
18
19
20
21
22
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */



mod solver;
pub use mcf::solver::Solver;

mod problem;
pub use mcf::problem::MMCFProblem;







>
>






10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

//! Multi-commodity min-cost-flow subproblems.

mod solver;
pub use mcf::solver::Solver;

mod problem;
pub use mcf::problem::MMCFProblem;
Changes to src/minorant.rs.
10
11
12
13
14
15
16


17
18
19
20
21
22
23
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */



use {Real, DVector};

use std::fmt;

/**
 * A linear minorant of a convex function.







>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

//! A linear minorant.

use {Real, DVector};

use std::fmt;

/**
 * A linear minorant of a convex function.
Changes to src/solver.rs.
10
11
12
13
14
15
16


17
18
19
20
21
22
23
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */



use {Real, DVector};
use {FirstOrderProblem, Evaluation, HKWeighter};

use master::{self, MasterProblem, BoxedMasterProblem, MinimalMaster};

use std::result;







>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

//! The main bundle method solver.

use {Real, DVector};
use {FirstOrderProblem, Evaluation, HKWeighter};

use master::{self, MasterProblem, BoxedMasterProblem, MinimalMaster};

use std::result;
Changes to src/vector.rs.
10
11
12
13
14
15
16


17
18
19
20
21
22
23
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */



use Real;
use std::fmt;
use std::ops::{Deref, DerefMut};
use std::cmp::min;

/// Type of dense vectors.







>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

//! Finite-dimensional sparse and dense vectors.

use Real;
use std::fmt;
use std::ops::{Deref, DerefMut};
use std::cmp::min;

/// Type of dense vectors.