ConicBundle
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ConicBundle::QPSolverBasicStructures Class Reference

provides the basic variables and implements basic routines for the primal dual interior point solver interface of QPSolverBasicInterface (see there for the problem description and the switched roles of x and y) except for setting up and solving the primal dual KKT system, which is left to a specialized QPKKTSolverObject provided in QPSolverParameters to allow the exploitation of structural properties in the data. The basic problem description must also still be provided in a derived class that implements the remaining abstract data retrieval functions. The bundle data is made available by deriving this class from QPModelPointer, see Interface for qp solver dependent model descriptions. More...

#include <QPSolverBasicStructures.hxx>

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

Public Member Functions

 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
 
virtual CH_Matrix_Classes::Integer QPget_xdim () const =0
 dimension of the quadratic variable x
 
virtual CH_Matrix_Classes::Integer QPget_ydim () const =0
 dimension of the dual variables to the linear constraints (number of rows of A)
 
virtual CH_Matrix_Classes::MatrixQPadd_Qx (const CH_Matrix_Classes::Matrix &vecin, CH_Matrix_Classes::Matrix &vecout) const =0
 vecout += quadratic term * vecin
 
virtual CH_Matrix_Classes::MatrixQPadd_Ax (const CH_Matrix_Classes::Matrix &xin, CH_Matrix_Classes::Matrix &outplusAx) const =0
 outplusAx += A * xin
 
virtual CH_Matrix_Classes::MatrixQPadd_Aty (const CH_Matrix_Classes::Matrix &yin, CH_Matrix_Classes::Matrix &outplusAty) const =0
 outplusAty += transpose(A) * yin
 
virtual const CH_Matrix_Classes::MatrixQPget_c () const =0
 returns the linear cost vector for the quadratic variable x
 
virtual CH_Matrix_Classes::Real QPget_gamma () const =0
 returns a potential constant offset of the cost function
 
virtual const CH_Matrix_Classes::MatrixQPget_rhslb () const =0
 returns rhslb of rhslb <= Ax
 
virtual const CH_Matrix_Classes::MatrixQPget_rhsub () const =0
 returns rhsub of Ax <= rhsub
 
virtual const CH_Matrix_Classes::IndexmatrixQPget_rhslbind () const =0
 returns the indices where rhslb is not minus infinity (sorted increasingly)
 
virtual const CH_Matrix_Classes::IndexmatrixQPget_rhsubind () const =0
 returns the indices where rhsub is not plus infinity (sorted increasingly)
 
virtual const CH_Matrix_Classes::MatrixQPget_lb () const =0
 returns lb of lb <= x
 
virtual const CH_Matrix_Classes::MatrixQPget_ub () const =0
 returns ub of x <= ub
 
virtual const CH_Matrix_Classes::IndexmatrixQPget_lbind () const =0
 returns the indices where lb is not minus infinity (sorted increasingly)
 
virtual const CH_Matrix_Classes::IndexmatrixQPget_ubind () const =0
 returns the indices where ub is not plus infinity (sorted increasingly)
 
- 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...
 
virtual void set_cbout (const CBout *cb, int incr=-1)
 Specifies the output level relative to the given CBout class. 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
 
virtual int mfile_data (std::ostream &out) const
 writes problem data to the given outstream
 
- 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
virtual void QPclear ()=0
 clear
 
 QPSolverObject (CBout *cb=0, int cbinc=-1)
 default constructor
 
virtual ~QPSolverObject ()
 virtual destructor
 
virtual int QPset_parameters (QPSolverParametersObject *params)=0
 the parameter object passed here will be owned and deleted by *this
 
virtual bool QPsupports_yfixing ()=0
 in the case of box constraints it may be worth to fix some variables to their upper or lower bounds; return true if the QPsolver supports this in QPSolve More...
 
virtual bool QPsupports_updates ()=0
 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
 
virtual 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)=0
 solve for the data described by Hp and QPModelDataPointer for the center of stability center_y terminating when the relative precision relprec of the objective value with respect to lower_bound and upper_bound is reached More...
 
virtual 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)=0
 resolve after a call to QPsolve for a modified groundset minorant, whose changes are described in delta_gs_subg for the indices in delta_index More...
 
virtual int QPresolve (CH_Matrix_Classes::Real lower_bound, CH_Matrix_Classes::Real upper_bound, CH_Matrix_Classes::Real relprec)=0
 if in the model description some trace/penalty values were adapted, this may require resolving without any other change in information More...
 
virtual 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 &gs_aggr_offset, CH_Matrix_Classes::Matrix &gs_aggr_gradient)=0
 returns 0 and the solution to the last solving call if the data is available, otherwise it returns 1
 
virtual CH_Matrix_Classes::Real QPget_lower_bound ()=0
 returns the last lower bound used for termination
 
virtual GroundsetModificationQPstart_modification ()=0
 return a new modification object on the heap that is initialized for modification of *this, return 0 if no modifications applicable
 
virtual int QPapply_modification (const GroundsetModification &mdf)=0
 apply the modification, return 0 if successful and 1 if unsuccessful
 
