ConicBundle
Classes | Public Member Functions | List of all members
ConicBundle::QPSolver Class Reference

QPSolver is the access point for ConicBundle to the internal constrained QP Solver, see Internal QP Solver for linearly constrained groundsets. More...

#include <QPSolver.hxx>

Inheritance diagram for ConicBundle::QPSolver:
ConicBundle::QPSolverBasicStructures ConicBundle::QPSolverBasicInterface ConicBundle::QPModelPointer ConicBundle::QPSolverObject ConicBundle::CBout ConicBundle::QPModelDataPointer ConicBundle::QPModelDataPointer ConicBundle::CBout ConicBundle::CBout

Classes

class  QPProblemData
 this class facilitates switching between original data and preprocessed data that removes fixed variables More...
 

Public Member Functions

void QPclear ()
 (re)initialize to empty
 
 QPSolver (CBout *cb=0, int cbinc=-1)
 default constructor
 
int QPset_parameters (QPSolverParametersObject *params)
 check whether the parameters are QPSolverParameters and set them if so
 
bool QPsupports_yfixing ()
 yfixing is currently not supported, this returns false.
 
virtual bool QPsupports_updates ()
 return true iff the code supports QPupdate(), i.e., it supports external updates of the groundset aggregate in order to model constraints not included explicitly in the QP's model
 
CH_Matrix_Classes::Real QPget_lower_bound ()
 returns the current lower bound on the optimal value (if feasibility is good enough)
 
int QPsolve (const CH_Matrix_Classes::Matrix &center_y, CH_Matrix_Classes::Real lower_bound, CH_Matrix_Classes::Real upper_bound, CH_Matrix_Classes::Real relprec, QPSolverProxObject *Hp, const MinorantPointer &gs_aggr, CH_Matrix_Classes::Indexmatrix *yfixed)
 solve the current bundle subproblem so that precision requirements are met (see Abstract interface for qp solvers)
 
int QPupdate (const CH_Matrix_Classes::Matrix &center_y, CH_Matrix_Classes::Real lower_bound, CH_Matrix_Classes::Real upper_bound, CH_Matrix_Classes::Real relprec, QPSolverProxObject *Hp, const MinorantPointer &gs_aggr, CH_Matrix_Classes::Indexmatrix *yfixed, const MinorantPointer &delta_gs_aggr, const CH_Matrix_Classes::Indexmatrix &delta_index)
 solve the bundle subproblem for updated box multipliers so that precision requirements are met (see Abstract interface for qp solvers). This routine is typically not called for this solver, because box constraints are included explicitly.
 
int QPresolve (CH_Matrix_Classes::Real lower_bound, CH_Matrix_Classes::Real upper_bound, CH_Matrix_Classes::Real relprec)
 resolve the bundle subproblem (usually because of modified penalty parameters) so that precision requirements are met (see Abstract interface for qp solvers)
 
int QPget_solution (CH_Matrix_Classes::Real &augval_lb, CH_Matrix_Classes::Real &augval_ub, CH_Matrix_Classes::Matrix &new_point, CH_Matrix_Classes::Real &gsaggr_offset, CH_Matrix_Classes::Matrix &gsaggr_gradient)
 retrieve the solution produced (see Abstract interface for qp solvers)
 
std::ostream & QPprint_statistics (std::ostream &out, int=0)
 currently it does nothing
 
GroundsetModificationQPstart_modification ()
 return a new modification object on the heap that is initialized for modification of *this
 
int QPapply_modification (const GroundsetModification &mdf)
 groundset changes are communicated to the solver here
 
bool QPis_feasible (const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real relprec=1e-10)
 check feasiblity of y for the current groundset constraints
 
int QPensure_feasibility (CH_Matrix_Classes::Matrix &y, bool &ychanged, QPSolverProxObject *inHp, CH_Matrix_Classes::Real relprec=1e-10)
 makes y feasible if not so, see Groundset::ensure_feasibility()
 
int solve (BundleProxObject *Hp, const CH_Matrix_Classes::Matrix &c, CH_Matrix_Classes::Real gamma, CH_Matrix_Classes::Real lowerbound, CH_Matrix_Classes::Real upperbound, CH_Matrix_Classes::Real relprec, CH_Matrix_Classes::Real skip_factor)
 solve the quadratic problem for the given cost function and precision (without cutting model, usually for finding feasible starting points)
 
