3 #ifndef CONICBUNDLE_MINORANTPOINTER_HXX 4 #define CONICBUNDLE_MINORANTPOINTER_HXX 19 class GroundsetModification;
80 {
init(mnrt,modification_id,factor);}
97 bool empty()
const {
return (md==0);}
150 bool apply_gsmdf_costs=
false);
204 bool enforce_copy=
false)
const;
230 {
return (md==mp.
md);}
264 std::ostream&
display(std::ostream&
out,
int precision=8)
const;
279 const MinorantBundle& B,
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
MinorantPointer(MinorantUseData *in_md)
initialize this to point to in_md
Definition: MinorantPointer.hxx:65
void init(const MinorantPointer &mp, CH_Matrix_Classes::Real factor=1., bool enforce_copy=false)
if factor!=1 it generates another MinorantUseData referring to the one of mp, otherwise it simply use...
bool operator<(const MinorantPointer &mp) const
they are equal if they point to the same object, compares the addresses of this objects ...
Definition: MinorantPointer.hxx:225
bool zero() const
returns true if the pointer is not empty but all entrys (also the offset) are zero ...
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
CH_Matrix_Classes::Matrix & genmult(const MinorantBundle &A, const CH_Matrix_Classes::Matrix &B, CH_Matrix_Classes::Matrix &C, CH_Matrix_Classes::Real alpha=1., CH_Matrix_Classes::Real beta=0., int Atrans=0, int Btrans=0, CH_Matrix_Classes::Matrix *Coffset=0)
computes and returns C=alpha*A*B+beta*C where A and B may be transposed and A is considered to have t...
CH_Matrix_Classes::Real norm_squared(const CH_Matrix_Classes::Matrix *D=0) const
Compute the norm squared of this for the given diagonal matrix D (identity if not given)...
Minorant * get_minorant() const
return the final minorant (by a recursive call) or 0 if there is none
bool valid() const
check validity recursively
bool equals(const MinorantPointer &mp, CH_Matrix_Classes::Real tol=1e-10) const
they are equal if they point to the same object or are both 0. If not, they differ if their matrix re...
std::ostream & display(std::ostream &out, int precision=8) const
output the Minorant in a nice format
Interface for extending a Minorant, e.g., in Lagrangian Relaxation of cutting plane approaches...
Definition: CBSolver.hxx:490
int get_scaleval_and_minorant(CH_Matrix_Classes::Real &sv, Minorant *&m)
returns the Minorant *this points to with its scaling value or 0 if empty
Definition: MinorantPointer.hxx:124
MinorantPointer(const MinorantPointer &mp)
calls new_data
Definition: MinorantPointer.hxx:69
bool valid() const
returns true if the pointer is not empty and the data is valid
Definition: MinorantPointer.hxx:100
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
CH_Matrix_Classes::Real offset() const
returns the offset of the minorant (including the internal scalings) or CB_minus_infinity if empty ...
MinorantPointer(Minorant *mnrt, CH_Matrix_Classes::Integer modification_id, CH_Matrix_Classes::Real factor=1.)
calls init(Minorant*,CH_Matrix_Classes::Integer,CH_Matrix_Classes::Real)
Definition: MinorantPointer.hxx:78
bool operator>(const MinorantPointer &mp) const
they are equal if they point to the same object, compares the addresses of this objects ...
Definition: MinorantPointer.hxx:233
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=0)
if not empty it sets the modification_id to its new id and reinitializes the evaluation map ...
stores use information for the model that the minorant is generated for or to the data the model refe...
Definition: MinorantUseData.hxx:34
bool empty() const
returns true if the pointer is empty
Definition: MinorantPointer.hxx:97
this is used to describe affine minorants of convex functions that will be used for generating cuttin...
Definition: CBSolver.hxx:274
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
CH_Matrix_Classes::Real evaluate(CH_Matrix_Classes::Integer yid, const CH_Matrix_Classes::Matrix &y, bool with_constant=true) const
negative ids are allowed and indicate there is no need to memorize this result, returns CB_minus_infi...
const PrimalData * get_primal()
returns the primal of the Minorant *this points to or 0 if empty (first carrying out any pending scal...
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
MinorantUseData * md
if null, it is regarded as not initialized or empty
Definition: MinorantPointer.hxx:38
int add_offset(CH_Matrix_Classes::Real offset)
add the offset; if empty, initialize to offset with zero linear part, if not the only user (use_cnt>1...
bool operator==(const MinorantPointer &mp) const
they are equal if they point to the same object, compares the addresses of this objects ...
Definition: MinorantPointer.hxx:229
CH_Matrix_Classes::Integer nonzeros() const
returns the number of nonzero coefficients
Definition: MinorantPointer.hxx:137
int apply_modification(const GroundsetModification &gsmdf, CH_Matrix_Classes::Integer mod_id, MinorantExtender *mex, bool apply_gsmdf_costs=false)
if valid and the local modification_id is smaller than mod_id, it modifies the coefficients as descri...
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
std::ostream * out
not output at all if out==0, otherwise use this output stream
Definition: CBout.hxx:33
MinorantPointer & operator=(const MinorantPointer &mp)
calls new_data with the data of mp and copies the modification_id
Matrix class of sparse matrices with real values of type Real
Definition: sparsmat.hxx:74
std::vector< MinorantPointer > MinorantBundle
a bundle is a vector with MinorantPointer entries
Definition: MinorantPointer.hxx:24
int call_primal_extender(PrimalExtender &prex, CH_Matrix_Classes::Integer prex_id)
executes prex on the primal if its id is smaller then prex_id; returns != if this fails or not primal...
void delete_data()
if -1 it is invalid or empty, otherwise it gives the modification id of the function that it was crea...
virtual ~MinorantPointer()
calls delete_data
Definition: MinorantPointer.hxx:83
const Minorant * get_minorant() const
returns the Minorant *this points to or 0 if empty
Definition: MinorantPointer.hxx:120
CH_Matrix_Classes::Real dual_norm_squared(const CH_Matrix_Classes::Matrix *D=0) const
Compute the dual norm squared of this for the given diagonal matrix D (identity if not given)...
int prepare_for_changes(CH_Matrix_Classes::Real factor=1., bool with_primal=false)
check whether the minorant is owend by this pointer (use_cnt==1) and if not, clone it first ...
MinorantPointer()
declares the pointer empty
Definition: MinorantPointer.hxx:61
bool aggregate() const
returns ture if it points to a combination of minorants from the same function;
In Lagrangean relaxation an approximate primal solution can be generated by supplying primal informat...
Definition: CBSolver.hxx:151
CH_Matrix_Classes::Matrix & right_genmult(const CH_Matrix_Classes::Matrix &A, CH_Matrix_Classes::Matrix &C, CH_Matrix_Classes::Real alpha=1., CH_Matrix_Classes::Real beta=0., int atrans=0, int thistrans=0, CH_Matrix_Classes::Integer thisindex=0) const
computes and returns C=alpha*A*(*this)+beta*C where A and *this may be transposed and *this is consid...
void new_data(MinorantUseData *in_md)
first deletes the old data and then fills the information with the new
Collects modifications for the unconstrained Groundset for appending, deleting or reassigning variabl...
Definition: GroundsetModification.hxx:32
int scale(CH_Matrix_Classes::Real val)
multiply the MinorantPointer by val (this is an external factor for the minorant and possibly its pri...
Header declaring the class ConicBundle::MinorantUseData.
Interface for extending PrimalData, e.g., in Lagrangian relaxation of column generation approaches...
Definition: CBSolver.hxx:180
virtual int nonzeros()
returns the number of nonzero coefficients
CH_Matrix_Classes::Real coeff(CH_Matrix_Classes::Integer i) const
returns coefficient i of the minorant (including the internal scalings) or 0. if empty ...
MinorantPointer(const MinorantPointer &mp, CH_Matrix_Classes::Real factor)
calls init(const MinorantPointer&,CH_Matrix_Classes::Real)
Definition: MinorantPointer.hxx:73
CH_Matrix_Classes::Real ip(const MinorantPointer &mp, const CH_Matrix_Classes::Indexmatrix *skip_fixed=0, const CH_Matrix_Classes::Matrix *ipdiag=0) const
computes the inner product of the two minorants; if skip_fixed!=NULL the corrsponding indices are not...
CH_Matrix_Classes::Matrix & left_genmult(const CH_Matrix_Classes::Matrix &B, CH_Matrix_Classes::Matrix &C, CH_Matrix_Classes::Real alpha=1., CH_Matrix_Classes::Real beta=0., int thistrans=0, int btrans=0, CH_Matrix_Classes::Integer thisindex=0) const
computes and returns C=alpha*(*this)*B+beta*C where B and *this may be transposed and *this is consid...
bool one_user() const
returns true if not valid or this is the only active pointer to the minorant
points to MinorantUseData that may be shared by many and allows computations with Minorants ...
Definition: MinorantPointer.hxx:34
Header declaring the class CH_Matrix_Classes::Sparsemat for sparse matrices with Real elements...
void clear()
afterwards the pointer is empty (calls delete_data())
Definition: MinorantPointer.hxx:86