DefaultSolver

Type Alias DefaultSolver 

Source
pub type DefaultSolver<T = f64> = Solver<T, DefaultProblemData<T>, DefaultVariables<T>, DefaultResiduals<T>, DefaultKKTSystem<T>, CompositeCone<T>, DefaultInfo<T>, DefaultSolution<T>, DefaultSettings<T>>;
Expand description

Solver for problems in standard conic program form

Aliased Type§

pub struct DefaultSolver<T = f64> {
    pub data: DefaultProblemData<T>,
    pub variables: DefaultVariables<T>,
    pub residuals: DefaultResiduals<T>,
    pub kktsystem: DefaultKKTSystem<T>,
    pub cones: CompositeCone<T>,
    pub step_lhs: DefaultVariables<T>,
    pub step_rhs: DefaultVariables<T>,
    pub prev_vars: DefaultVariables<T>,
    pub info: DefaultInfo<T>,
    pub solution: DefaultSolution<T>,
    pub timers: Option<Timers>,
    /* private fields */
}

Fields§

§data: DefaultProblemData<T>§variables: DefaultVariables<T>§residuals: DefaultResiduals<T>§kktsystem: DefaultKKTSystem<T>§cones: CompositeCone<T>§step_lhs: DefaultVariables<T>§step_rhs: DefaultVariables<T>§prev_vars: DefaultVariables<T>§info: DefaultInfo<T>§solution: DefaultSolution<T>§timers: Option<Timers>

Implementations§

Source§

impl<T> DefaultSolver<T>
where T: FloatT,

Source

pub fn update_data<DataP: MatrixProblemDataUpdate<T>, Dataq: VectorProblemDataUpdate<T>, DataA: MatrixProblemDataUpdate<T>, Datab: VectorProblemDataUpdate<T>>( &mut self, P: &DataP, q: &Dataq, A: &DataA, b: &Datab, ) -> Result<(), DataUpdateError>

Overwrites internal problem data structures in a solver object with new data, avoiding new memory allocations.
See update_P, update_q, update_A, update_b for allowable inputs.

data updating functions will return an error when either presolving or chordal decomposition have modfied the original problem structure. In order to guarantee that data updates will be accepted regardless of the original problem data, set presolve_enable = false, chordal_decomposition_enable = false and input_sparse_dropzeros = false in the solver settings. See also is_data_update_allowed().

Source

pub fn update_P<Data: MatrixProblemDataUpdate<T>>( &mut self, data: &Data, ) -> Result<(), DataUpdateError>

Overwrites the P matrix data in an existing solver object. The input P can be

  • a nonempty Vec, in which case the nonzero values of the original P are overwritten, preserving the sparsity pattern, or

  • a CscMatrix, in which case the input must match the sparsity pattern of the upper triangular part of the original P.

  • an iterator zip(&index,&values), specifying a selective update of values.

  • an empty vector, in which case no action is taken.

Source

pub fn update_A<Data: MatrixProblemDataUpdate<T>>( &mut self, data: &Data, ) -> Result<(), DataUpdateError>

Overwrites the A matrix data in an existing solver object. The input A can be

  • a nonempty Vec, in which case the nonzero values of the original A are overwritten, preserving the sparsity pattern, or

  • a CscMatrix, in which case the input must match the sparsity pattern of the original A.

  • an iterator zip(&index,&values), specifying a selective update of values.

  • an empty vector, in which case no action is taken.

Source

pub fn update_q<Data: VectorProblemDataUpdate<T>>( &mut self, data: &Data, ) -> Result<(), DataUpdateError>

Overwrites the q vector data in an existing solver object. No action is taken if the input is empty.

Source

pub fn update_b<Data: VectorProblemDataUpdate<T>>( &mut self, data: &Data, ) -> Result<(), DataUpdateError>

Overwrites the b vector data in an existing solver object. No action is taken if the input is empty.

Source

pub fn is_data_update_allowed(&self) -> bool

Returns true if problem structure has been modified by presolving, zero dropping or chordal decomposition

Source§

impl<T> DefaultSolver<T>
where T: FloatT,

Source

pub fn new( P: &CscMatrix<T>, q: &[T], A: &CscMatrix<T>, b: &[T], cones: &[SupportedConeT<T>], settings: DefaultSettings<T>, ) -> Result<Self, SolverError>

Trait Implementations§

Source§

impl<T> ConfigurablePrintTarget for DefaultSolver<T>
where T: FloatT,

Source§

fn print_to_stdout(&mut self)

redirect print output to stdout
Source§

fn print_to_file(&mut self, file: File)

redirect print output to a file
Source§

fn print_to_stream(&mut self, stream: Box<dyn Write + Send + Sync>)

redirect print output to a stream
Source§

fn print_to_sink(&mut self)

redirect print output to sink (no output)
Source§

fn print_to_buffer(&mut self)

redirect print output to an internal buffer
Source§

fn get_print_buffer(&mut self) -> Result<String>

get the contents of the internal print buffer
Source§

impl<T> SolverJSONReadWrite<T> for DefaultSolver<T>

Source§

fn save_to_file(&self, file: &mut File) -> Result<(), Error>

write internal problem data to a JSON file
Source§

fn load_from_file( file: &mut File, settings: Option<DefaultSettings<T>>, ) -> Result<Self, SolverError>

load problem data from a JSON file previously saved using save_to_file