bool QPprefer_UQPSolver (QPSolverProxObject *) const
 returns true if, for the current constraints and the requested ProxObject, it might be better to use the internal unconstrained QP solver (which can deal with box constraints by a work-around)
 
bool QPconstrained () const
 returns false if the feasible set is the entire space (unconstrained optimization), true otherwise.
 
CH_Matrix_Classes::Integer rowdim () const
 number of linear constraints
 
const CH_Matrix_Classes::Matrixget_lby () const
 returns the lower bounds on y
 
const CH_Matrix_Classes::Matrixget_uby () const
 returns the upper bounds on y
 
const CH_Matrix_Classes::Indexmatrixget_lbindex () const
 returns the indices of variable lower bounds > ConicBundle::CB_minus_infinity
 
const CH_Matrix_Classes::Indexmatrixget_ubindex () const
 returns the indices of variable lower bounds < ConicBundle::CB_plus_infinity
 
const CH_Matrix_Classes::Sparsematget_A () const
 returns the constraint matrix of the feasible set
 
const CH_Matrix_Classes::Matrixget_rhslb () const
 returns the constraint lower bounds
 
const CH_Matrix_Classes::Matrixget_rhsub () const
 returns the constraint upper bounds
 
const CH_Matrix_Classes::Indexmatrixget_rhslbind () const
 returns the indices with constraint lower bound slacks
 
const CH_Matrix_Classes::Indexmatrixget_rhsubind () const
 returns the indices with constraint upper bound slacks
 
bool QPboxconstrained (const CH_Matrix_Classes::Matrix *&lb, const CH_Matrix_Classes::Matrix *&ub, const CH_Matrix_Classes::Indexmatrix *&lbind, const CH_Matrix_Classes::Indexmatrix *&ubind) const
 return true if only box constraints are present and return the present box constraints More...
 
int mfile_data (std::ostream &out) const
 output the data describing the QP in m-file style
 
void set_cbout (const CBout *cb, int incr=-1)
 set output settings
 
- Public Member Functions inherited from ConicBundle::QPSolverBasicStructures
 QPSolverBasicStructures (QPSolverParameters *params=0, CBout *cb=0)
 default constructor
 
virtual ~QPSolverBasicStructures ()
 virtual destructor, deletes the parameters
 
virtual void QPIclear ()
 reset all values of the internal basic structures and variables
 
virtual int QPset_solver_parameters (QPSolverParameters *params)
 pass on new parameters, ownership is tranferred to this, will be deleted here
 
virtual int QPset_startx (const CH_Matrix_Classes::Matrix &startx)
 set a starting value for the quadratic variables
 
virtual int QPset_starts (const CH_Matrix_Classes::Matrix &starts)
 set a starting value for the slack variables of the constraints
 
virtual int QPset_starty (const CH_Matrix_Classes::Matrix &starty)
 set a starting value for the dual variables of the constraints
 
virtual int QPset_startzlb (const CH_Matrix_Classes::Matrix &startzlb)
 set a starting value for the dual variables of the lower bounds on the quadratic variables
 
virtual int QPset_startzub (const CH_Matrix_Classes::Matrix &startzub)
 set a starting value for the dual variables of the upper bounds on the quadratic variables
 
virtual int QPset_startmu (CH_Matrix_Classes::Real startmu)
 set a starting value for the barrier parameter mu
 
virtual int QPIsolve (bool reinitialize=true, CH_Matrix_Classes::Real skip_factor=-1.)
 solve the problem to the precision specified by the parameters; if the problem is resolved for slightly modified cost data (the feasible set should not change), setting reinitialize=false and a skip_factor for previous "central path" solutions might help to speed up the resolve
 
virtual CH_Matrix_Classes::Real QPget_primalval () const
 after QPIsolve, retrieve the primal objective value (of the quadratic variables)
 
virtual CH_Matrix_Classes::Real QPget_dualval () const
 after QPIsolve, retrieve the dual objective value (quadratic and dual variables)
 
virtual QPSolverParametersQPget_parameters () const
 return the current parameters for potential modification (do not delete!)
 
