ConicBundle
NNCModel.hxx
Go to the documentation of this file.
1 
2 
3 #ifndef CONICBUNDLE_NNCMODEL_HXX
4 #define CONICBUNDLE_NNCMODEL_HXX
5 
13 #include "MatrixCBSolver.hxx"
14 #include "ConeModel.hxx"
15 #include "NNCData.hxx"
17 
18 namespace ConicBundle {
19 
23 
28 class NNCModel: public ConeModel
29 {
30 private:
31 
32  //--- problem description
35  //--- data describing the model
40 
41  //--- data of last oracle evaluation
43  int ret_code;
46 
47  //--- augmented model solver
50 
52 
55  const CH_Matrix_Classes::Matrix& cand_y);
56 
57  //----------------------------------------------------------------------
60 
61 
65  CH_Matrix_Classes::Real nullstep_bound,
66  CH_Matrix_Classes::Real relprec);
67 
70  const CH_Matrix_Classes::Matrix& iny);
71 
76  CH_Matrix_Classes::Real relprec);
77 
79  virtual int update_local_model(ModelUpdate model_update,
81  const CH_Matrix_Classes::Matrix& center_y,
84  CH_Matrix_Classes::Real model_maxviol,
85  BundleProxObject& H);
86 
88  virtual int switch_to_local( const MinorantBundle& sumbundle_model,
89  const CH_Matrix_Classes::Matrix& sumbundle_coeff);
90 
92  virtual int get_aggregate_and_coefficient(MinorantPointer& sumbundle_aggr,
93  CH_Matrix_Classes::Real& aggr_coeff);
94 
95 
96 
98  virtual int start_local_augmodel(QPModelDataPointer& qpblockp,
100  const CH_Matrix_Classes::Matrix& cand_y,
101  const CH_Matrix_Classes::Indexmatrix* needed_indexsubset);
102 
104  virtual int make_local_aggregate(CH_Matrix_Classes::Real& new_function_factor,
105  bool keep_penalty_fixed);
106 
108  virtual int local_adjust_multiplier(CH_Matrix_Classes::Real& new_function_factor);
109 
111  virtual bool candidate_available()
112  {return (data.cand_ub_mid==data.get_modification_id())&&(data.cand_minorants.size()>0); }
113 
116 
119 
120 
122 
123 
124 public:
126  virtual void clear();
127 
129  NNCModel(MatrixFunctionOracle* fo,CH_Matrix_Classes::Real fun_factor=1.,FunctionTask fun_task=ObjectiveFunction,CBout* cb=0,int cbinc=-1);
130 
132  ~NNCModel();
133 
134 
135  //----------------------------------------------------------------------
138 
139 
140  //eval_function //as in ConeModel
141 
142  //eval_model //as in ConeModel
143 
144  //eval_augmodel //as in SumBlockModel
145 
146  //reeval_augmodel //as in SumBlockModel
147 
148  //get_model_aggregate(three parameters) //as in SumBlockModel
149 
150  //update_model //as in ConeModel
151 
152  //synchronize_ids //as in SumBlockModel
153 
154  //center_modified //as in SumBlockModel
155 
156  //recompute center //as in ConeModel
157 
158  //model_aggregate_modified //as in ConeModel
159 
160  //provide_model_aggregate //as in ConeModel
161 
162  //apply_modification //as in SumBlockModel
163 
164  //add_variable_metric //as in SumBlockModel
165 
166  //check_center_validity_by_candidate //as in ConeModel
167 
169 
170  //----------------------------------------------------------------------
173 
176 
177  //start_augmodel //as in ConeModel
178 
179  // make_model_aggregate //as in ConeModel
180 
181  //get_model_aggregate(... aft=0) //as in SumBlockModel
182 
185  const CH_Matrix_Classes::Matrix& y);
186 
187  // get_function_minorant //as in ConeModel
188 
189  // get_center_minorant //as in ConeModel
190 
191  // adjust_multiplier //as in ConeModel
192 
193  // sumbundle_contribution //as in ConeModel
194 
195  // as in ConeModel::update_model(ModelUpdate,CH_Matrix_Classes::Integer,const CH_Matrix_Classes::Matrix&,CH_Matrix_Classes::Real,CH_Matrix_Classes::Real,CH_Matrix_Classes::Real&,CH_Matrix_Classes::Real&)
196 
198  BundleData* get_data() {return &data;}
199 
201  const BundleData* get_data() const {return &data;}
202 
204  int set_data(BundleData* bd){return data.init(bd);}
205 
207 
208  //----------------------------------------------------------------------
209 
212 
213 
216  { return data.get_approximate_primal(); }
217 
220  { return data.get_center_primal();}
221 
224  { return data.get_candidate_primal();}
225 
228  { return data.call_primal_extender(prex); }
229 
232 
235  {return model_selection;}
236 
237  // clear_model() //as in ConeModel
238 
239  // clear_aggregates() //as in ConeModel
240 
242  int get_ret_code() const {return ret_code;}
243 
244 
246 
247  //----------------------------------------------------------------------
250 
251  //get_QPcoeff_time() // as in SumBlockModel
252 
253  //get_QPsolve_time() // as in SumBlockModel
254 
255  //get_evalaugmodel_time() // as in SumBlockModel
256 
257  //get_evalmodel_time() // as in SumBlockModel
258 
259  //get_updatemodel_time() // as in SumBlockModel
260 
261  //get_eval_time() // as in SumBlockModel
262 
264  void set_out(std::ostream* o=0,int pril=1)
265  {
266  SumBlockModel::set_out(o,pril);
267  if (block)
268  block->set_cbout(this,-1);
269  if (model_selection)
270  model_selection->set_cbout(this,0);
271  }
272 
273  //set_cbout() // calls set_out in SumBlockModel
274 
275 
277 
278 
279 };
280 
282 
283 }
284 
285 #endif
286 
int Integer
all integer numbers in calculations and indexing are of this type
Definition: matop.hxx:40
virtual int evaluate_local_model(CH_Matrix_Classes::Real &lb, CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real relprec)
see SumBlockModel::eval_model() but ignore function_factor and function_task, this is set by ConeMode...
virtual int get_aggregate_and_coefficient(MinorantPointer &sumbundle_aggr, CH_Matrix_Classes::Real &aggr_coeff)
the sumbundle is initialized (not necessarily switched on) and needs to know the normalized aggregate...
CH_Matrix_Classes::Integer cand_ub_mid
modification id for which cand_ub was computed, <0 if not initialized
Definition: BundleData.hxx:120
abstract interface that allows to use different -norms with a positive definite matrix in the proxi...
Definition: BundleProxObject.hxx:88
Header declaring the class ConicBundle::NNCData (needed for ConicBundle::NNCModel) ...
NNCData data
the relevant data for running BundleSolver consistently
Definition: NNCModel.hxx:37
double Real
all real numbers in calculations are of this type
Definition: matop.hxx:50
virtual int provide_local_aggregate(CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &iny)
see SumBlockModel::provide_model_aggregate(), only called if local model is active ...
MatrixFunctionOracle * oracle
points to the MatrixFunctionOracle for which it implements the cutting plane model ...
Definition: NNCModel.hxx:34
abstract interface for automatically generating and retrieving the qp blocks with the model data that...
Definition: QPModelDataObject.hxx:298
virtual MinorantPointer & provide_center_minorant()
if it cannot be provided it returns a minorant with valid()==false
virtual int make_local_aggregate(CH_Matrix_Classes::Real &new_function_factor, bool keep_penalty_fixed)
see SumBlockModel::make_model_aggregate for the general rationale; the routine is only called...
virtual int update_local_model(ModelUpdate model_update, CH_Matrix_Classes::Integer center_id, const CH_Matrix_Classes::Matrix &center_y, CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real model_maxviol, BundleProxObject &H)
see SumBlockModel::update_model(); it is called irrespective of whether the local model is active or ...
CH_Matrix_Classes::Real lb_function(CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y)
see SumBlockModel::lb_function
virtual const BundleParameters * get_bundle_parameters() const
see SumBlockModel::get_bundle_parameters
Definition: NNCModel.hxx:234
const PrimalData * get_center_primal() const
see SumBlockModel::get_center_primal
Definition: NNCModel.hxx:219
Matrix class for integral values of type Integer
Definition: indexmat.hxx:195
int call_primal_extender(PrimalExtender &prex, bool include_candidates=true)
see the last argument of FunctionOracle::evaluate()
Oracle interface (abstract class). For each of your functions, provide an instance of a derived class...
Definition: MatrixCBSolver.hxx:404
virtual int evaluate_oracle(CH_Matrix_Classes::Integer y_id, const CH_Matrix_Classes::Matrix &y, CH_Matrix_Classes::Real nullstep_bound, CH_Matrix_Classes::Real relprec)
see SumBlockModel::eval_function() but ignore ub_fid and ub with function_factor and function_task...
abstract interface extension of QPModelDataObject to allow uniform generation of tuned quadratic solv...
Definition: QPModelDataObject.hxx:144
NNCModel(MatrixFunctionOracle *fo, CH_Matrix_Classes::Real fun_factor=1., FunctionTask fun_task=ObjectiveFunction, CBout *cb=0, int cbinc=-1)
construct a model for the MatrixFunctionOracle pointed to by fo
implements (as a derived class of SumBlockModel) a standard cutting plane model for a MatrixFunctionO...
Definition: NNCModel.hxx:28
virtual MinorantPointer & provide_cand_minorant()
if it cannot be provided it returns a minorant with valid()==false
virtual void clear()
resets all data to initial status of this class, also the bundle parameters
int adapt_bundle_to_parameters(CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y)
— support routines
const PrimalData * get_candidate_primal() const
see SumBlockModel::get_candidate_primal
Definition: NNCModel.hxx:223
conic bundle method solver for sum of convex functions. See the ConicBundle_Manual for a quick introd...
Definition: CBSolver.hxx:22
virtual CH_Matrix_Classes::Integer get_modification_id() const
the value is negative if not initialized and otherwise gives the number of modifications applied to t...
Definition: BundleData.hxx:194
base class for uniform use of WARNINGS and ERRORS (at some point in time)
Definition: CBout.hxx:30
int init(const BundleData *bd)
if bd is of type NNCData, initialize to this data
ModelUpdate
for informing update_model() at what stage it is called to update the bundle so that the amount of in...
Definition: BundleModel.hxx:149
int set_data(BundleData *bd)
see SumBlockModel::set_data
Definition: NNCModel.hxx:204
virtual int local_adjust_multiplier(CH_Matrix_Classes::Real &new_function_factor)
see SumBlockModel::adjust_multiplier(); the routine is only called for adaptive penalty functions and...
Serves for specifying parameters regarding the construction of cutting models.
Definition: CBSolver.hxx:891
int set_bundle_parameters(const BundleParameters &bp)
if bp is an NNCParametersObject, it is cloned, otherwise the paraemters are copied ...
extends BundleData for use with FunctionModel by adding information on subgradients and the cutting p...
Definition: NNCData.hxx:27
abstract interface for NNCModel for the model selection routine select_model()
Definition: NNCModelParametersObject.hxx:27
const PrimalData * get_center_primal() const
return the PrimalData corresponding to the aggregate
void set_out(std::ostream *o=0, int pril=1)
set output and outputlevel of warnings and errors recursively, see CBout
Definition: SumBlockModel.hxx:680
Header declaring the class ConicBundle::NNCModelParametersObject.
ModifiableOracleObject * get_oracle_object()
returns the oracle
Definition: NNCModel.hxx:175
ModifiableOracle provides all oracles with a uniform interface for a modification routine and an on/o...
Definition: MatrixCBSolver.hxx:309
Matrix class for real values of type Real
Definition: matrix.hxx:74
int call_primal_extender(PrimalExtender &prex)
see SumBlockModel::call_primal_extender
Definition: NNCModel.hxx:227
FunctionTask
Each function represented by a FunctionModel is equipped with a function_factor (it defaults to 1...
Definition: CBSolver.hxx:221
std::vector< MinorantPointer > MinorantBundle
a bundle is a vector with MinorantPointer entries
Definition: MinorantPointer.hxx:24
virtual int switch_to_local(const MinorantBundle &sumbundle_model, const CH_Matrix_Classes::Matrix &sumbundle_coeff)
the local model has to take over after sumbundle was active; current_model holds the final model and ...
int ret_code
return value of the last call to MatrixFunctionOracle::evaluate()
Definition: NNCModel.hxx:43
virtual int start_local_augmodel(QPModelDataPointer &qpblockp, CH_Matrix_Classes::Integer cand_id, const CH_Matrix_Classes::Matrix &cand_y, const CH_Matrix_Classes::Indexmatrix *needed_indexsubset)
see SumBlockModel::start_augmodel(); the local QP block is exclusively organized here; the routine is...
const PrimalData * get_candidate_primal() const
return the PrimalData delivered by the last call of FunctionOracle::evaluate()
const BundleData * get_data() const
see SumBlockModel::get_data
Definition: NNCModel.hxx:201
const PrimalData * get_approximate_primal() const
return the PrimalData corresponding to the aggregate
~NNCModel()
calls clear() and deletes the bundle parameters
Header declaring the classes ConicBundle::MatrixCBSolver, ConicBundle::MatrixFunctionOracle, ConicBundle::PrimalMatrix, ConicBundle::MatrixMinorant, ConicBundle::ModifiableOracleObject.
provides a general abstract base class for conic cutting models with SumBundle capabilities (as a der...
Definition: ConeModel.hxx:52
In Lagrangean relaxation an approximate primal solution can be generated by supplying primal informat...
Definition: CBSolver.hxx:151
NNCModelParametersObject * model_selection
parameters for steering size and update strategy of the cutting plane model
Definition: NNCModel.hxx:39
Interface for extending PrimalData, e.g., in Lagrangian relaxation of column generation approaches...
Definition: CBSolver.hxx:180
const PrimalData * get_approximate_primal() const
see SumBlockModel::get_approximate_primal
Definition: NNCModel.hxx:215
base class for use with SumBlockModel for storing and managing essential data of evaluations and the ...
Definition: BundleData.hxx:77
MinorantBundle cand_minorants
the (eps)sugradient linear minorants returned by eval_function for the candidate (available if cand_u...
Definition: NNCData.hxx:50
Header declaring the class ConicBundle::ConeModel.
virtual bool candidate_available()
returns true if candidate information (always the results of the most recent function evaulation) is ...
Definition: NNCModel.hxx:111
BundleData * get_data()
see SumBlockModel::get_data
Definition: NNCModel.hxx:198
points to MinorantUseData that may be shared by many and allows computations with Minorants ...
Definition: MinorantPointer.hxx:34
QPConeModelDataObject * block
describes the feasible convex combinations of the bundle vectors
Definition: NNCModel.hxx:49
void set_out(std::ostream *o=0, int pril=1)
set output and outputlevel of warnings and errors recursively, see CBout
Definition: NNCModel.hxx:264
virtual void set_cbout(const CBout *cb, int incr=-1)
Specifies the output level relative to the given CBout class.
int get_ret_code() const
see SumBlockModel::get_ret_code()
Definition: NNCModel.hxx:242
CH_Matrix_Classes::Integer nr_eval
total number of oralce calls (to MatrixFunctionOracle::evaluate())
Definition: NNCModel.hxx:45