ConicBundle
UnconstrainedGroundset.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_UNCONSTRAINEDGROUNDSET_HXX
4 #define CONICBUNDLE_UNCONSTRAINEDGROUNDSET_HXX
5 
6 
14 #include "Groundset.hxx"
16 
17 namespace ConicBundle {
18 
21 
29  class UnconstrainedGroundset:virtual public Groundset
30 {
31 protected:
32 
35 
38 
41 
44 
46  bool use_yfixing;
47 
50 
53 
54  //data for describing the QP
58 
59 
60 public:
71  virtual void clear( CH_Matrix_Classes::Integer indim=0, CH_Matrix_Classes::Integer in_groundset_id=0);
72 
75  const CH_Matrix_Classes::Matrix* start_val=0,
76  const CH_Matrix_Classes::Matrix* costs=0,
77  const CH_Matrix_Classes::Real offset=0.,
78  CH_Matrix_Classes::Integer in_groundset_id=0);
79 
80  virtual ~UnconstrainedGroundset();
81 
84 
86  void set_groundset_id(CH_Matrix_Classes::Integer gsid){groundset_id=gsid;}
87 
90  {return dim;}
91 
96  virtual bool constrained() const {return false;}
97 
110  virtual bool is_feasible(CH_Matrix_Classes::Integer& in_groundset_id,
111  const CH_Matrix_Classes::Matrix& y,
112  CH_Matrix_Classes::Real relprec=1e-10);
113 
137  virtual int ensure_feasibility(CH_Matrix_Classes::Integer& in_groundset_id,
139  bool& ychanged,
140  BundleProxObject* Hp=0,
141  CH_Matrix_Classes::Real relprec=1e-10);
142 
144  virtual QPSolverObject* get_qp_solver(bool& solves_model_without_gs,
145  BundleProxObject* Hp);
146 
149  {
150  return 0;
151  }
152 
155  {return starting_point;}
156 
159  {starting_point=vec; int dummy=-1; return (is_feasible(dummy,vec)==false);}
160 
257  virtual int candidate(CH_Matrix_Classes::Integer& gs_id,
259  CH_Matrix_Classes::Real& cand_gs_val,
260  CH_Matrix_Classes::Real& linval,
261  CH_Matrix_Classes::Real& augval_lb,
262  CH_Matrix_Classes::Real& augval_ub,
263  CH_Matrix_Classes::Real& subgnorm2,
264  const CH_Matrix_Classes::Matrix& center_y,
265  CH_Matrix_Classes::Real center_value,
266  const MinorantPointer& model_minorant,
267  BundleProxObject* Hp,
268  MinorantPointer* delta_groundset_minorant=0,
269  CH_Matrix_Classes::Indexmatrix* delta_index=0,
270  CH_Matrix_Classes::Real relprec=1e-2);
271 
273  virtual const MinorantPointer& get_gs_aggregate() const { return gs_aggregate;}
274 
276  virtual const MinorantPointer& get_gs_minorant() const { return gs_aggregate;}
277 
280  {return (use_yfixing? &yfixed : 0);}
281 
284  {return (use_yfixing? &yfixed : 0);}
285 
287  bool get_use_yfixing() const {return use_yfixing;}
288 
290  void set_use_yfixing(bool uyf) {use_yfixing=uyf;}
291 
294  { return new LPGroundsetModification(dim,0,this);}
295 
298 
300  int mfile_data(std::ostream& out) const;
301 
303  void set_cbout(const CBout* cb, int incr=-1)
304  {
306  if (qp_solver)
307  qp_solver->set_cbout(this);
308  }
309 };
310 
311 
312 
314 
315 }
316 
317 #endif
318 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
CH_Matrix_Classes::Matrix c
linear cost term for QP-subproblems
Definition: UnconstrainedGroundset.hxx:56
abstract interface for a QPSolver
Definition: QPSolverObject.hxx:105
CH_Matrix_Classes::Integer dim
current dimension of the ground set
Definition: UnconstrainedGroundset.hxx:34
abstract interface that allows to use different -norms with a positive definite matrix in the proxi...
Definition: BundleProxObject.hxx:88
QPSolverObject * qp_solver
the QPSolver for solving the bundle subproblem with Groundset
Definition: UnconstrainedGroundset.hxx:52
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
virtual int ensure_feasibility(CH_Matrix_Classes::Integer &in_groundset_id, CH_Matrix_Classes::Matrix &y, bool &ychanged, BundleProxObject *Hp=0, CH_Matrix_Classes::Real relprec=1e-10)
if the groundset_id changed, it checks feasibility of y with respect to the given precision...
CH_Matrix_Classes::Integer get_groundset_id() const
returns the current groundset_id, increased values indicate changes in the ground set ...
Definition: UnconstrainedGroundset.hxx:83
virtual QPSolverObject * get_qp_solver(bool &solves_model_without_gs, BundleProxObject *Hp)
returns a pointer to an internal QPSolverObject that is able to solve bundle suproblems efficiently f...
virtual const MinorantPointer & get_gs_minorant() const
returns the linear minorant valid on the entire ground set (e.g. a linear cost funciton) ...
Definition: UnconstrainedGroundset.hxx:276
Header declaring the class ConicBundle::LPGroundsetModification.
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
bool use_yfixing
if set to true in constrained versions, y-variables that are at strongly active bounds should be fixe...
Definition: UnconstrainedGroundset.hxx:46
MinorantPointer gs_aggregate
the ground set aggregate, here giving the linear coefficients of the affine cost function ...
Definition: UnconstrainedGroundset.hxx:43
virtual CH_Matrix_Classes::Integer get_dim() const
returns the dimension of the ground set, i.e., the length of the variables vector y ...
Definition: UnconstrainedGroundset.hxx:89
virtual void clear(CH_Matrix_Classes::Integer indim=0, CH_Matrix_Classes::Integer in_groundset_id=0)
reset everything to initial state for an unconstrained ground set of dimension indim ...
in order to pass parameters to a customized QPSolverObject, derive the parameters from this object; n...
Definition: QPSolverObject.hxx:46
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
void set_groundset_id(CH_Matrix_Classes::Integer gsid)
sets the groundset_id to the desired value, increasing it is safer here because this is used to indic...
Definition: UnconstrainedGroundset.hxx:86
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
GroundsetModification * start_modification()
return a new modification object on the heap that is initialized for modification of *this ...
Definition: UnconstrainedGroundset.hxx:293
virtual CH_Matrix_Classes::Indexmatrix * set_yfixed()
if not NULL (iff get_use_yfixing()==false) returns the vector yfixed with yfixed(i)=0 if not fixed...
Definition: UnconstrainedGroundset.hxx:283
CH_Matrix_Classes::Integer groundset_id
nonnegative update counter for recognizing changes in the groundset description
Definition: UnconstrainedGroundset.hxx:37
implements an unconstrained groundset
Definition: UnconstrainedGroundset.hxx:29
abstract representation of the feasible convex ground set to be optimized over, provides the QP solve...
Definition: Groundset.hxx:77
bool get_use_yfixing() const
true if the cooridinate fixing heuristic is switched on (only constrained cases)
Definition: UnconstrainedGroundset.hxx:287
virtual int set_starting_point(const CH_Matrix_Classes::Matrix &vec)
stores the a new starting point irrespective of whether it is feasible or not and returns 0 if it fea...
Definition: UnconstrainedGroundset.hxx:158
UnconstrainedGroundset(CH_Matrix_Classes::Integer indim=0, const CH_Matrix_Classes::Matrix *start_val=0, const CH_Matrix_Classes::Matrix *costs=0, const CH_Matrix_Classes::Real offset=0., CH_Matrix_Classes::Integer in_groundset_id=0)
calls clear() with the same parameters
Matrix class for real values of type Real
Definition: matrix.hxx:74
Collects modifications for the linearly constrained LPGroundset for appending, deleting or reassignin...
Definition: LPGroundsetModification.hxx:32
CH_Matrix_Classes::Real gamma
constant offset for QP-subproblems
Definition: UnconstrainedGroundset.hxx:57
void set_cbout(const CBout *cb, int incr=-1)
output settings
Definition: UnconstrainedGroundset.hxx:303
std::ostream * out
not output at all if out==0, otherwise use this output stream
Definition: CBout.hxx:33
int apply_modification(const GroundsetModification &mdf)
change the groundset description as specified by the argument
virtual const CH_Matrix_Classes::Matrix & get_starting_point() const
returns a stored starting point, note: this need not be feasible; if generated automatically, its dimension is correct.
Definition: UnconstrainedGroundset.hxx:154
CH_Matrix_Classes::Matrix starting_point
the starting point
Definition: UnconstrainedGroundset.hxx:40
Collects modifications for the unconstrained Groundset for appending, deleting or reassigning variabl...
Definition: GroundsetModification.hxx:32
int mfile_data(std::ostream &out) const
m-file output routine for debugging or testing in Matlab (not yet working)
virtual bool constrained() const
returns false if the feasible set is the entire space (unconstrained optimization), true otherwise.
Definition: UnconstrainedGroundset.hxx:96
virtual const CH_Matrix_Classes::Indexmatrix * get_yfixed() const
if not NULL (iff get_use_yfixing()==false) it returns the vector yfixed with yfixed(i)=0 if not fixed...
Definition: UnconstrainedGroundset.hxx:279
virtual bool is_feasible(CH_Matrix_Classes::Integer &in_groundset_id, const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real relprec=1e-10)
on input value in_groundset_id the input y was feasible. Return true if the id did not change...
virtual int candidate(CH_Matrix_Classes::Integer &gs_id, CH_Matrix_Classes::Matrix &newy, CH_Matrix_Classes::Real &cand_gs_val, CH_Matrix_Classes::Real &linval, CH_Matrix_Classes::Real &augval_lb, CH_Matrix_Classes::Real &augval_ub, CH_Matrix_Classes::Real &subgnorm2, const CH_Matrix_Classes::Matrix &center_y, CH_Matrix_Classes::Real center_value, const MinorantPointer &model_minorant, BundleProxObject *Hp, MinorantPointer *delta_groundset_minorant=0, CH_Matrix_Classes::Indexmatrix *delta_index=0, CH_Matrix_Classes::Real relprec=1e-2)
for a given model aggregate compute the groundset aggregate and the resulting (feasible) candidate ...
const BundleProxObject * Hp
points to the quadratic cost matrix inside ensure_feasibility() and candidate(), otherwise ==NULL ...
Definition: UnconstrainedGroundset.hxx:55
points to MinorantUseData that may be shared by many and allows computations with Minorants ...
Definition: MinorantPointer.hxx:34
virtual const MinorantPointer & get_gs_aggregate() const
returns the groundset aggregate computed in candidate()
Definition: UnconstrainedGroundset.hxx:273
CH_Matrix_Classes::Indexmatrix yfixed
in constrained versions, when use_yfixing is true, this indicates whether a coordinate should be cons...
Definition: UnconstrainedGroundset.hxx:49
virtual void set_cbout(const CBout *cb, int incr=-1)
Specifies the output level relative to the given CBout class.
void set_use_yfixing(bool uyf)
set to true to switch on the cooridinate fixing heuristic (only constrained cases) ...
Definition: UnconstrainedGroundset.hxx:290
Header declaring the class ConicBundle::Groundset.
int set_qp_solver_parameters(QPSolverParametersObject *)
set parameters for the QP_Solver
Definition: UnconstrainedGroundset.hxx:148