ConicBundle
SOCSupportModification.hxx
Go to the documentation of this file.
1 
2 
3 
4 #ifndef CONICBUNDLE_SOCSUPPORTMODIFICATION_HXX
5 #define CONICBUNDLE_SOCSUPPORTMODIFICATION_HXX
6 
7 
15 #include "Modification.hxx"
16 
17 namespace ConicBundle {
18 
19  class Minorant;
20 
24 
33 {
34 protected:
37 
38 public:
39  //-----------------------------------------------------------------------
43 
46  const CBout* cb=0,
47  int incr=-1):
48  CBout(cb,incr),mdf(var_olddim,0,cb,incr,false,true,0.,0.,0.){}
49 
52  {mdf.clear(var_olddim,0);}
53 
54 
55  virtual ~SOCSupportModification();
56 
57 
59 
60  //-----------------------------------------------------------------------
64 
67  {return mdf.add_append_vars(append_dim,0,0,0,0,0);}
68 
71 
74  CH_Matrix_Classes::Indexmatrix& map_to_old);
75 
77 
78  //-----------------------------------------------------------------------
83 
84 
86 
87  //-----------------------------------------------------------------------
92 
93 
95  bool no_modification() const
96  {return mdf.no_modification();}
97 
99  int set_append_to_old(bool append_only)
100  {return mdf.set_append_to_old(append_only);}
102  bool append_to_old() const
103  {return mdf.append_to_old();}
104 
107  {
108  return ((mdf.appended_vardim()==0)&&((mdf.map_to_old_variables()==0)||(mdf.map_to_old_variables()->dim()==mdf.old_vardim())));
109  }
110 
113  {return mdf.deleted_variables_are_zero(oldpoint);}
114 
117  {return mdf.new_variables_are_zero(newpoint);}
118 
121  const CH_Matrix_Classes::Matrix& oldpoint) const
122  {return mdf.mapped_variables_are_equal(newpoint,oldpoint);}
123 
125 
126  //-----------------------------------------------------------------------
131 
133  int get_old_vardim() const {return mdf.old_vardim();}
135  int get_new_vardim() const {return mdf.new_vardim();}
137  int get_appended_vardim() const {return mdf.appended_vardim();}
138 
140  const int* get_map_to_old_variables() const
141  {return (mdf.map_to_old_variables())==0?0:(const int*)(mdf.map_to_old_variables()->get_store());}
142 
144  int incorporate(const OracleModification& m);
145 
148  {return new SOCSupportModification(old_var_dim);}
149 
151  int add_append_variables(int append_dim)
152  { return mdf.add_append_vars(append_dim,0,0,0,0,0); }
153 
155  int add_reassign_variables(int new_dim,const int* map_to_old_indices)
156  { CH_Matrix_Classes::Indexmatrix map_to_old(new_dim,1,map_to_old_indices);
157  return add_reassign_vars(map_to_old); }
158 
160 
161  //-----------------------------------------------------------------------
166 
173 
176  {return mdf.map_to_old_variables();}
177 
180  {return mdf.deleted_var_indices();}
181 
184  {return mdf.new_var_indices();}
185 
187 
188  //-----------------------------------------------------------------------
193 
195  void set_out(std::ostream* out=0,int print_level=1)
197 
199  void set_cbout(const CBout* cb=0,int incr=-1)
200  {CBout::set_cbout(cb,incr);mdf.set_cbout(this,0);}
201 
203 
204 };
205 
206 
207 
209 
210 }
211 
212 #endif
213 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
Base class for informing oracles (or the solver) about dynamic changes in the number and sorting of t...
Definition: CBSolver.hxx:544
CH_Matrix_Classes::Integer new_vardim() const
returns the number of variables once all stored modifications have been performed ...
Definition: Modification.hxx:671
const int * get_map_to_old_variables() const
returns null if there are no index changes, otherwise the Indexmatrix pointed to is a vector whose i-...
Definition: SOCSupportModification.hxx:140
bool append_to_old() const
returns true if this only contains appending operations and incorporating this is done with respect t...
Definition: Modification.hxx:650
CH_Matrix_Classes::Integer appended_vardim() const
returns the number of variables that are appended (due to later reassignmentds they may no longer be ...
Definition: SOCSupportModification.hxx:172
void set_cbout(const CBout *cb=0, int incr=-1)
see CBout::set_out
Definition: SOCSupportModification.hxx:199
int incorporate(const OracleModification &m)
incorporate the OracleModification m (it should only contain variable changes, but this is not checke...
bool append_to_old() const
returns true if this only contains appending operations and incorporating this is done with respect t...
Definition: SOCSupportModification.hxx:102
bool no_modification() const
returns true if no modifications need to be executed except possibly an offset change for the ground ...
Definition: SOCSupportModification.hxx:95
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
base class for collecting and organizing a sequence of changes to linear data so that it can be carri...
Definition: Modification.hxx:207
int get_old_vardim() const
returns the number of variables before modification
Definition: SOCSupportModification.hxx:133
int add_append_variables(int append_dim)
append append_dim further variables at the end of the argument vector (without effect on the box func...
Definition: SOCSupportModification.hxx:151
bool new_variables_are_zero(const CH_Matrix_Classes::Matrix &newpoint) const
returns true if all entries in newpoint (must be a vector of length new_vardim()) that correspond to ...
bool new_variables_are_zero(const CH_Matrix_Classes::Matrix &newpoint) const
returns true if all entries in newpoint (must be a vector of length new_vardim()) that correspond to ...
Definition: SOCSupportModification.hxx:116
int get_new_vardim() const
returns the number of variables once all stored modifications have been performed ...
Definition: SOCSupportModification.hxx:135
const CH_Matrix_Classes::Indexmatrix * map_to_old_variables() const
returns null if there are no index changes, otherwise the Indexmatrix pointed to is a vector whose i-...
Definition: Modification.hxx:684
void clear(CH_Matrix_Classes::Integer var_olddim)
reset modifications to an unmodified object currently having var_olddim variables, calls Modification::clear
Definition: SOCSupportModification.hxx:51
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
bool deleted_variables_are_zero(const CH_Matrix_Classes::Matrix &oldpoint) const
returns true if all entries deleted in oldpoint (must be a vector of length old_vardim()) are 0 and f...
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
const CH_Matrix_Classes::Indexmatrix * deleted_var_indices() const
returns null if there were no deletions, otherwise the Indexmatrix pointed to is a vector holding the...
Definition: SOCSupportModification.hxx:179
CH_Matrix_Classes::Integer old_vardim() const
returns the number of variables before modification (given on initialization)
Definition: Modification.hxx:669
Header declaring the class ConicBundle::ModificationBase.
CH_Matrix_Classes::Integer appended_vardim() const
returns the number of variables that are appended (due to later reassignmentds they may no longer be ...
Definition: Modification.hxx:673
const CH_Matrix_Classes::Indexmatrix * map_to_old_variables() const
returns null if there are no index changes, otherwise the Indexmatrix pointed to is a vector whose i-...
Definition: SOCSupportModification.hxx:175
bool mapped_variables_are_equal(const CH_Matrix_Classes::Matrix &newpoint, const CH_Matrix_Classes::Matrix &oldpoint) const
returns true if the values in newpoint (must be a vector of length new_vardim()) that correspond to o...
Definition: SOCSupportModification.hxx:120
void set_out(std::ostream *out=0, int print_level=1)
see CBout::set_out
Definition: SOCSupportModification.hxx:195
int clear(CH_Matrix_Classes::Integer var_olddim, CH_Matrix_Classes::Integer row_olddim, bool ensure_start_val_box_feasibility=false, bool ensure_bounds_consistency=true, CH_Matrix_Classes::Real start_val_def=0., CH_Matrix_Classes::Real bounds_minus_infty=CB_minus_infinity, CH_Matrix_Classes::Real bounds_plus_infty=CB_plus_infinity, CH_Matrix_Classes::Real rhs_minus_infty=CB_minus_infinity, CH_Matrix_Classes::Real rhs_plus_infty=CB_plus_infinity, CH_Matrix_Classes::Real cost_def=0.)
resets all variables so that the object to be modified has starting size var_olddim (number of variab...
CH_Matrix_Classes::Integer new_vardim() const
returns the number of variables once all stored modifications have been performed ...
Definition: SOCSupportModification.hxx:170
const CH_Matrix_Classes::Indexmatrix * new_var_indices() const
returns null if no variables were added, otherwise the Indexmatrix pointed ato is a vector holding th...
Definition: SOCSupportModification.hxx:183
Collects modifications for SOCSupportFunction for appending, deleting or reassigning variables...
Definition: SOCSupportModification.hxx:32
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...
int set_append_to_old(bool append_only)
if set to true, no deletions/reassignments may be present or specified in the future, only appensions are allowed
int add_append_vars(CH_Matrix_Classes::Integer append_dim)
append append_dim new variables to the box function
Definition: SOCSupportModification.hxx:66
CH_Matrix_Classes::Integer old_vardim() const
returns the number of variables before modification (given on initialization)
Definition: SOCSupportModification.hxx:168
SOCSupportModification(CH_Matrix_Classes::Integer var_olddim=0, const CBout *cb=0, int incr=-1)
constructor, calls modification constructor
Definition: SOCSupportModification.hxx:45
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
OracleModification * new_initial_oraclemodification(int old_var_dim) const
returns a new object on the heap, that allows to incorporate this but starts off from a function whos...
Definition: SOCSupportModification.hxx:147
int print_level
nonnegative level of output, 0 should mean WARNINGS and ERRORS only, 1 should represent normal output...
Definition: CBout.hxx:37
Modification mdf
this class provides a restricted interface to this Modification instance where all modifications are ...
Definition: SOCSupportModification.hxx:36
int add_delete_vars(const CH_Matrix_Classes::Indexmatrix &del_ind, CH_Matrix_Classes::Indexmatrix &map_to_old)
delete the variables indexed by del_ind; for each new index map_to_old returns the old one; calls Mod...
const CH_Matrix_Classes::Indexmatrix * deleted_var_indices() const
returns null if there were no deletions, otherwise the Indexmatrix pointed to is a vector holding the...
Definition: Modification.hxx:688
bool no_modification() const
returns true if no modifications need to be executed
bool deleted_variables_are_zero(const CH_Matrix_Classes::Matrix &oldpoint) const
returns true if all entries deleted in oldpoint (must be a vector of length old_vardim()) are 0...
Definition: SOCSupportModification.hxx:112
Integer * get_store()
returns the current address of the internal value array; use cautiously, do not use delete! ...
Definition: indexmat.hxx:427
int add_reassign_variables(int new_dim, const int *map_to_old_indices)
reorder and resize the variables as given by the first new_dim entries of map_to_old_indices; each fo...
Definition: SOCSupportModification.hxx:155
bool no_additions_or_deletions_in_vars() const
returns true if no variables were added or deleted (allows permutations), false otherwise ...
Definition: SOCSupportModification.hxx:106
const CH_Matrix_Classes::Indexmatrix * new_var_indices() const
returns null if no variables were added, otherwise the Indexmatrix pointed to is a vector holding the...
Definition: Modification.hxx:692
int add_reassign_vars(const CH_Matrix_Classes::Indexmatrix &map_to_old)
reassign the variables as given in map_to_old, calls Modification::add_reassign_vars ...
int get_appended_vardim() const
returns the number of variables that are appended (due to later reassignmentds they may no longer be ...
Definition: SOCSupportModification.hxx:137
void dim(Integer &_nr, Integer &_nc) const
returns the number of rows in _nr and the number of columns in _nc
Definition: indexmat.hxx:315
int add_append_vars(CH_Matrix_Classes::Integer append_dim, const CH_Matrix_Classes::Matrix *append_lb, const CH_Matrix_Classes::Matrix *append_ub, const CH_Matrix_Classes::Sparsemat *append_cols, const CH_Matrix_Classes::Matrix *append_start_val, const CH_Matrix_Classes::Matrix *append_linear_costs)
append information on new variables at the respective ends
bool mapped_variables_are_equal(const CH_Matrix_Classes::Matrix &newpoint, const CH_Matrix_Classes::Matrix &oldpoint) const
returns true if the values in newpoint (must be a vector of length new_vardim()) that correspond to o...
virtual void set_cbout(const CBout *cb, int incr=-1)
Specifies the output level relative to the given CBout class.
int set_append_to_old(bool append_only)
if set to true, no deletions/reassignments may be present or specified in the future, only appensions are allowed
Definition: SOCSupportModification.hxx:99