pub struct LinearProgrammingLayer {
pub n_vars: usize,
pub n_constraints: usize,
}Expand description
Linear programming layer: min c^T x s.t. Ax = b, x ≥ 0
Fields§
§n_vars: usize§n_constraints: usizeImplementations§
Source§impl LinearProgrammingLayer
impl LinearProgrammingLayer
pub fn new(n_vars: usize, n_constraints: usize) -> Self
pub fn solve_simplex( &self, c: &Tensor, A: &Tensor, b: &Tensor, config: &OptimizationConfig, ) -> Result<OptimizationSolution>
Trait Implementations§
Source§impl DifferentiableOptimization for LinearProgrammingLayer
impl DifferentiableOptimization for LinearProgrammingLayer
Source§fn solve(
&self,
parameters: &[&Tensor],
config: &OptimizationConfig,
) -> Result<OptimizationSolution>
fn solve( &self, parameters: &[&Tensor], config: &OptimizationConfig, ) -> Result<OptimizationSolution>
Solve the optimization problem
Source§fn differentiate(
&self,
solution: &OptimizationSolution,
parameters: &[&Tensor],
downstream_grad: &Tensor,
_config: &OptimizationConfig,
) -> Result<Vec<Tensor>>
fn differentiate( &self, solution: &OptimizationSolution, parameters: &[&Tensor], downstream_grad: &Tensor, _config: &OptimizationConfig, ) -> Result<Vec<Tensor>>
Compute derivatives of the solution w.r.t. parameters
Source§fn problem_type(&self) -> OptimizationProblem
fn problem_type(&self) -> OptimizationProblem
Get the type of optimization problem
Auto Trait Implementations§
impl Freeze for LinearProgrammingLayer
impl RefUnwindSafe for LinearProgrammingLayer
impl Send for LinearProgrammingLayer
impl Sync for LinearProgrammingLayer
impl Unpin for LinearProgrammingLayer
impl UnsafeUnpin for LinearProgrammingLayer
impl UnwindSafe for LinearProgrammingLayer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more