virtual bool QPis_feasible (const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real relprec=1e-10)=0
 check whether the point y is feasible with respect to the constraints describing the groundset of the QP for y
 
virtual int QPensure_feasibility (CH_Matrix_Classes::Matrix &y, bool &ychanged, QPSolverProxObject *Hp, CH_Matrix_Classes::Real relprec=1e-10)=0
 makes y feasible if it is not feasible for the groundset of the QP, see Groundset::ensure_feasibility()
 
virtual bool QPprefer_UQPSolver (QPSolverProxObject *) const =0
 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)
 
virtual bool QPconstrained () const =0
 returns false if the feasible set is the entire space (unconstrained optimization), true otherwise.
 
virtual 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 =0
 returns true if and only if there exist box constraints and these are the only constraints; if there are box constraints (and maybe others), the pointers return the reference to them (full dimensional dense vectors lb und ub; lbind and ubind are index vectors giving only the indices i of entries lb(i)>-infty and ub(i)<infty respectively sorted by increasing index values); if the corresponding objects do not exist, the value returned is null
 
virtual std::ostream & QPprint_statistics (std::ostream &out, int printlevel=0)=0
 allows to output some implementation dependent statistics on run time behaviour
 

Protected Attributes

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]
 

Private Member Functions

int QPcompute_values (bool init)
 compute function values and violation; if init==true, this is the first time
 
void QPvec_linesearch (CH_Matrix_Classes::Real &alpha, const CH_Matrix_Classes::Matrix &vec, const CH_Matrix_Classes::Matrix &dvec) const
 line search for keeping a vector nonnegative
 
void QPlinesearch (CH_Matrix_Classes::Real &alpha)
 line search on all vectors, also calling the model line search if present
 
virtual int QPselect_mu (CH_Matrix_Classes::Real &mu, CH_Matrix_Classes::Real alpha)
 choose the next value of the barrier parameter
 
virtual int QPselect_step_mu (CH_Matrix_Classes::Real &mu, CH_Matrix_Classes::Real &alpha, bool centering)
 choose the next step size and value of the barrier parameter within the neighborhood
 
virtual int QPselect_localstep_mu (CH_Matrix_Classes::Real &mu, CH_Matrix_Classes::Real &alpha, bool centering)
 choose the next step size by the local neighborhoods and then the next barrier paramater
 
int QPpredcorr_step (CH_Matrix_Classes::Real &alpha, CH_Matrix_Classes::Real &prec, CH_Matrix_Classes::Real &next_mu, bool use_predcorr, bool use_nbh, bool centering)
 predictor corrector step More...
 
int QPiterate ()
 call QPpredcorr_step repeatedly until termination
 

Private Attributes

QPSolverParametersparamsp
 parameters giving termination bounds etc
 
CH_Matrix_Classes::Matrix x
 quadratic (primal) variables
 
CH_Matrix_Classes::Matrix y
 dual variables to the affine constraints
 
CH_Matrix_Classes::Matrix s
 slack variables to the affine constraints
 
CH_Matrix_Classes::Matrix zlb
 dual variables to the lower bounds on the primal variables
 
CH_Matrix_Classes::Matrix zub
 dual variables to the upper bounds on the primal variables
 
CH_Matrix_Classes::Matrix rhszlb
 dual variables to the lower bounds on the constraints
 
CH_Matrix_Classes::Matrix rhszub
 dual variables to the upper bounds on the constraints
 
CH_Matrix_Classes::Real mu
 barrier parameter
 
CH_Matrix_Classes::Real last_mu
 barrier parameter of the previous step
 
CH_Matrix_Classes::Real next_mu
 barrier parameter computed for the next step if use_predictor_corrector==false
 
CH_Matrix_Classes::Real last_theta
 neighborhood parameter of the previous step
 
CH_Matrix_Classes::Real next_theta
 neighborhood parameter computed for the next step if use_predictor_corrector==false
 
CH_Matrix_Classes::Real last_alpha
 step size of the previous step
 
CH_Matrix_Classes::Real sigma
 current reduction factor used for mu
 
CH_Matrix_Classes::Integer iter
 counts the number of iterations/steps
 
CH_Matrix_Classes::Integer large_predictor_cnt
 increased if predictor promises a good step but mu is only decreased by a little
 
std::vector< QPCentralPathPointcentral_path
 stores the sequence of points, potentially useful for restarting
 
CH_Matrix_Classes::Real primalval
 primal objective value (if feasible)
 
CH_Matrix_Classes::Real dualval
 dual objective value (if feasible)
 
CH_Matrix_Classes::Matrix primalviol
 primal violation vector
 
CH_Matrix_Classes::Matrix dualviol
 dual violation vector
 
CH_Matrix_Classes::Matrix yviol
 violation between dual varialbes and duals to constraint bounds
 
CH_Matrix_Classes::Real n2primalviol
 Euclidean norm of primal violation.
 
CH_Matrix_Classes::Real n2dualviol
 Euclidean norm of dual violation.
 
