pub struct DualDecomposition {
pub step_size: f64,
pub max_iter: usize,
pub tol: f64,
}Expand description
Lagrangian relaxation with subgradient updates for dual decomposition.
Minimises f(x) + g(z) subject to Ax + Bz = c by relaxing the
coupling constraint. The dual variables y are updated using the
subgradient of the dual function.
Fields§
§step_size: f64Step size for dual variable updates.
max_iter: usizeMaximum number of dual iterations.
tol: f64Convergence tolerance on the primal feasibility gap ‖Ax + Bz − c‖.
Implementations§
Source§impl DualDecomposition
impl DualDecomposition
Sourcepub fn new(step_size: f64, max_iter: usize, tol: f64) -> Self
pub fn new(step_size: f64, max_iter: usize, tol: f64) -> Self
Create a new DualDecomposition solver.
Sourcepub fn solve(
&self,
x_init: Vec<f64>,
z_init: Vec<f64>,
y_init: Vec<f64>,
x_solve: &dyn Fn(&[f64], &[f64]) -> Vec<f64>,
z_solve: &dyn Fn(&[f64], &[f64]) -> Vec<f64>,
mat_a: &[Vec<f64>],
mat_b: &[Vec<f64>],
c: &[f64],
) -> (Vec<f64>, Vec<f64>, Vec<f64>, usize)
pub fn solve( &self, x_init: Vec<f64>, z_init: Vec<f64>, y_init: Vec<f64>, x_solve: &dyn Fn(&[f64], &[f64]) -> Vec<f64>, z_solve: &dyn Fn(&[f64], &[f64]) -> Vec<f64>, mat_a: &[Vec<f64>], mat_b: &[Vec<f64>], c: &[f64], ) -> (Vec<f64>, Vec<f64>, Vec<f64>, usize)
Run dual decomposition.
x_solve: minimiser of the Lagrangian w.r.t.xgiven dualyandz.z_solve: minimiser of the Lagrangian w.r.t.zgiven dualyandx.mat_a,mat_b,c: constraintAx + Bz = c.
Returns (x_best, z_best, y_final, iterations).
Auto Trait Implementations§
impl Freeze for DualDecomposition
impl RefUnwindSafe for DualDecomposition
impl Send for DualDecomposition
impl Sync for DualDecomposition
impl Unpin for DualDecomposition
impl UnsafeUnpin for DualDecomposition
impl UnwindSafe for DualDecomposition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.