virtual const CH_Matrix_Classes::MatrixQPget_x () const
 return the current value of the quadratic variables (after a successful QPIsolve the optimal solution)
 
virtual int QPget_x (CH_Matrix_Classes::Matrix &xout, CH_Matrix_Classes::Indexmatrix &x_activity) const
 return the current value of the quadratic variables (after a successful QPIsolve the optimal solution) together with an activity estimate (1 ... active, 0 ... at bounds); in xout inactive components are set to the respective bound
 
virtual const CH_Matrix_Classes::MatrixQPget_y () const
 return the current value of the dual variables to the constraints (after a successful QPIsolve the optimal solution)
 
virtual const CH_Matrix_Classes::MatrixQPget_zlb () const
 return the current value of the dual variables to the lower bounds of the quadratic variables (after a successful QPIsolve the optimal solution)
 
virtual const CH_Matrix_Classes::MatrixQPget_zub () const
 return the current value of the dual variables to the upper bounds of the quadratic variables (after a successful QPIsolve the optimal solution)
 
virtual const CH_Matrix_Classes::MatrixQPget_s () const
 return the current value of the slack variables of the constraints (after a successful QPIsolve the optimal solution)
 
virtual int QPget_s (CH_Matrix_Classes::Matrix &sout, CH_Matrix_Classes::Indexmatrix &s_activity) const
 return the current value of the slack variables of the constraints (after a successful QPIsolve the optimal solution) together with an activity estimate (1 ... active, 0 ... at bounds); in sout inactive components are set to the respective bound
 
virtual const CH_Matrix_Classes::MatrixQPget_rhszlb () const
 return the current value of the dual variables to the lower bounds of the constraints (after a successful QPIsolve the optimal solution)
 
virtual const CH_Matrix_Classes::MatrixQPget_rhszub () const
 return the current value of the dual variables to the upper bounds of the constraints (after a successful QPIsolve the optimal solution)
 
virtual const SOCIPProxBlock & QPget_socqp () const
 return the second order cone data which models the quadratic part in case the paramaeters hold use_socqp==true
 
virtual SOCIPProxBlock & QPset_socqp ()
 give access to the second order cone data which models the quadratic part in case the paramaeters hold use_socqp==true
 
virtual CH_Matrix_Classes::Real QPget_mu () const
 return the current value of the barrier parameter mu
 
virtual CH_Matrix_Classes::Integer QPget_large_predictor_cnt () const
 return the number of iterations where predictor promises large progress but the barrier parameter is reduced only by a little
 
virtual CH_Matrix_Classes::Integer QPget_iter () const
 return the number of iterations until termination
 
- Public Member Functions inherited from ConicBundle::QPSolverBasicInterface
virtual ~QPSolverBasicInterface ()
 virtual destructor
 
- Public Member Functions inherited from ConicBundle::CBout
virtual void set_out (std::ostream *out=0, int print_level=1)
 Specifies the output level (out==NULL: no output at all, out!=NULL and level=0: errors and warnings, level>0 increasingly detailed information) More...
 
void clear_cbout ()
 reset to default settings (out=0,print_level=1)
 
 CBout (const CBout *cb=0, int incr=-1)
 calls set_cbout
 
 CBout (std::ostream *outp, int pl=1)
 initialize correspondingly
 
 CBout (const CBout &cb, int incr=0)
 copy constructor
 
virtual bool cb_out (int pl=-1) const
 Returns true if out!=0 and (pl<print_level), pl<0 should be used for WARNINGS and ERRORS only, pl==0 for usual output.
 
std::ostream & get_out () const
 If cb_out() returned true, this returns the output stream, but it will abort if called with out==0.
 
std::ostream * get_out_ptr () const
 returns the pointer to the output stream
 
int get_print_level () const
 returns the print_level
 
- Public Member Functions inherited from ConicBundle::QPModelPointer
 QPModelPointer (CBout *cb=0, int cbinc=-1)
 default constructor
 
virtual ~QPModelPointer ()
 virtual destructor
 
void clear_model_data_ptr ()
 set the pointer to NULL
 
int set_model_data (QPModelDataObject *inbp)
 store the pointer to the object if it matches the required type for the QP solver, otherwise return a nonzero value as error; this is used in the models to return the local qp model data
 