CH_Matrix_Classes::Real n2modelprimalviol
 Euclidean norm of primal violation of the bundle model.
 
CH_Matrix_Classes::Real n2modeldualviol
 Euclidean norm of dual violation of the bundel model.
 
CH_Matrix_Classes::Real n2yviol
 Euclidean norm of yviol.
 
CH_Matrix_Classes::Matrix shortzlb
 lb duals condensed on indices with finite variable bounds
 
CH_Matrix_Classes::Matrix shortzub
 ub duals condensed on indices with finite variable bounds
 
CH_Matrix_Classes::Matrix slacklb
 slack to variable lower bounds
 
CH_Matrix_Classes::Matrix slackub
 slack to variable upper bounds
 
CH_Matrix_Classes::Matrix shortrhszlb
 lb duals condensed on indices with finite constraint bounds
 
CH_Matrix_Classes::Matrix shortrhszub
 ub duals condensed on indices with finite constraint bounds
 
CH_Matrix_Classes::Matrix rhsslacklb
 slack to constraint lower bounds
 
CH_Matrix_Classes::Matrix rhsslackub
 slack to constraint upper bounds
 
CH_Matrix_Classes::Matrix dshortzlb
 step for shortslb
 
CH_Matrix_Classes::Matrix dshortzub
 step for shortzub
 
CH_Matrix_Classes::Matrix dslacklb
 step for dslacklb
 
CH_Matrix_Classes::Matrix dslackub
 step for dslackub
 
CH_Matrix_Classes::Matrix dshortrhszlb
 step for shortrhszlb
 
CH_Matrix_Classes::Matrix dshortrhszub
 step for shortrhszub
 
CH_Matrix_Classes::Matrix drhsslacklb
 step for rhsslacklb
 
CH_Matrix_Classes::Matrix drhsslackub
 step for rhsslackub
 
CH_Matrix_Classes::Matrix solx
 last solution to the KKT system (primal Newton step)
 
CH_Matrix_Classes::Matrix soly
 last solution to the KKT system (dual Newton step)
 
CH_Matrix_Classes::Matrix old_x
 old quadratic (primal) variables
 
CH_Matrix_Classes::Matrix old_y
 old dual variables to the affine constraints
 
CH_Matrix_Classes::Matrix old_s
 old slack variables to the affine constraints
 
CH_Matrix_Classes::Matrix old_zlb
 old dual variables to the lower bounds on the primal variables
 
CH_Matrix_Classes::Matrix old_zub
 old dual variables to the upper bounds on the primal variables
 
CH_Matrix_Classes::Matrix old_rhszlb
 old dual variables to the lower bounds on the constraints
 
CH_Matrix_Classes::Matrix old_rhszub
 old dual variables to the upper bounds on the constraints
 
CH_Matrix_Classes::Real old_mu
 old barrier parameter
 
SOCIPProxBlock socqp
 holds the second order cone model of the quadratic term if this is to be used according to the parameter settings (still with numerical difficulties)
 

Detailed Description

provides the basic variables and implements basic routines for the primal dual interior point solver interface of QPSolverBasicInterface (see there for the problem description and the switched roles of x and y) except for setting up and solving the primal dual KKT system, which is left to a specialized QPKKTSolverObject provided in QPSolverParameters to allow the exploitation of structural properties in the data. The basic problem description must also still be provided in a derived class that implements the remaining abstract data retrieval functions. The bundle data is made available by deriving this class from QPModelPointer, see Interface for qp solver dependent model descriptions.

The entry point is QPIsolve() (the I is short for internal), which intializes the variables, sets the starting point, initializes the QPKKTSolverObject specified by QPSolverParameters via QPKKTSolverObject::QPinit_KKTdata() and calls QPiterate(). This routine then computes for the current point the primal and dual violations, the opimality gap, etc. As long as the termination criterion steered by the QPSolverParameters is not met, it computes predictor corrector steps by calling QPpred_corr_step(). The latter sets up a primal dual KKT system via a call to QPKKTSolverObject::QPinit_KKTsystem() and then solves this for predictor and corrector via calls to QPKKTSolverObject::QPsolve_KKTsystem() with intermediate/susbsequent calls to QPlinesearch() and QPselect_mu() for determining the next step sizes and barrier parameter.

The most important routines of the model described in the QPModelBlockObject that are required in this process are

Member Function Documentation

◆ QPpredcorr_step()

int ConicBundle::QPSolverBasicStructures::QPpredcorr_step ( CH_Matrix_Classes::Real alpha,
CH_Matrix_Classes::Real prec,
CH_Matrix_Classes::Real next_mu,
bool  use_predcorr,
bool  use_nbh,
bool  centering 
)
private

predictor corrector step

Parameters
alphaoutput value step size
precin/out precision
next_muin/out barrier parameter
use_predcorrif true, use predictor to find next_mu
use_nbhif true, use neighborhood for step and next_mu
centeringif true, go for a feasible centered point for the current (or maybe even larger) mu

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