Struct relp::data::linear_program::general_form::GeneralForm [−][src]
pub struct GeneralForm<F> { /* fields omitted */ }
Expand description
A linear program in general form.
This structure is used as a first storage independent representation format for different parse results to be transformed to.
Can be checked for consistency by the is_consistent
method in this module. That method can be
viewed as documentation for the requirements on the variables in this data structure.
Implementations
impl<F: LinearAlgebraElement<F> + SparseComparator> GeneralForm<F>
[src]
impl<F: LinearAlgebraElement<F> + SparseComparator> GeneralForm<F>
[src]pub fn new(
objective: Objective,
constraints: Sparse<F, F, ColumnMajor>,
constraint_types: Vec<RangedConstraintRelation<F>>,
b: DenseVector<F>,
variables: Vec<Variable<F>>,
variable_names: Vec<String>,
fixed_cost: F
) -> Self
[src]
pub fn new(
objective: Objective,
constraints: Sparse<F, F, ColumnMajor>,
constraint_types: Vec<RangedConstraintRelation<F>>,
b: DenseVector<F>,
variables: Vec<Variable<F>>,
variable_names: Vec<String>,
fixed_cost: F
) -> Self
[src]Create a new linear program in general form.
Simple constructor except for two indices that get created.
impl<OF: 'static> GeneralForm<OF> where
OF: OrderedField + LinearAlgebraElement<OF>,
&'r OF: OrderedFieldRef<OF>,
[src]
impl<OF: 'static> GeneralForm<OF> where
OF: OrderedField + LinearAlgebraElement<OF>,
&'r OF: OrderedFieldRef<OF>,
[src]pub fn derive_matrix_data(
&mut self
) -> Result<MatrixData<'_, OF>, LinearProgramType<OF>>
[src]
pub fn derive_matrix_data(
&mut self
) -> Result<MatrixData<'_, OF>, LinearProgramType<OF>>
[src]Modify this linear problem such that it is representable by a MatrixData
structure.
The problem gets transformed into standard form, which also includes a presolve operation. Note that this call might be expensive.
TODO(ENHANCEMENT): Make sure that presolving can be skipped.
See also the documentation of the GeneralForm::standardize
method.
Return value
A Result
containing either the MatrixData
form of the presolved and standardized
problem.
Errors
In case the linear program gets solved during this presolve operation, a solution.
pub fn standardize(&mut self) -> Result<(), LinearProgramType<OF>>
[src]
pub fn standardize(&mut self) -> Result<(), LinearProgramType<OF>>
[src]Convert this GeneralForm
problem to a form closer to the standard form representation.
This involves:
- Determining which rows and columns can be removed or differently represented to reduce the
problem size and increase the reading speed from a
MatrixData
structure. - Determining which variables are implicitly fixed, such that their only feasible value can be substituted into the problem and the column eliminated.
- Modifying variables such that they are either free or bounded below by zero (with possibly an upper bound).
- Multiplying some rows such that the constraint value is non-negative.
To do the above, a column major representation of the constraint data is built. This requires copying all constraint data once.
TODO(ENHANCEMENT): Make sure that presolving can be skipped.
Errors
In case the linear program gets solved during this presolve operation, a solution.
pub fn get_solution(&self) -> Option<Solution<OF>>
[src]
pub fn get_solution(&self) -> Option<Solution<OF>>
[src]If this problem is fully solved (probably by presolving), get the solution.
All original variables need to have an explicit solution. Hint: Try calling
compute_solution_where_possible
.
Return value
If one of the variables is still undetermined, None
.
pub fn reshift_solution<G>(&self, reduced_solution: &mut SparseVector<G, G>) where
G: LinearAlgebraElement<G> + SparseComparator + PartialEq<OF> + AddAssign<OF> + From<OF>,
&'r OF: Neg<Output = OF>,
&'r G: Neg<Output = G>,
[src]
pub fn reshift_solution<G>(&self, reduced_solution: &mut SparseVector<G, G>) where
G: LinearAlgebraElement<G> + SparseComparator + PartialEq<OF> + AddAssign<OF> + From<OF>,
&'r OF: Neg<Output = OF>,
&'r G: Neg<Output = G>,
[src]Transform a solution back.
When converting the problem to standard form, and during presolving, transformations to variables are applied that need to be undone once a solution was computed.
Arguments
reduced_solution
: Solution values for all variables that are still marked asActive
in the “original variables” of this problem.
pub fn compute_full_solution_with_reduced_solution<G>(
self,
reduced_solution: SparseVector<G, G>
) -> Solution<G> where
G: Sum + Neg<Output = G> + AddAssign<OF> + PartialEq<OF> + LinearAlgebraElement<G> + From<OF> + Eq + Ord + Zero,
G: Add<&'r OF, Output = G>,
&'r G: Neg<Output = G> + Mul<&'r OF, Output = G> + Add<&'r OF, Output = G> + Sub<&'r G, Output = G>,
[src]
pub fn compute_full_solution_with_reduced_solution<G>(
self,
reduced_solution: SparseVector<G, G>
) -> Solution<G> where
G: Sum + Neg<Output = G> + AddAssign<OF> + PartialEq<OF> + LinearAlgebraElement<G> + From<OF> + Eq + Ord + Zero,
G: Add<&'r OF, Output = G>,
&'r G: Neg<Output = G> + Mul<&'r OF, Output = G> + Add<&'r OF, Output = G> + Sub<&'r G, Output = G>,
[src]Extend a reduced solution with already known values.
Presolving might have determined variables explicitly or as a function of others. This method augments the solution of the open part of the problem to a complete solution.
Arguments
reduced_solution
: A value for each of the variables in this general form that are still marked as unsolved (in theoriginal_variables
field).
Returns
A complete solution.
impl<OF> GeneralForm<OF> where
OF: LinearAlgebraElement<OF> + SparseComparator,
[src]
impl<OF> GeneralForm<OF> where
OF: LinearAlgebraElement<OF> + SparseComparator,
[src]pub fn nr_constraints(&self) -> usize
[src]
pub fn nr_constraints(&self) -> usize
[src]The number of constraints in this linear program.
Return value
The number of constraints, which excludes any variable bounds.
pub fn nr_variables(&self) -> usize
[src]
pub fn nr_variables(&self) -> usize
[src]The number of variables in this linear program.
Return value
The number of columns / variables, which includes the slack columns / variables.
Trait Implementations
impl<F: Debug> Debug for GeneralForm<F>
[src]
impl<F: Debug> Debug for GeneralForm<F>
[src]impl<F: PartialEq> PartialEq<GeneralForm<F>> for GeneralForm<F>
[src]
impl<F: PartialEq> PartialEq<GeneralForm<F>> for GeneralForm<F>
[src]fn eq(&self, other: &GeneralForm<F>) -> bool
[src]
fn eq(&self, other: &GeneralForm<F>) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &GeneralForm<F>) -> bool
[src]
fn ne(&self, other: &GeneralForm<F>) -> bool
[src]This method tests for !=
.
impl<FI, FO: From<FI>> TryInto<GeneralForm<FO>> for MPS<FI> where
FI: Sub<Output = FI> + Abs + Ord + Zero + Display + Clone,
FO: NotZero + Zero + One + Neg<Output = FO> + Ord + Element,
FO: Add<&'r FO, Output = FO>,
&'r FO: Neg<Output = FO>,
[src]
impl<FI, FO: From<FI>> TryInto<GeneralForm<FO>> for MPS<FI> where
FI: Sub<Output = FI> + Abs + Ord + Zero + Display + Clone,
FO: NotZero + Zero + One + Neg<Output = FO> + Ord + Element,
FO: Add<&'r FO, Output = FO>,
&'r FO: Neg<Output = FO>,
[src]fn try_into(self) -> Result<GeneralForm<FO>, Self::Error>
[src]
fn try_into(self) -> Result<GeneralForm<FO>, Self::Error>
[src]Convert an MPS
into a GeneralForm
linear program.
Arguments
self
:MPS
instance.
Return value
A linear program in general form.
Errors
TODO(DOCUMENTATION): When can errors occur?
type Error = Inconsistency
type Error = Inconsistency
The type returned in the event of a conversion error.
impl<F: Eq> Eq for GeneralForm<F>
[src]
impl<F> StructuralEq for GeneralForm<F>
[src]
impl<F> StructuralPartialEq for GeneralForm<F>
[src]
Auto Trait Implementations
impl<F> RefUnwindSafe for GeneralForm<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> Send for GeneralForm<F> where
F: Send,
F: Send,
impl<F> Sync for GeneralForm<F> where
F: Sync,
F: Sync,
impl<F> Unpin for GeneralForm<F> where
F: Unpin,
F: Unpin,
impl<F> UnwindSafe for GeneralForm<F> where
F: UnwindSafe,
F: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.