BCP_lp_create_lp.cpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 
4 #include "OsiSolverInterface.hpp"
5 #include "CoinWarmStart.hpp"
6 
7 #include "BCP_matrix.hpp"
8 #include "BCP_problem_core.hpp"
9 #include "BCP_warmstart.hpp"
10 #include "BCP_lp_node.hpp"
11 #include "BCP_lp_user.hpp"
12 #include "BCP_lp_pool.hpp"
13 #include "BCP_lp.hpp"
14 #include "BCP_lp_functions.hpp"
15 
17 {
18  p.user->load_problem(*p.lp_solver, p.core, p.node->vars, p.node->cuts);
19  BCP_var_set& vars = p.node->vars;
20  BCP_cut_set& cuts = p.node->cuts;
21  const int varnum = vars.size();
22  const int cutnum = cuts.size();
23 
24  // Now fix the bounds
25  const int num = std::max<int>(varnum, cutnum);
26  BCP_vec<int> ind;
27  ind.reserve(num);
28  int i = -1;
29  while (++i < num) {
30  ind.unchecked_push_back(i);
31  }
32 
33  BCP_vec<double> bd;
34  bd.reserve(2 * num);
36  BCP_var_set::const_iterator lastvi = vars.end();
37  for ( ; vi != lastvi; ++vi) {
38  bd.unchecked_push_back((*vi)->lb());
39  bd.unchecked_push_back((*vi)->ub());
40  }
41  p.lp_solver->setColSetBounds(ind.begin(), ind.entry(varnum), bd.begin());
42 
43  bd.clear();
45  BCP_cut_set::const_iterator lastci = cuts.end();
46  for ( ; ci != lastci; ++ci) {
47  bd.unchecked_push_back((*ci)->lb());
48  bd.unchecked_push_back((*ci)->ub());
49  }
50  p.lp_solver->setRowSetBounds(ind.begin(), ind.entry(cutnum), bd.begin());
51 
52  // The rows/cols corresponding to the cached cuts/vars are not valid
53  if (p.local_cut_pool) {
55  }
56  if (p.local_var_pool) {
58  }
59 
60  //--------------------------------------------------------------------------
61  // The last step is to initialize warmstarting if we can. After
62  // warmstarting info is used up we won't need it again. If there will be any
63  // warmstarting info needed regarding this node, that info is what we'll
64  // get at the end of processing the node. So delete the current ws info.
65  if (p.node->warmstart) {
66  CoinWarmStart* ws = p.node->warmstart->convert_to_CoinWarmStart();
67  p.lp_solver->setWarmStart(ws);
68  delete ws;
69  delete p.node->warmstart;
70  p.node->warmstart = 0;
71  }
72 }
BCP_lp_node * node
Description he current search tree node.
Definition: BCP_lp.hpp:168
void clear()
Delete every entry.
BCP_var_set vars
Abstract base class that defines members common to all types of cuts.
Definition: BCP_cut.hpp:29
iterator begin()
Return an iterator to the beginning of the object.
Definition: BCP_vector.hpp:99
NO OLD DOC.
Definition: BCP_lp.hpp:102
This class is just a collection of pointers to cuts with a number of methods to manipulate these cuts...
Definition: BCP_cut.hpp:279
void reserve(const size_t n)
Reallocate the object to make space for n entries.
BCP_cut_set cuts
BCP_lp_cut_pool * local_cut_pool
Definition: BCP_lp.hpp:193
BCP_lp_user * user
A class that holds the methods about how to pack things.
Definition: BCP_lp.hpp:131
BCP_warmstart * warmstart
bool rows_are_valid() const
Definition: BCP_lp_pool.hpp:59
OsiSolverInterface * lp_solver
A class that holds the methods about how to pack things.
Definition: BCP_lp.hpp:137
void BCP_lp_create_lp(BCP_lp_prob &p)
virtual CoinWarmStart * convert_to_CoinWarmStart() const =0
Return an OsiWarmStart object that can be fed to the LP engine.
BCP_lp_var_pool * local_var_pool
Definition: BCP_lp.hpp:191
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real * ws
Abstract base class that defines members common to all types of variables.
Definition: BCP_var.hpp:28
size_t size() const
Return the current number of entries.
Definition: BCP_vector.hpp:116
iterator end()
Return an iterator to the end of the object.
Definition: BCP_vector.hpp:104
This class is just a collection of pointers to variables with a number of methods to manipulate these...
Definition: BCP_var.hpp:316
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
BCP_problem_core * core
Definition: BCP_lp.hpp:153
bool cols_are_valid() const
virtual void load_problem(OsiSolverInterface &osi, BCP_problem_core *core, BCP_var_set &vars, BCP_cut_set &cuts)
Load the problem specified by core, vars, and cuts into the solver interface.