Expand description
Mixed Integer Programming (MIP) — unified top-level interface.
This module exposes a clean, high-level API for Mixed-Integer Linear
Programming (MILP) problems. It re-exports the core solver types from
crate::integer and adds:
MilpProblem— unified problem description with a fluent builder.MilpSolverConfig— algorithm selection and tuning.MilpSolver— single entry-point that dispatches B&B or cutting planes.IntegerConstraint— per-variable integrality annotations.
§Problem form
minimise c^T x
subject to A x ≤ b (linear inequalities, optional)
Aeq x = beq (linear equalities, optional)
lb ≤ x ≤ ub (variable bounds)
x_i ∈ ℤ ∀ i ∈ I (integrality)
x_i ∈ {0,1} ∀ i ∈ B (binary subset)§Example
use scirs2_optimize::mip::{MilpProblem, MilpSolverConfig, MilpSolver, IntegerConstraint};
use scirs2_core::ndarray::{array, Array2};
// Simple knapsack: max 4x₀ + 5x₁ + 3x₂ s.t. 2x₀+3x₁+x₂ ≤ 5, x ∈ {0,1}
let c = array![-4.0, -5.0, -3.0]; // negate for min
let a = Array2::from_shape_vec((1, 3), vec![2.0, 3.0, 1.0]).expect("valid input");
let b = array![5.0];
let prob = MilpProblem::builder(c)
.inequalities(a, b)
.bounds(array![0.0, 0.0, 0.0], array![1.0, 1.0, 1.0])
.all_binary()
.build()
.expect("valid input");
let result = MilpSolver::default().solve(&prob).expect("valid input");
assert!(result.success);
assert!(result.objective <= -7.0 + 1e-4);Re-exports§
pub use crate::integer::milp_branch_and_bound::branch_and_bound;pub use crate::integer::milp_branch_and_bound::BnbConfig;pub use crate::integer::milp_branch_and_bound::BranchingStrategy;pub use crate::integer::milp_branch_and_bound::MilpProblem as MilpProblemInner;pub use crate::integer::milp_branch_and_bound::MilpResult as MilpResultInner;pub use crate::integer::is_integer_valued;pub use crate::integer::BranchAndBoundOptions;pub use crate::integer::BranchAndBoundSolver;pub use crate::integer::CuttingPlaneOptions;pub use crate::integer::CuttingPlaneSolver;pub use crate::integer::IntegerKind;pub use crate::integer::IntegerVariableSet;pub use crate::integer::LinearProgram;pub use crate::integer::MipResult;
Structs§
- Milp
Problem - A Mixed-Integer Linear Program.
- Milp
Problem Builder - Fluent builder for
MilpProblem. - Milp
Solve Result - Result of solving a MILP.
- Milp
Solver - Unified MILP solver.
- Milp
Solver Config - Configuration for
MilpSolver.
Enums§
- Integer
Constraint - Per-variable integrality specification.
- Milp
Algorithm - Algorithm selection for
MilpSolver.
Functions§
- solve_
milp - Solve a
MilpProblemwith default solver settings.