QPSumModelDataObjectgenerate_summodel_data (BundleModel *bmp=0)
 returns a new QPSumModelDataObject, that has to be deleted by the caller. The argument is optional and allows to potentially generate different blocks for different derived BundleModel objects; this is used in SumModel to collect the models of the various oracles that are summed over
 
QPConeModelDataObjectgenerate_conemodel_data (BundleModel *bmp=0)
 returns a new QPConeModelDataObject suitable for the default conic BundleModel implementations; it has to be deleted by the caller. The argument is optional and allows to potentially generate specialized objects for special BundleModel objects
 
QPModelDataObjectget_model_data_ptr () const
 returns the pointer value
 
- Public Member Functions inherited from ConicBundle::QPModelDataPointer
 QPModelDataPointer (CBout *cb=0, int cbinc=-1)
 default constructor
 
virtual ~QPModelDataPointer ()
 virtual destructor
 
- Public Member Functions inherited from ConicBundle::QPSolverObject
 QPSolverObject (CBout *cb=0, int cbinc=-1)
 default constructor
 
virtual ~QPSolverObject ()
 virtual destructor
 

Protected Member Functions

implementations of QPBasicInterface routines not needed externally
CH_Matrix_Classes::Integer QPget_xdim () const
 QP-solver-interface routine, returns primal dimension (length of y)
 
CH_Matrix_Classes::Integer QPget_ydim () const
 QP-solver-interface routine, returns primal dimension (length of y)
 
CH_Matrix_Classes::MatrixQPadd_Qx (const CH_Matrix_Classes::Matrix &xin, CH_Matrix_Classes::Matrix &outplusQx) const
 QP-solver-interface routine for adding quadratic matrix times vector.
 
const CH_Matrix_Classes::MatrixQPget_c () const
 QP-sover-interface routine for linear cost term.
 
CH_Matrix_Classes::Real QPget_gamma () const
 QP-sover-interface routine for constant cost term.
 
const CH_Matrix_Classes::MatrixQPget_rhslb () const
 QP-sover-interface routine for constraint lower bounds.
 
const CH_Matrix_Classes::MatrixQPget_rhsub () const
 QP-sover-interface routine for constraint upper bounds.
 
const CH_Matrix_Classes::IndexmatrixQPget_rhslbind () const
 QP-sover-interface routine for indices of constraint lower bound slacks.
 
const CH_Matrix_Classes::IndexmatrixQPget_rhsubind () const
 QP-sover-interface routine for indices of constraint upper bound slacks.
 
const CH_Matrix_Classes::MatrixQPget_lb () const
 QP-solver-interface routine for variable lower bounds.
 
const CH_Matrix_Classes::MatrixQPget_ub () const
 QP-solver-interface routine for variable upper bounds.
 
const CH_Matrix_Classes::IndexmatrixQPget_lbind () const
 QP-solver-interface routine for indices of variable lower bounds > ConicBundle::CB_minus_infinity.
 
const CH_Matrix_Classes::IndexmatrixQPget_ubind () const
 QP-solver-interface routine for indices of variable upper < ConicBundle::CB_plus_infinity.
 
CH_Matrix_Classes::MatrixQPadd_Ax (const CH_Matrix_Classes::Matrix &xin, CH_Matrix_Classes::Matrix &outplusAx) const
 QP-solver-interface routine for adding constraint matrix times vector.
 
CH_Matrix_Classes::MatrixQPadd_Aty (const CH_Matrix_Classes::Matrix &yin, CH_Matrix_Classes::Matrix &outplusAty) const
 QP-solver-interface routine for adding transposed constraint matrix times vector.
 

Private Member Functions

internal support routines
int determine_indices (QPProblemData &qpd)
 given lby,uby,rhslb,rhsub compute lbindex,ubindex,rhslbindex,rhsubindex
 
int preprocess_data (const CH_Matrix_Classes::Matrix &center_y, CH_Matrix_Classes::Indexmatrix *yfixed, bool &no_changes)
 initialize preproc_data for
 
int postprocess_data (bool round_to_active_bounds)
 

Private Attributes

data describing the ground set for the internal qp solver
QPProblemData original_data
 collects the original problem data and the data describing the quadratic costs
 
QPProblemData preproc_data
 collects the preprocessed problem data (some fixed variables may be eliminated) and the data describing the quadratic costs
 
