OS_lp.cpp
Go to the documentation of this file.
1 /* $Id: OS_lp.cpp 2907 2009-09-06 07:26:05Z kmartin $ */
2 // Last edit: 6/23/06
3 //
4 // Name: OS_lp.cpp
5 // Author: Francois Margot
6 // Tepper School of Business
7 // Carnegie Mellon University, Pittsburgh, PA 15213
8 // email: fmargot@andrew.cmu.edu
9 // Date: 12/28/03
10 //-----------------------------------------------------------------------------
11 // Copyright (C) 2003, Francois Margot, International Business Machines
12 // Corporation and others. All Rights Reserved.
13 
14 #undef HEUR_SOL
15 
16 #include <vector>
17 
18 #include "OS_lp.hpp"
19 #include "OS_cut.hpp"
20 #include "OS_var.hpp"
21 #include "OsiClpSolverInterface.hpp"
22 #include "CglSimpleRounding.hpp"
23 #include "CglKnapsackCover.hpp"
24 
25 #include "BCP_math.hpp"
26 #include "BCP_lp.hpp"
27 #include "BCP_problem_core.hpp"
28 #include "BCP_lp_param.hpp"
29 
30 using namespace std;
31 
32 /************************************************************************/
33 void
35 {
36  buf.unpack( os_prob);
37  EPS = os_prob->EPSILON;
44  // just a simple test
45 
46  std::cout << "number of variables " << os_prob->osinstance->getVariableNumber() << std::endl;
47 
48 
49 
50 }
51 
52 
53 
54 /************************************************************************/
55 OsiSolverInterface * OS_lp::initialize_solver_interface(){
56 
57  OsiClpSolverInterface * clp = new OsiClpSolverInterface;
58  clp->messageHandler()->setLogLevel(0);
59  return clp;
60 }
61 
62 /************************************************************************/
64  const BCP_vec<BCP_cut*>& cuts,
65  const BCP_vec<BCP_obj_status>& vstatus,
66  const BCP_vec<BCP_obj_status>& cstatus,
67  BCP_vec<int>& var_changed_pos,
68  BCP_vec<double>& var_new_bd,
69  BCP_vec<int>& cut_changed_pos,
70  BCP_vec<double>& cut_new_bd)
71 
72  // Called at the beginning of the optimization of a node.
73  // The node LP is not yet solved.
74 
75 {
76  in_strong = 0;
77 
78  //BCP_lp_param.hpp for a list of parameters
79  //lets get a parameter -- should be true by default
81  std::cout << relSol << std::endl;
82 
83  // now reset the value
84  if(relSol == true){
86  }else{
88  }
89 
90  // see if it got reset
92  std::cout << relSol << std::endl;
93 
94 
95  //set another way
96  // number of cuts to keep in the pool
97  //this->getLpProblemPointer()->par.set_entry(BCP_lp_par::IneffectiveBeforeDelete, 10000);
98 
99  // turn off strong branching
100  //this->getLpProblemPointer()->par.set_entry(BCP_lp_par::MaxPresolveIter, -1);
101 
102 
103 #ifdef USER_DATA
104  MY_user_data *curr_ud = dynamic_cast<MY_user_data*> (get_user_data());
105  curr_ud->is_processed = 1;
106 #endif
107 
108 }
109 
110 /************************************************************************/
111 void OS_lp::modify_lp_parameters(OsiSolverInterface* lp, bool in_strong_branching){
112 
113  // Called each time the node LP is solved
114 
115 
116  /****
117  *
118  * BCP_lp_param.hpp for param doc.
119  * BCP_lp_param.cpp for default values.
120  * to change a param in your user class: getLpProblemPointer()->par.set_entry(LpVerb_RelaxedSolution, false);
121  * to change a param in bb.par: BCP_LpVerb_RelaxedSolution 0
122  *
123  */
124 
125 
126 
127  // if (in_strong_branching) {
128  // in_strong = 1;
129  // lp->setIntParam(OsiMaxNumIterationHotStart, 50);
130  // }
131 
132  // write the current LP in file lpnode.lp
133  //lp->writeLp("lpnode", "lp");
134  //cout << "LP node written in file lpnode.lp" << endl;
135 
136  // to write the current LP file in file lpnode.mps use the following:
137  // lp->writeMps("lpnode", "mps", 0.0);
138  // cout << "LP node written in file lpnode.mps" << endl;
139 
140 }
141 
142 
143 
144 /************************************************************************/
146  const BCP_vec<BCP_var*>& vars,
147  const BCP_vec<BCP_cut*>& cuts) {
148  //not implemented
149  return NULL;
150 }
151 
152 
153 /********************************************************************/
155  const BCP_vec<BCP_var*>& vars,
156  const BCP_vec<BCP_cut*>& cuts,
157  const BCP_lp_var_pool& local_var_pool,
158  const BCP_lp_cut_pool& local_cut_pool,
160  bool force_branch) {
161 
162 
163  // Called at the end of each iteration. Possible return values are:
164  // BCP_DoNotBranch_Fathomed : The node should be fathomed without branching
165  // BCP_DoNotBranch : BCP should continue to work on this node
166  // BCP_DoBranch : Branching must be done. In this case the
167  // method returns the branching object candidates
168  // in one of the arguments
169 
170  std::cout << "INSIDE BRANCHING DECISION: TESTING VARIABLE TYPES " << std::endl;
171  std::cout << "SIZE OF VARS = " << vars.size() << std::endl;
172  std::cout << "SIZE OF LOCAL VAR POOL = " << local_var_pool.size() << std::endl;
173  std::cout << "CANDS SIZE = " << cands.size() << std::endl;
174 
175 
177  //const double intTol = 1e-5;
178  int num_vars = vars.size();
179 
180  //for(int i = 0; i < num_vars; i++){
181  // std::cout << "lower = " << vars[ i]->lb() << std::endl;
182  // std::cout << "upper = " << vars[ i]->ub() << std::endl;
183 
184  //}
185 
186  // if no colums were generated use default branching
187  //if(local_var_pool.size() == 0) return BCP_lp_user::select_branching_candidates( lpres,
188  // vars, cuts, local_var_pool, local_cut_pool, cands, force_branch);
189 
190 
191  // Don't branch if cutting planes have been generated
192 
193  if( local_cut_pool.size() > 0 ) {
194 
195  cout << "select_branching_candidates() returns BCP_DoNotBranch" << endl;
196 
197  return(BCP_DoNotBranch);
198  }
199  else {
200  // Branch on the first fractional non-continous variable
201  int i;
202  const double *x = lpres.x();
203  BCP_vec<int> select_pos;
204 
205  for(i = 0; i < num_vars; i++) {
206 
207  //std::cout << "TESTING VARIABLE " << i << " FOR BRANCHING" << std::endl;
208  //std::cout << "VALUE = " << x[i] << std::endl;
209  //std::cout << "x[i] -floor( x[i]) = " << x[i] -floor( x[i]) << std::endl;
210  //std::cout << "x[i] -floor( x[i]) = " << ceil( x[i]) - x[i] << std::endl;
211 
212  if( vars[ i]->var_type() < 2) {
213  if((x[i] -floor( x[i]) > intTol) && (ceil( x[i]) - x[i] > intTol)) {
214  select_pos.push_back(i);
215 
216  // put in cands all variables whose index are in select_pos
217 
218  append_branching_vars( lpres.x(), vars, select_pos, cands);
219 
220  cout << "Branching on variable: " << i << " (" << x[i] << ") depth: " << current_level() << endl;
221  break;
222  }
223  }
224  }
225 
226  if (cands.size() == 0 && local_var_pool.size() == 0) {
227  throw BCP_fatal_error("select_banching_candidate() : No cut in pool but couldn't select branching variable.\n");
228  //return BCP_DoNotBranch_Fathomed;
229  }
230 
231  if (cands.size() == 0 && local_var_pool.size() > 0) {// none of the current variables are fractional so don't branch
232 
233  return BCP_DoNotBranch;
234  }
235 
236  cout << "select_branching_candidates() returns BCP_DoBranch" << endl;
237 
238  return BCP_DoBranch;
239  }
240 
241 }
242 
243 
244 /**************************************************************************/
246  const int selected)
247 
248  // Given the branching decision (parameter "best"; "selected" is the
249  // index of the chosen branching decision in the candidate list),
250  // set the user data for the children.
251 
252 {
253 #ifdef USER_DATA
254  BCP_lp_branching_object *cand = best->candidate();
255  MY_user_data *curr_ud = dynamic_cast<MY_user_data*> (get_user_data());
256  real_user_data *curr_rud = curr_ud->p_rud;
257 
258  for(int i=0; i<cand->child_num; i++) {
259  MY_user_data *ud = new MY_user_data(curr_rud->max_card_set_zero);
260  real_user_data *rud = ud->p_rud;
261 
262  rud->card_set_zero = curr_rud->card_set_zero;
263 
264  for(int j=0; j<curr_rud->card_set_zero; j++) {
265  rud->set_zero[j] = curr_rud->set_zero[j];
266  }
267 
268  int ind_br = (*(cand->forced_var_pos))[0];
269 
270  if((*(cand->forced_var_bd))[2*i + 1] < EPS) {
271  rud->set_zero[curr_rud->card_set_zero] = ind_br;
272  (rud->card_set_zero)++;
273  }
274  best->user_data()[i] = ud;
275  }
276 #endif /* USER_DATA */
277 } /* set_user_data_for_children */
278 
279 
280 
281 
282 
283 /************************************************************************/
284 
285 
286 void OS_lp::cuts_to_rows(const BCP_vec<BCP_var*>& vars, // on what to expand
287  BCP_vec<BCP_cut*>& cuts, // what to expand
288  BCP_vec<BCP_row*>& rows, // the expanded rows
289  // things that the user can use for lifting cuts if allowed
290  const BCP_lp_result& lpres,
291  BCP_object_origin origin, bool allow_multiple) {
292 
293  // Required function when indexed or algorithmic cuts are used.
294  // Describes how to get a row of the matrix from the representation of the
295  // cut.
296  std::cout << "Execute cuts_to_rows" << std::endl;
297  const int cutnum = cuts.size();
298  for (int i=0; i<cutnum; ++i) {
299  const OsiRowCut* bcut = dynamic_cast<const OS_cut*>(cuts[i]);
300  if (bcut) {
301 
302  rows.push_back(new BCP_row(bcut->row(), bcut->lb(), bcut->ub()));
303  continue;
304  }
305  throw BCP_fatal_error("Unknown cut type in cuts_to_rows.\n");
306  }
307 }
308 
309 /************************************************************************/
310 
312  BCP_vec<BCP_var*>& vars,
313  BCP_vec<BCP_col*>& cols,
314  const BCP_lp_result& lpres,
315  BCP_object_origin origin, bool allow_multiple)
316 {
317 
318  std::cout << "EXECUTE vars_to_cols **************" << std::endl;
319  static const CoinPackedVector emptyVector(false);
320  const int numvars = vars.size();
321  int i;
322  for (i = 0; i < numvars; ++i) {
323  const OS_var* v = dynamic_cast<const OS_var*>(vars[i]);
324  // Since we do not generate cuts, we can just disregard the "cuts"
325  // argument, since the column corresponding to the var is exactly
326  // the flow (plus the entry in the appropriate convexity
327  // constraint)
328  BCP_col* col = new BCP_col(v->coinPackedVec, v->weight, 0.0, 1.0);
329  //col->insert(data.numarcs + v->commodity, 1.0);
330 
331  cols.push_back( col);
332  // Excercise: if we had generated cuts, then the coefficients for
333  // those rows would be appended to the end of each column
334  }
335 }
336 
337 
338 /************************************************************************/
340  const BCP_vec<BCP_var*>& vars,
341  const BCP_vec<BCP_cut*>& cuts,
342  const double old_lower_bound,
343  double& true_lower_bound,
344  BCP_solution*& sol,
345  BCP_vec<BCP_cut*>& new_cuts,
346  BCP_vec<BCP_row*>& new_rows,
347  BCP_vec<BCP_var*>& new_vars,
348  BCP_vec<BCP_col*>& new_cols){
349 
350 
351  generated_cuts = false;
352  generated_vars = false;
353 
354 
355 #if 1
356 
357  {
358 
359  OsiClpSolverInterface* my_lp_solver;
360 
361  my_lp_solver = dynamic_cast<OsiClpSolverInterface *>(getLpProblemPointer()->lp_solver);
362 
363 
364  //try a simple knapsack cut
365  //CglSimpleRounding rounding;
366  CglKnapsackCover knapCover;
367 
368  //CoinRelFltEq eq(0.0001);
369  OsiSolverInterface::ApplyCutsReturnCode acRc;
370  OsiCuts my_cuts;
371 
372  //my_lp_solver = (getLpProblemPointer()->lp_solver);
373  double epsilon = .1;
374  int i, k;
375 
376 
377  // generate the knapsack constraints
378  knapCover.generateCuts(*my_lp_solver, my_cuts);
379  const double *x = lpres.x();
380 
381  CoinPackedVector pv;
382  int *pvIndexes = NULL;
383  double *pvElements = NULL;
384  int numElem;
385  double lhs = 0;
386  OS_cut* cut;
387  int ncuts = my_cuts.sizeRowCuts();
388  const OsiRowCut **newRowCuts = new const OsiRowCut * [ncuts];
389  std::cout << "sizeRowCuts() = " << ncuts << std::endl;
390  for(i = 0; i < ncuts; i++) {
391  newRowCuts[i] = &my_cuts.rowCut(i);
392  cut = new OS_cut( *newRowCuts[i]);
393  // do not add cut if not violated -- kipp add a test
394  //cout <<" rhs = " << newRowCuts[i]->rhs() << endl;
395  cout <<" sense = " << newRowCuts[i]->sense() << endl;
396  pv = newRowCuts[i]->row();
397  pvIndexes = pv.getIndices();
398  pvElements = pv.getElements();
399  numElem = pv.getNumElements();
400 
401  lhs = 0;
402  for(k = 0; k < numElem; k++){
403  lhs += pvElements[ k]*x[ pvIndexes[k] ];
404  //std::cout << pvElements[ k] << std::endl;
405  }
406 
407  if( (newRowCuts[i]->sense() == 'L') && (lhs > newRowCuts[i]->rhs() +epsilon ) ){
408  cout <<" lhs - rhs = " << lhs - newRowCuts[i]->rhs() << endl;
409  std::cout << "PUSHING BACK KNAPSACK COVER ROUNDING CUT" << std::endl;
410  algo_cuts.push_back( cut);
411  }
412  }
413 
414  generated_cuts = (algo_cuts.size() > 0);
415  for(i = 0; i < ncuts; i++){
416  //delete newRowCuts[ i];
417  }
418  delete[] newRowCuts;
419  }// end Cgl cut generation scope
420 
421 #endif
422 
423 #if 0
424 
425  {
426  int i;
427  int num_vars = vars.size();
428  const double *x = lpres.x();
429  OsiRowCut* rcut = new OsiRowCut();
430  // the cut column indexes
431  int *cutind = new int[ num_vars];
432  // number of nonzeros in the cut
433  int cut_nz;
434 
435  //we are just playing around here -- say the sum of the rhs cannot exceed 503.77
436  double cutrhs = 503.77;
437  //cutrhs = 7000;
438  // the cut coefficients
439  double *cutcoef = new double[ num_vars];
440  double lhs = 0;
441  for(i=0; i < num_vars; i++) {
442  cutcoef[ i] = 1;
443  cutind[ i] = i;
444  cut_nz = num_vars;
445  lhs += x[ i];
446  }
447  std::cout << "The LHS IS EQUAL TO === " << lhs << std::endl;
448 
449 
450  if(lhs > cutrhs + EPS) {
451 
452  // cut is violated -- add it
453  rcut->setLb(-BCP_DBL_MAX);
454  rcut->setUb( cutrhs);
455  rcut->setRow( cut_nz, cutind, cutcoef);
456  OS_cut* cut = new OS_cut( *rcut);
457  algo_cuts.push_back( cut);
458  std::cout << "WE ARE ADDING A CUT!!!!!!!! " << std::endl;
459  }
460  delete rcut;
461  delete[] cutind;
462  delete[] cutcoef;
463  generated_cuts = (algo_cuts.size() > 0);
464  }// end user cut generation scope
465 
466 #endif
467 
468 #if 0
469  { // variable generation scope
470  const double* pi = lpres.pi();
471  int numNonz = 4;
472  int varIdx = vars.size();
473  int* ind = new int[ numNonz];
474  double* val = new double[ numNonz];
475  double objVal = -13.0;
476  double reducedCost = 0.0;
477  int i;
478 
479  ind[ 0] = 0;
480  ind[ 1] = 1;
481  ind[ 2] = 2;
482  ind[ 3] = 3;
483 
484  val[ 0] = 1.0;
485  val[ 1] = 1.0;
486  val[ 2] = 1.0;
487  val[ 3] = 1.0;
488 
489  for(i = 0 ; i < numNonz; i++){
490  reducedCost += -pi[ i]*val[ i];
491  }
492  reducedCost += objVal;
493  std::cout << "REDUCED COST = ************** " << reducedCost << std::endl;
494 
495  if(reducedCost < -.01 && vars.size() < 3) {
496  std::cout << "CALL OS_var CONSTRUCTOR " << std::endl;
497  algo_vars.push_back(new OS_var(varIdx, CoinPackedVector(numNonz, ind, val, true), objVal));
498  std::cout << "DONE WITH CALL OS_var CONSTRUCTOR " << std::endl;
499  }
500 
501  delete[] val;
502  delete[] ind;
503 
504 
505  generated_vars = (algo_vars.size() > 0);
506  }// end variable generation scope
507 
508 #endif
509 
510 
511  //end of generated variables
512 
513 
514  // if no cuts or vars were found call the old method
515  if( (generated_vars == false) && (generated_cuts == false) ){
516  BCP_lp_user::process_lp_result(lpres, vars, cuts,
517  old_lower_bound, true_lower_bound, sol, new_cuts,
518  new_rows, new_vars, new_cols);
519  return;
520  }
521 
522  int i;
523  // add the cuts
524 
525  if (generated_cuts) {
526  new_cuts.append( algo_cuts);
527 
528  // now convert the generated cuts into rows
529 
530  int cutnum = algo_cuts.size();
531 
532  for (i = 0; i < cutnum; ++i) {
533 
534 
535  const OsiRowCut* bcut = dynamic_cast<const OS_cut*>(algo_cuts[i]);
536 
537  if (bcut) {
538  new_rows.push_back(new BCP_row(bcut->row(), bcut->lb(), bcut->ub()));
539  //delete algo_cuts[ i];
540  }
541  else{
542  throw BCP_fatal_error("Unknown cut type in cuts_to_rows.\n");
543  }
544  }
545 
546 
547  //delete algo_cuts[0];
548  algo_cuts.clear();
549  }
550 
551  // add the vars
552 
553 
554  if (generated_vars) {
555  new_vars.append( algo_vars);
556 
557 
558 
559  //convert the generated variables to columns
560 
561  static const CoinPackedVector emptyVector(false);
562  const int numvars = algo_vars.size();
563  for (i = 0; i < numvars; ++i) {
564  const OS_var* v = dynamic_cast<const OS_var*>(algo_vars[i]);
565  // Since we do not generate cuts, we can just disregard the "cuts"
566  // argument, since the column corresponding to the var is exactly
567  // the flow (plus the entry in the appropriate convexity
568  // constraint)
569  BCP_col* col = new BCP_col(v->coinPackedVec, v->weight, 0.0, 1.0);
570  //col->insert(data.numarcs + v->commodity, 1.0);
571 
572  new_cols.push_back( col);
573  // Excercise: if we had generated cuts, then the coefficients for
574  // those rows would be appended to the end of each column
575  }
576 
577 
578  algo_vars.clear();
579 
580  std::cout << "GENERATED VARS IS TRUE ************** " << std::endl;
581  true_lower_bound = old_lower_bound;
582  } else {
583  std::cout << "GENERATED VARS IS FALSE ************** " << std::endl;
584  true_lower_bound = lpres.objval();
585  }
586  std::cout << "TRUE LOWER BOUND ************** " << true_lower_bound << std::endl;
587 }
588 
589 
590 
591 /************************************************************************/
592 
593 
595  const BCP_vec<BCP_var*>& vars,
596  const BCP_vec<BCP_cut*>& cuts,
597  const bool final_lp_solution){
598 
599 
600  BCP_lp_user::display_lp_solution( lpres, vars, cuts,
601  final_lp_solution);
602  return;
603 
604  bool relSol = false;
605  unsigned int i;
606  double ietol;
609 
610  const double *x = lpres.x();
611  if( relSol == true){
612  for (i = 0; i < vars.size(); ++i) {
613  if(x[ i] > ietol) std::cout << x[ i] << std::endl;
614  }
615  }
616 
617 // kipp write OSrL here?
618 // if final_lp_solution is true print out some osrl.
619 }
620 
621 
622 
BCP_object_origin
This enumerative constant describes the origin (originating process) of an object (variable or cut)...
Definition: BCP_enum.hpp:249
char get_param(const BCP_lp_par::chr_params key) const
Definition: BCP_lp_user.cpp:51
Simple representation of a cut by storing non zero coefficients only.
Definition: OS_cut.hpp:17
Values not further from an integer value than the value of this parameter are considered to be intege...
This class holds a column in a compressed form.
Definition: BCP_matrix.hpp:26
virtual BCP_solution * generate_heuristic_solution(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts)
Simple rounding heuristic.
Definition: OS_lp.cpp:145
virtual void process_lp_result(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const double old_lower_bound, double &true_lower_bound, BCP_solution *&sol, BCP_vec< BCP_cut * > &new_cuts, BCP_vec< BCP_row * > &new_rows, BCP_vec< BCP_var * > &new_vars, BCP_vec< BCP_col * > &new_cols)
Process the result of an iteration.
BCP_buffer & unpack(T &value)
Unpack a single object of type T.
Definition: BCP_buffer.hpp:186
void set_param(const BCP_lp_par::chr_params key, const bool val)
Definition: BCP_lp_user.cpp:63
Turn on the user hook &quot;display_lp_solution&quot;.
double weight
Definition: OS_var.hpp:17
BCP should continue to work on this node.
const double * x() const
int * set_zero
Variables that have been set to zero by branching decisions.
virtual BCP_branching_decision select_branching_candidates(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const BCP_lp_var_pool &local_var_pool, const BCP_lp_cut_pool &local_cut_pool, BCP_vec< BCP_lp_branching_object * > &cands, bool force_branch=false)
Called at the end of each iteration.
Definition: OS_lp.cpp:154
BCP_vec< double > * forced_var_bd
Contains the actual bounds for the variables indexed by forced_var_pos.
static const CouNumber pi
Definition: exprCos.cpp:23
void push_back(const_reference x)
Append x to the end of the vector.
static char * j
Definition: OSdtoa.cpp:3622
real_user_data * p_rud
Pointer on an object holding the user data itself.
#define BCP_DBL_MAX
Definition: BCP_math.hpp:6
BCP_vec< BCP_user_data * > & user_data()
Return a reference to the user data vector.
virtual void process_lp_result(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const double old_lower_bound, double &true_lower_bound, BCP_solution *&sol, BCP_vec< BCP_cut * > &new_cuts, BCP_vec< BCP_row * > &new_rows, BCP_vec< BCP_var * > &new_vars, BCP_vec< BCP_col * > &new_cols)
Process the result of an iteration.
Definition: OS_lp.cpp:339
void fint fint fint real fint real real real real real real real real real fint real fint * lp
virtual void display_lp_solution(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const bool final_lp_solution)
Test feasibility of the LP solution.
Definition: OS_lp.cpp:594
int card_set_zero
Number of variables set to zero by branching descisions.
int child_num
The number of children for this branching object.
Class handling user data.
double objval() const
void fint fint * k
This class describes a generic branching object.
BCP_branching_decision
This enumerative constant is the return value of the select_branching_candidates() method in [BCP_lp_...
Class taking care of interaction between user data and Bcp.
virtual void unpack_module_data(BCP_buffer &buf)
Unpack data sent from the tree manager.
Definition: OS_lp.cpp:34
virtual void cuts_to_rows(const BCP_vec< BCP_var * > &vars, BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_row * > &rows, const BCP_lp_result &lpres, BCP_object_origin origin, bool allow_multiple)
Describes how to get a row of the matrix from the representation of the cut.
Definition: OS_lp.cpp:286
BCP_vec< int > * forced_var_pos
Positions of variables whose bounds change (&quot;forcibly&quot;, by branching) in the children.
Currently there isn&#39;t any error handling in BCP.
Definition: BCP_error.hpp:20
virtual void display_lp_solution(const BCP_lp_result &lp_result, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const bool final_lp_solution)
Display the result of most recent LP optimization.
int is_processed
Indicator for mmory management: If is_processed = 1, the associated user data may be erased...
A presolved branching object candidate.
size_t size() const
Return the current number of entries.
Definition: BCP_vector.hpp:116
virtual OsiSolverInterface * initialize_solver_interface()
Pack algorithmic cuts.
Definition: OS_lp.cpp:55
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
const double * pi() const
virtual void initialize_new_search_tree_node(const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const BCP_vec< BCP_obj_status > &var_status, const BCP_vec< BCP_obj_status > &cut_status, BCP_vec< int > &var_changed_pos, BCP_vec< double > &var_new_bd, BCP_vec< int > &cut_changed_pos, BCP_vec< double > &cut_new_bd)
Initialize data members at the start of processing a new subproblem.
Definition: OS_lp.cpp:63
virtual void set_user_data_for_children(BCP_presolved_lp_brobj *best, const int selected)
Set up the user data for the children according to the chosen branching object.
Definition: OS_lp.cpp:245
int max_card_set_zero
Maximum number of variables that may be set to zero by branching decisions.
CoinPackedVector coinPackedVec
Definition: OS_var.hpp:15
This class holds the results after solving an LP relaxation.
Branching must be done.
virtual void modify_lp_parameters(OsiSolverInterface *lp, bool in_strong_branching)
Modify the parameters of the LP solver.
Definition: OS_lp.cpp:111
BCP_lp_branching_object * candidate()
Return a pointer to the candidate.
void append(const BCP_vec< T > &x)
Append the entries in x to the end of the vector.
Definition: BCP_vector.hpp:169
virtual void vars_to_cols(const BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_var * > &vars, BCP_vec< BCP_col * > &cols, const BCP_lp_result &lpres, BCP_object_origin origin, bool allow_multiple)
Convert a set of variables into corresponding columns for the current LP relaxation.
Definition: OS_lp.cpp:311
void fint fint fint real fint real * x
This class holds a row in a compressed form.
Definition: BCP_matrix.hpp:152
This is the abstract base class for a solution to a Mixed Integer Programming problem.