9 #include "OsiClpSolverInterface.hpp"
20 #include "CoinFinite.hpp"
22 #ifndef BM_DEBUG_PRINT
23 #define BM_DEBUG_PRINT 0
70 OsiSolverInterface* solver = NULL;
75 OsiClpSolverInterface * clp =
new OsiClpSolverInterface;
76 OsiBabSolver babSolver(3);
77 babSolver.setSolver(clp);
78 clp->setAuxiliaryInfo(&babSolver);
79 clp->messageHandler()->setLogLevel(0);
115 const int numObj = nlp.numberObjects();
116 OsiObject** nlpObj = nlp.objects();
117 for (i = 0; i < numObj; ++i) {
118 OsiSimpleInteger* io =
dynamic_cast<OsiSimpleInteger*
>(nlpObj[i]);
120 io->resetBounds(&nlp);
128 osi->addObjects(nlp.numberObjects(), nlp.objects());
156 if (in_strong_branching) {
189 #if (BM_DEBUG_PRINT != 0)
190 printf(
"LP %.3f: Solution found. node: %i depth: %i value: %f\n",
217 if (osi->isProvenPrimalInfeasible() ) {
222 OsiBabSolver * babSolver =
223 dynamic_cast<OsiBabSolver *
> (osi->getAuxiliaryInfo());
227 const int numvar = vars.
size();
228 double* solverSol =
new double[numvar];
229 double objValue = 1e200;
232 if (babSolver->solution(objValue, solverSol, numvar)) {
235 for (
int i = 0 ; i < numvar ; i++) {
269 rand = 1 - CoinDrand48();
270 if(i->frequency > rand){
271 i->cgl->generateCuts(si,
cuts_, info);
277 int numCuts =
cuts_.sizeRowCuts();
278 for(
int i = 0 ; i < numCuts ; i++) {
279 const OsiRowCut& cut =
cuts_.rowCut(i);
281 const CoinPackedVector& row = cut.row();
298 const int numCuts = cuts.
size();
299 for (
int i = 0; i < numCuts; ++i) {
304 const CoinPackedVector& row = cut->row();
327 return CoinMax(bd, old_lower_bound);
BCP_object_origin
This enumerative constant describes the origin (originating process) of an object (variable or cut)...
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)
Convert (and possibly lift) a set of cuts into corresponding rows for the current LP relaxation...
This class describes the core of the MIP problem, the variables/cuts in it as well as the matrix corr...
void setOsiBabSolver(OsiBabSolver *ptr)
void fint fint fint real fint real real real real real real real real real fint real fint fint fint real fint fint fint fint * info
virtual BCP_solution * test_feasibility(const BCP_lp_result &lp_result, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts)
Evaluate and return MIP feasibility of the current solution.
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.
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
OsiSolverInterface * clone(bool copyData=true) const
Virtual copy constructor.
double node_start_time
The time when we started to process the node.
int current_level() const
Return the level of the search tree node being processed.
int current_index() const
Return the internal index of the search tree node being processed.
double start_time() const
Return when the LP process started.
This class is just a collection of pointers to cuts with a number of methods to manipulate these cuts...
void push_back(const_reference x)
Append x to the end of the vector.
The BCP_lp_user class is the base class from which the user can derive a problem specific class to be...
void set_objective_value(double v)
Set the objective value of the solution.
virtual void modify_lp_parameters(OsiSolverInterface *lp, bool in_strong_branching)
int numNlpFailed_
A counter for how many times in a row did the NLP code fail.
virtual void setColUpper(int elementIndex, double elementValue)
Set a single column upper bound.
Bonmin::Algorithm getAlgorithm()
Get the algorithm used.
virtual OsiSolverInterface * initialize_solver_interface()
Create LP solver environment.
Bonmin::BonminAmplSetup bonmin_
This contains the setup for running Bonmin in particular nlp solver, continuous solver, cut generators,...
int * infInd_
Every time when branching decisions are to be made, we create 6 arrays, 3 for those objects that are ...
int numNlpFailed_
A counter for how many times in a row did the NLP code fail.
BCP_solution * test_feasibility_hybrid(const BCP_lp_result &lp_result, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts)
BCP_user_data * get_user_data()
Return a pointer to the BCP_user_data structure the user (may have) stored in this node...
double primalTolerance() const
Return the primal tolerance of the solver.
void fint fint fint real fint real real real real real real real real real fint real fint * lp
BCP_lp_prob * getLpProblemPointer()
Get the pointer.
OsiSolverInterface * lp_solver
A class that holds the methods about how to pack things.
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 > &vs, const BCP_vec< BCP_obj_status > &cs, BCP_vec< int > &var_changed_pos, BCP_vec< double > &var_new_bd, BCP_vec< int > &cut_changed_pos, BCP_vec< double > &cut_new_bd)
Initializing a new search tree node.
Simple representation of a cut by storing non zero coefficients only.
void add_entry(BCP_var *var, double value)
Append a variable and the corresponding value to the end of the appropriate vectors.
int * objInd_
These are the indices of the integral (i.e., things that can be branched on) objects in the solver...
Currently there isn't any error handling in BCP.
size_t size() const
Return the current number of entries.
virtual void generate_cuts_in_lp(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_cut * > &new_cuts, BCP_vec< BCP_row * > &new_rows)
Generate cuts within the LP process.
This class is just a collection of pointers to variables with a number of methods to manipulate these...
OsiTMINLPInterface * nonlinearSolver()
Pointer to the non-linear solver used.
BCP_solution * test_feasibility_BB(const BCP_lp_result &lp_result, const BCP_vec< BCP_var * > &vars)
BM_SB_result * sbResult_
This is where we keep the results in case of distributed strong branching.
This class holds the results after solving an LP relaxation.
virtual double compute_lower_bound(const double old_lower_bound, const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts)
Compute a true lower bound for the subproblem.
virtual void setColLower(int elementIndex, double elementValue)
Set a single column lower bound.
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.
This class holds a MIP feasible primal solution.
CuttingMethods & cutGenerators()
list of cutting planes methods to apply with their frequencies.
BCP_solution_generic * test_full(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const double etol) const
Test whether the variables specified as integers are really integer.
This class holds a row in a compressed form.
This is the abstract base class for a solution to a Mixed Integer Programming problem.