ConicBundle
MinorantUseData.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_MINORANTUSEDATA_HXX
4 #define CONICBUNDLE_MINORANTUSEDATA_HXX
5 
6 
14 #include <map>
15 #include "CBSolver.hxx"
16 #include "CBout.hxx"
17 #include "matrix.hxx"
18 
19 
20 namespace ConicBundle {
21 
34 class MinorantUseData: public CBout
35 {
36 private:
37  friend class MinorantPointer;
38 
49 
51  mutable std::map<CH_Matrix_Classes::Integer,CH_Matrix_Classes::Real> evals;
52 
57 
59  MinorantUseData(const MinorantUseData&):CBout(){assert(false);}
61  MinorantUseData& operator=(const MinorantUseData&){assert(false);return *this;}
62 
63 public:
68  CBout(),modification_id(modif_id),scaleval(sval)
69  {assert(mp); use_cnt=0; minorant=mp; md=0;aggr_stat=0;prex_id=0;}
72  CBout(),scaleval(sval)
73  { assert((mdp==0)||(mdp->use_cnt>=1));
74  use_cnt=0; minorant=0; md=mdp; md->use_cnt++;
75  modification_id=-1;aggr_stat=0;prex_id=0;}
77  ~MinorantUseData();
78 
81 
83  bool valid() const;
84 
86  Minorant* get_minorant() const;
87 
90 
93 
95  int synchronize_ids(CH_Matrix_Classes::Integer new_modification_id,
96  CH_Matrix_Classes::Integer new_center_id,
97  CH_Matrix_Classes::Integer old_center_id,
98  CH_Matrix_Classes::Integer new_cand_id,
99  CH_Matrix_Classes::Integer old_cand_id,
100  CH_Matrix_Classes::Integer new_prex_id);
101 
103  bool aggregate() const;
104 
107 
110 
113 
115  int scale(CH_Matrix_Classes::Real factor);
116 
119 
121  CH_Matrix_Classes::Real evaluate(CH_Matrix_Classes::Integer yid,const CH_Matrix_Classes::Matrix& y,bool with_constant=true) const;
122 
124  bool one_user() const;
125 
126 
127 };
128 
129 
131 
132 
133 }
134 
135 
136 #endif
137 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
Header declaring the classes CH_Matrix_Classes::Realrange and CH_Matrix_Classes::Matrix having Real e...
MinorantUseData(MinorantUseData *mdp, CH_Matrix_Classes::Real sval)
constructor for a recursively containing further MinorantUseData with an additional scaling factor sv...
Definition: MinorantUseData.hxx:71
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
Minorant * get_minorant() const
return the final minorant (by a recursive call) or 0 if there is none
bool valid() const
check validity recursively
CH_Matrix_Classes::Real offset() const
return the offset of the minorant
stores use information for the model that the minorant is generated for or to the data the model refe...
Definition: MinorantUseData.hxx:34
bool one_user() const
returns true if not valid or use_cnt==1 recursively
this is used to describe affine minorants of convex functions that will be used for generating cuttin...
Definition: CBSolver.hxx:274
int synchronize_ids(CH_Matrix_Classes::Integer new_modification_id, CH_Matrix_Classes::Integer new_center_id, CH_Matrix_Classes::Integer old_center_id, CH_Matrix_Classes::Integer new_cand_id, CH_Matrix_Classes::Integer old_cand_id, CH_Matrix_Classes::Integer new_prex_id)
sets the modification_id to its new id and reinitializes the evaluation map
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
int scale(CH_Matrix_Classes::Real factor)
carries through the scaling for the underlying minorant, afterwards scaleval==1., may only be carried...
Minorant * minorant
this points to the minorant or maybe to nothing if not valid
Definition: MinorantUseData.hxx:54
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
MinorantUseData(const MinorantUseData &)
forbidden, blocked deriberately
Definition: MinorantUseData.hxx:59
CH_Matrix_Classes::Integer modification_id
the value of the modification id of the function at the time of generation or when modified; if minor...
Definition: MinorantUseData.hxx:42
Header declaring the classes ConicBundle::CBSolver, ConicBundle::FunctionOracle and ConicBundle::Prim...
MinorantUseData(Minorant *mp, CH_Matrix_Classes::Real sval, CH_Matrix_Classes::Integer modif_id)
constructor for a new minorant with scaling sval and modification id modfi_id
Definition: MinorantUseData.hxx:65
CH_Matrix_Classes::Integer get_modification_id() const
returns the modification id
CH_Matrix_Classes::Real coeff(CH_Matrix_Classes::Integer i) const
return coefficient i of the minorant
CH_Matrix_Classes::Integer prex_id
gives the id of the last primal extender call, -1 for failed, 0 initially
Definition: MinorantUseData.hxx:46
Header declaring the output class CBout.
CH_Matrix_Classes::Integer & set_modification_id()
returns the modification id also for overwriting
CH_Matrix_Classes::Real scaleval
value by which the minorant or the MinorantUseData has to be scaled
Definition: MinorantUseData.hxx:48
int get_scaleval_and_minorant(CH_Matrix_Classes::Real &sv, Minorant *&m)
by a recursive call return the collected scaling value and the final minorant
Matrix class for real values of type Real
Definition: matrix.hxx:74
int aggregated(CH_Matrix_Classes::Integer n)
add n to the number couting the aggregations
bool aggregate() const
returns true if the minorant is an aggregate of several minorants
MinorantUseData & operator=(const MinorantUseData &)
forbidden, blocked deriberately
Definition: MinorantUseData.hxx:61
int call_primal_extender(PrimalExtender &prex, CH_Matrix_Classes::Integer in_prex_id)
apply the primal extender to the minorant if in_prex_id indicates a new extension ...
CH_Matrix_Classes::Integer use_cnt
the number of MinorantPointer instance pointing to this; once it reaches 0 the corresponding Minorant...
Definition: MinorantUseData.hxx:40
Interface for extending PrimalData, e.g., in Lagrangian relaxation of column generation approaches...
Definition: CBSolver.hxx:180
MinorantUseData * md
if there is no minorant, it should be in here (recursively)
Definition: MinorantUseData.hxx:56
CH_Matrix_Classes::Real evaluate(CH_Matrix_Classes::Integer yid, const CH_Matrix_Classes::Matrix &y, bool with_constant=true) const
evaluate the minorant for y unluess yid allows to retrieve a previous evaluation
std::map< CH_Matrix_Classes::Integer, CH_Matrix_Classes::Real > evals
if minorant!=0, this records evaluations for given point ids
Definition: MinorantUseData.hxx:51
points to MinorantUseData that may be shared by many and allows computations with Minorants ...
Definition: MinorantPointer.hxx:34
CH_Matrix_Classes::Integer aggr_stat
the number of minorants aggregated in this (only caused by MinorantPointer::aggregate ...
Definition: MinorantUseData.hxx:44