CH_Matrix_Classes::Indexmatrix preproc_fixed
 1 if coordinate has fixed value, 0 otherwise; dimension is (0,0) if not initialized
 
CH_Matrix_Classes::Matrix preproc_fixedval
 if fixed it gives the value the coordinate is fixed to, otherwise the value is zero
 
CH_Matrix_Classes::Indexmatrix preproc_indices
 the sequence of original non fixed indices used in preproc_data; dimension is (0,0) if not initialized
 
AffineFunctionTransformation preproc_aft
 the transformation of the bundle
 
std::map< MinorantPointer, MinorantPointerpreproc_bundle_projection
 stores the transformed minorants of the bundle
 
QPProblemDataqp_data
 either points to original_data or to fixing_data
 
the solution data of the last solve in the original data space
CH_Matrix_Classes::Real sol_val_lb
 
CH_Matrix_Classes::Real sol_val_ub
 
CH_Matrix_Classes::Matrix sol_point
 
CH_Matrix_Classes::Real gs_aggr_offset
 
CH_Matrix_Classes::Matrix gs_aggr_gradient
 
termination parameters for the QP
CH_Matrix_Classes::Real primal_infeasibility_eps
 primal infeasibility termination parameter
 
CH_Matrix_Classes::Real dual_infeasibility_eps
 dual infeasibility termination parameter
 
CH_Matrix_Classes::Real lower_bound_gap_eps
 distance to lower bound termination parameter
 
CH_Matrix_Classes::Real upper_bound_gap_eps
 distance to upper bound termination parameter
 
CH_Matrix_Classes::Real objective_gap_eps
 relative precision for QP objective termination
 

Additional Inherited Members

- Protected Attributes inherited from ConicBundle::QPSolverBasicStructures
CH_Tools::Clock clock
 for timing purposes
 
CH_Tools::Microseconds QPcoeff_time
 time spent in computing the QP coefficients
 
CH_Tools::Microseconds QPsolve_time
 time spent in solving the QP
 
CH_Tools::Microseconds QPinitKKT_time
 time spent initializing the KKT system
 
CH_Tools::Microseconds QPpredictor_time
 time spent in computing predictor
 
CH_Tools::Microseconds QPcorrector_time
 time spent in computing predictor
 
CH_Tools::Microseconds QPlinesearch_time
 time spent in the line searches
 
CH_Tools::Microseconds QPcurrentprecprep_time
 time spent in preparing the preconditioner
 
CH_Tools::Microseconds QPprecprep_time
 time spent in preparing the preconditioner
 
CH_Tools::Microseconds QPprecprepmodel_time
 time spent in preparing the preconditioner
 
CH_Tools::Microseconds QPprecsolve_time
 time spent in preconditioning solves
 
CH_Tools::Microseconds QPmatmult_time
 time spent in matrix vector multiplications
 
CH_Tools::Microseconds QP_time
 time spent in preparing the preconditioner
 
- Protected Attributes inherited from ConicBundle::QPModelPointer
QPModelBlockmodel_block
 stores a pointer to the current starting block giving access to the cutting model(s) [it does not own or delete this object]
 

Detailed Description

QPSolver is the access point for ConicBundle to the internal constrained QP Solver, see Internal QP Solver for linearly constrained groundsets.

Member Function Documentation

◆ QPboxconstrained()

bool ConicBundle::QPSolver::QPboxconstrained ( const CH_Matrix_Classes::Matrix *&  lb,
const CH_Matrix_Classes::Matrix *&  ub,
const CH_Matrix_Classes::Indexmatrix *&  lbind,
const CH_Matrix_Classes::Indexmatrix *&  ubind 
) const
inlinevirtual

return true if only box constraints are present and return the present box constraints

Parameters
lblower bounds
ubupper bounds
lbindindices with "finite lower bounds"
ubindindices with "finite upper bounds"

Implements ConicBundle::QPSolverObject.

References ConicBundle::QPSolver::QPProblemData::A, get_lbindex(), get_lby(), get_ubindex(), get_uby(), mfile_data(), ConicBundle::CBout::out, QPconstrained(), and CH_Matrix_Classes::Sparsemat::rowdim().


The documentation for this class was generated from the following file: