7 #include "CoinHelperFunctions.hpp"
8 #include "CoinTime.hpp"
41 va_start(valist, format);
42 vprintf(format, valist);
107 nonzeros.
reserve(last - first);
109 for ( ; current != last; ++current)
110 if (CoinAbs(*current) > etol)
120 for ( ; current != last; ++current)
121 if (CoinAbs(*current) <= etol)
129 positives.
reserve(last - first);
131 for ( ; current != last; ++current)
140 fractions.
reserve(last - first);
142 for ( ; current != last; ++current)
143 if (*current-floor(*current) > etol && ceil(*current)-*current > etol)
154 "LP: Default unpack_module_data() executed.\n");
195 BCP_lp_user::broadcast_message: can't broadcast from an LP process.\n");
204 BCP_lp_user::process_message() invoked but not overridden!\n");
213 BCP_lp_user::initialize_solver_interface() invoked but not overridden!\n");
237 "LP: Default initialize_new_search_tree_node() executed.\n");
246 const int varnum = vars.
size();
247 const int cutnum = cuts.
size();
251 throw BCP_fatal_error(
"There are no vars in the description for node %i!\n",
257 throw BCP_fatal_error(
"There are no cuts in the description for node %i!\n",
264 int bvarnum = core->
varnum();
265 int bcutnum = core->
cutnum();
267 if (varnum == 0 || cutnum == 0){
268 throw BCP_fatal_error(
"No rows or no cols to create a matrix from!\n");
284 for ( ; ci != lastci; ++ci) {
303 for ( ; vi != lastvi; ++vi) {
323 if (bvarnum > 0 && bcutnum > 0) {
328 if (varnum > bvarnum && bcutnum > 0) {
340 if (cutnum > bcutnum) {
342 rows.
reserve(added_cuts.size());
361 if (dumpcuts || dumpvars) {
362 printf(
"LP: NEW ACTIVE NODE %i DUMP START ===========================\n",
365 printf(
" Core Vars (bvarnum %i)\n", bvarnum);
366 for (
int i = 0; i < bvarnum; ++i) {
367 printf(
" var %4i: bcpind %i, status %i, lb %f, ub %f\n",
368 i, vars[i]->bcpind(), vars[i]->status(),
369 vars[i]->lb(), vars[i]->ub());
373 printf(
" Core Cuts (bcutnum %i)\n", bcutnum);
374 for (
int i = 0; i < bcutnum; ++i) {
375 printf(
" cut %4i: bcpind %i, status %i, lb %f, ub %f\n",
376 i, cuts[i]->bcpind(), cuts[i]->status(),
377 cuts[i]->lb(), cuts[i]->ub());
381 printf(
" Extra Vars (extra varnum %i)\n", varnum - bvarnum);
382 for (
int i = bvarnum; i < varnum; ++i) {
383 printf(
" var %4i: bcpind %i, status %i, lb %f, ub %f\n",
384 i, vars[i]->bcpind(), vars[i]->status(),
385 vars[i]->lb(), vars[i]->ub());
389 printf(
" Extra Cuts (extra cutnum %i)\n", cutnum - bcutnum);
390 for (
int i = bcutnum; i < cutnum; ++i) {
391 printf(
" cut %4i: bcpind %i, status %i, lb %f, ub %f\n",
392 i, cuts[i]->bcpind(), cuts[i]->status(),
393 cuts[i]->lb(), cuts[i]->ub());
396 printf(
"LP: NEW ACTIVE NODE %i DUMP END ===========================\n",
405 bool in_strong_branching)
408 "LP: Default prepare_for_optimization() executed.\n");
410 if (changeType == 1) {
411 lp->setHintParam(OsiDoDualInResolve,
true, OsiHintTry);
414 if (changeType == 2) {
415 lp->setHintParam(OsiDoDualInResolve,
false, OsiHintTry);
419 lp->setHintParam(OsiDoDualInResolve,
true, OsiHintIgnore);
427 const double old_lower_bound,
428 double& true_lower_bound,
449 return old_lower_bound;
462 return p->
ub() + 1
e-5;
468 return old_lower_bound;
479 "LP: Default test_feasibility() executed.\n");
502 const double etol)
const
505 "LP: Default test_binary() executed.\n");
512 const double *
x = lpres.
x();
513 const int varnum = vars.
size();
514 const double etol1 = 1 - etol;
517 for (i = 0 ; i < varnum; ++i) {
518 const double xi = x[i];
519 if (xi > etol && xi < etol1)
526 for (i = 0 ; i < varnum; ++i) {
529 obj += vars[i]->obj();
539 const double etol)
const
542 "LP: Default test_integral() executed.\n");
549 const double *
x = lpres.
x();
550 const int varnum = vars.
size();
551 const double etol1 = 1 - etol;
554 for (i = 0 ; i < varnum; ++i) {
555 const double val = x[i] - floor(x[i]);
556 if (val > etol && val < etol1)
563 for (i = 0 ; i < varnum; ++i) {
564 const double val = floor(x[i] + 0.5);
568 obj += val * vars[i]->obj();
578 const double etol)
const
581 "LP: Default test_full() executed.\n");
588 const double *
x = lpres.
x();
589 const int varnum = vars.
size();
590 const double etol1 = 1 - etol;
593 for (i = 0 ; i < varnum; ++i) {
594 switch (vars[i]->var_type()){
597 const double val = x[i];
598 if (val > etol && val < etol1)
604 const double val = x[i] - floor(x[i]);
605 if (val > etol && val < etol1)
617 for (i = 0 ; i < varnum; ++i) {
620 x[i] : floor(x[i] + 0.5);
621 if (val < -etol || val > etol) {
623 obj += val * vars[i]->obj();
638 "LP: Default generate_heuristic_solution() executed.\n");
647 "LP: Default pack_feasible_solution() executed.\n");
653 const int size = solvars.
size();
655 for (
int i = 0; i < size; ++i) {
659 buf.
pack(gensol->objective_value());
672 "LP: Default pack_for_cg() executed.\n");
677 const double *
x = lpres.
x();
678 const int varnum = vars.
size();
690 coll.reserve(varnum);
691 for (
int i = 0; i < varnum; ++i) {
692 coll.unchecked_push_back(i);
700 const int size = coll.size();
705 while (++pos != last_pos) {
722 "LP: Default pack_for_vg() executed.\n");
727 const double *
pi = lpres.
pi();
728 const int cutnum = cuts.
size();
736 coll.reserve(cutnum);
737 for (
int i = 0; i < cutnum; ++i) {
738 coll.unchecked_push_back(i);
746 const int size = coll.size();
751 while (++pos != last_pos) {
764 const bool final_lp_solution)
767 "LP: Default display_lp_solution() executed.\n");
769 if (final_lp_solution) {
772 print(
true,
" LP : Displaying LP solution (FinalRelaxedSolution) :\n");
776 print(
true,
" LP : Displaying LP solution (RelaxedSolution) :\n");
781 print(
true,
" LP : Displaying solution :\n");
783 const double *
x = lpres.
x();
785 const int size = coll.
size();
786 for (
int i = 0; i < size; ++i) {
787 const int ind = coll[i];
788 vars[ind]->display(x[ind]);
796 const std::vector<double*> dual_rays,
803 "LP: Default restore_feasibility() executed.\n");
819 "LP: Default cuts_to_rows() executed.\n");
833 "LP: Default vars_to_cols() executed.\n");
847 "LP: Default generate_cuts_in_lp() executed.\n");
854 const bool before_fathom,
859 "LP: Default generate_vars_in_lp() executed.\n");
866 "LP: Default compare_cuts() executed.\n");
874 "LP: Default compare_vars() executed.\n");
884 const bool before_fathom,
889 const int varnum = vars.
size();
906 const bool before_fathom,
911 const int cutnum = cuts.
size();
913 const double lb = lpres.
objval();
921 lb_at_cutgen[i] < lb - 0.0001)) {
935 const int var_bound_changes_since_logical_fixing,
940 "LP: Default logical_fixing() executed.\n");
950 if (babSolver && !babSolver->reducedCostsAccurate())
957 if (! atZero && ! atAny)
961 p->
lp_solver->getDblParam(OsiPrimalTolerance, petol);
963 p->
lp_solver->getDblParam(OsiDualTolerance, detol);
970 const int varnum = vars.
size();
972 changed_indices.
reserve(varnum);
974 changed_bounds.
reserve(2 * varnum);
982 for (
int i = 0; i < varnum; ++i) {
986 const double lb = var->
lb();
987 const double new_ub = lb + floor(gap / dj[i]);
988 if (new_ub < var->ub() && (atAny || CoinAbs(x[i])<petol) ) {
989 vars[i]->set_ub(new_ub);
994 }
else if (dj[i] < -detol) {
995 const double ub = var->
ub();
996 const double new_lb = ub - floor(gap / (-dj[i]));
997 if (new_lb > var->
lb() && (atAny || CoinAbs(x[i])<petol) ) {
998 vars[i]->set_lb(new_lb);
1006 newly_changed = changed_indices.
size();
1007 if (newly_changed > 0) {
1009 changed_indices.
end(),
1010 changed_bounds.
begin());
1019 OsiSolverInterface* solver,
1020 OsiChooseVariable* choose,
1021 OsiBranchingObject*& branchObject,
1024 int returnStatus = 0;
1025 int numUnsatisfied = choose->setupList(&branchInfo,
true);
1026 choose->setBestObjectIndex(-1);
1027 if (numUnsatisfied > 0) {
1028 if (choose->numberOnList() == 0) {
1030 if (choose->numberOnList() > 0 || choose->numberStrong() == 0) {
1032 choose->setBestObjectIndex(choose->candidates()[0]);
1035 numUnsatisfied = choose->setupList(&branchInfo,
false);
1036 if (numUnsatisfied > 0) {
1037 choose->setBestObjectIndex(choose->candidates()[0]);
1042 int ret = choose->chooseVariable(solver, &branchInfo, allowVarFix);
1045 const double * clb = solver->getColLower();
1046 const double * cub = solver->getColUpper();
1048 for (
int i = numUnsatisfied - 1; i >= 0; --i) {
1050 solver->object(choose->candidates()[i])->columnNumber();
1052 assert(vars[ind]->lb() <= clb[ind]);
1053 assert(vars[ind]->ub() >= cub[ind]);
1054 vars[ind]->set_lb_ub(clb[ind], cub[ind]);
1067 }
else if (ret == -1) {
1070 }
else if (ret == 0) {
1076 numUnsatisfied = choose->setupList(&branchInfo,
false);
1077 if (numUnsatisfied > 0) {
1078 choose->setBestObjectIndex(choose->candidates()[0]);
1083 if (! returnStatus) {
1084 if (numUnsatisfied > 0) {
1087 const OsiObject * obj = solver->object(choose->bestObjectIndex());
1088 branchObject = obj->createBranch(solver,
1094 return returnStatus;
1109 "LP: Default select_branching_candidates() executed.\n");
1114 LP: ############ LP solver abandoned. Branching through...\n");
1119 if (! force_branch &&
1120 (local_var_pool.
size() > 0 || local_cut_pool.
size() > 0))
1127 OsiBranchingInformation brInfo(lp,
true,
true);
1128 lp->getDblParam(OsiDualObjectiveLimit, brInfo.cutoff_);
1131 brInfo.numberSolutions_ = 0;
1132 brInfo.numberBranchingSolutions_ = 0;
1135 OsiChooseStrong* strong =
new OsiChooseStrong(lp);
1136 strong->setNumberBeforeTrusted(5);
1138 strong->setTrustStrongForSolution(
false);
1144 strong->setShadowPriceMode(0);
1146 OsiChooseVariable * choose = strong;
1147 OsiBranchingObject* brObj = NULL;
1149 bool allowVarFix =
true;
1157 const int bestWhichWay = choose->bestWhichWay();
1161 if (choose->goodSolution()
1162 &&model->problemFeasibility()->feasible(model,-1)>=0) {
1164 double objValue = choose->goodObjectiveValue();
1165 model->setBestSolution(CBC_STRONGSOL,
1167 choose->goodSolution()) ;
1168 model->setLastHeuristic(NULL);
1169 model->incrementUsed(choose->goodSolution());
1170 choose->clearGoodSolution();
1200 BCP: BCP_lp_user::try_to_branch returned with unknown return code.\n");
1205 if (allowVarFix && brResult < 0) {
1206 const double* clb = lp->getColLower();
1207 const double* cub = lp->getColUpper();
1211 int numvars = vars.
size();
1212 for (
int i = 0; i < numvars; ++i) {
1213 vars[i]->change_bounds(clb[i], cub[i]);
1218 int order[2] = {0, 1};
1219 if (bestWhichWay == 1) {
1225 OsiIntegerBranchingObject* intBrObj =
1226 dynamic_cast<OsiIntegerBranchingObject*
>(brObj);
1231 OsiSOSBranchingObject* sosBrObj =
1232 dynamic_cast<OsiSOSBranchingObject*
>(brObj);
1240 if (cands.
size() == 0) {
1242 LP : No var/cut in pool but couldn't select branching object.\n");
1258 for (spi = select_pos.
begin(); spi != select_pos.
end(); ++spi) {
1259 const int pos = *spi;
1261 vbd[0] = vars[
pos]->lb();
1262 vbd[1] = floor(x[pos]);
1263 vbd[2] = ceil(x[pos]);
1264 vbd[3] = vars[
pos]->ub();
1279 "LP: Default compare_presolved_branching_objects() executed.\n");
1291 if (! old_presolved)
1303 const double objetol = 1
e-7;
1307 std::sort(new_obj.
begin(), new_obj.
end());
1308 const int new_not_fathomed =
1309 new_obj.
index(std::lower_bound(new_obj.
begin(), new_obj.
end(),
1314 std::sort(old_obj.
begin(), old_obj.
end());
1315 const int old_not_fathomed =
1316 old_obj.
index(std::lower_bound(old_obj.
begin(), old_obj.
end(),
1319 if (new_not_fathomed < old_not_fathomed)
1322 if (new_not_fathomed > old_not_fathomed)
1335 for ( ; new_first != new_last; ++new_first) {
1337 newavg += *new_first;
1339 newavg /= new_not_fathomed;
1341 for ( ; old_first != old_last; ++old_first) {
1343 oldavg += *old_first;
1345 oldavg /= old_not_fathomed;
1349 return (high && newavg > oldavg) || (!high && newavg < oldavg)?
1354 for ( ; new_first != new_last && old_first != old_last;
1355 ++new_first, ++old_first) {
1356 if (*new_first < *old_first - objetol)
1358 if (*new_first > *old_first + objetol)
1361 return old_first == old_last ?
1365 for ( ; new_first != new_last && old_first != old_last;
1366 ++new_first, ++old_first) {
1367 if (*new_first > *old_first + objetol)
1369 if (*new_first < *old_first - objetol)
1372 return old_first == old_last ?
1376 while (new_first != new_last && old_first != old_last) {
1379 if (*new_last < *old_last - objetol)
1381 if (*new_last > *old_last + objetol)
1384 return old_first == old_last ?
1388 while (new_first != new_last && old_first != old_last) {
1391 if (*new_last > *old_last + objetol)
1393 if (*new_last < *old_last - objetol)
1396 return old_first == old_last ?
1400 Unknown branching object comparison rule.\n");
1405 throw BCP_fatal_error(
"No branching object comparison rule is chosen.\n");
1416 "LP: Default set_actions_for_children() executed.\n");
1470 *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***\n\
1471 You have overridden\n\
1472 BCP_lp_user::set_user_data_for_children(BCP_presolved_lp_brobj* best)\n\
1473 which is a deprecated virtual function. Please override\n\
1474 BCP_lp_user::set_user_data_for_children(BCP_presolved_lp_brobj* best,\n\
1475 const int selected)\n\
1476 instead. The old version will go away, your code will still compile, but it\n\
1477 will not do what you intend it to be doing.\n\
1478 *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING *** WARNING ***\n"\
1489 "LP: Default set_user_data_for_children() executed.\n");
1499 "LP: Default purge_slack_pool() executed.\n");
1507 const int size = slack_pool.
size();
1510 for (
int i = 0; i < size; ++i)
BCP_object_origin
This enumerative constant describes the origin (originating process) of an object (variable or cut)...
size_t index(const_iterator pos) const
Return the index of the entry pointed to by pos.
char get_param(const BCP_lp_par::chr_params key) const
int_params
Integer parameters.
How many times in a row a constraint must be found ineffective before it is marked for deletion...
Values not further from an integer value than the value of this parameter are considered to be intege...
void BCP_lp_add_rows_to_lp(const BCP_vec< BCP_row * > &rows, OsiSolverInterface *lp)
const BCP_vec< double > & RowLowerBound() const
A const reference to the vector of lower bounds on the cuts.
BCP_message_tag
This enumerative constant describes the message tags different processes of BCP understand.
virtual void send(const int target, const BCP_message_tag tag)=0
Send an empty message (message tag only) to the process given by the frist argument.
This class describes the core of the MIP problem, the variables/cuts in it as well as the matrix corr...
This child should be kept and dived into (provided diving is decided on.
If true the BCP will attempt to do reduced cost fixing for any variable, no matter what is their curr...
BCP_parameter_set< BCP_lp_par > par
str_params
String parameters.
BCP_buffer & pack(const T &value)
Pack a single object of type T.
Specifies which built-in MIP feasibility testing routine should be invoked (if a buit-in routine is u...
int get_process_id() const
BCP_lp_node * node
Description he current search tree node.
void print(const bool ifprint, const char *format,...) const
A method to print a message with the process id.
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.
int parent() const
the process id of the parent
Mainly for binary choices: take the down branch unconditionally.
virtual void process_message(BCP_buffer &buf)
Process a message that has been sent by another process' user part to this process' user part...
bool is_fixed() const
Return whether the variable is fixed or not.
virtual OsiSolverInterface * initialize_solver_interface()
Create LP solver environment.
virtual double objective_value() const =0
The method returning the objective value of the solution.
Keep the child that has the highest presolved objective value.
virtual void receive(const int source, const BCP_message_tag tag, BCP_buffer &buf, const double timeout)=0
Blocking receive with timeout.
pos
position where the operator should be printed when printing the expression
char param(BCP_lp_par::chr_params key) const
Pack only those variables that are currently at nonzero levels.
BCP_feasibility_test
This enumerative constant describes which built-in feasibility-testing routine should be invoked...
Print out a message when the default version of an overridable method is executed.
void select_fractions(const double *first, const double *last, const double etol, BCP_vec< int > &fractions) const
Select all fractional entries.
If true the BCP will attempt to do reduced cost fixing only for variables currently at zero...
The problem is feasible if all non-continuous variables are integral.
void reduced_cost_fixing(const double *dj, const double *x, const double gap, BCP_vec< BCP_var * > &vars, int &newly_changed)
Reduced cost fixing.
double granularity() const
Specifies the rule used for built-in branching object comparison (if the buit-in routine is used at a...
Abstract base class that defines members common to all types of cuts.
virtual BCP_branching_object_relation compare_branching_candidates(BCP_presolved_lp_brobj *new_solved, BCP_presolved_lp_brobj *old_solved)
Decide which branching object is preferred for branching.
OsiBabSolver * getOsiBabSolver()
Pack only those variables that are currently at fractional (i.e., non-integral) levels.
void BCP_lp_add_cols_to_lp(const BCP_vec< BCP_col * > &cols, OsiSolverInterface *lp)
Indicates what part of the primal solution is sent to the Cut Generator process if the BCP_lp_user::p...
"new" is better, discard "old".
BCP_lp_relax * matrix
A pointer to the constraint matrix corresponding to the core variables and cuts.
BCP_process_t
This enumerative constant describes the various process types.
This class exist only so that we can extract information from OsiIntegerBranchingObject.
char entry(const chr_params key) const
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.
Maximum allowed running time.
void set_param(const BCP_lp_par::chr_params key, const bool val)
Purge the slack cuts at every iteration while processing search tree nodes.
int current_level() const
Return the level of the search tree node being processed.
Turn on the user hook "display_lp_solution".
virtual void generate_vars_in_lp(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const bool before_fathom, BCP_vec< BCP_var * > &new_vars, BCP_vec< BCP_col * > &new_cols)
Generate variables within the LP process.
int current_index() const
Return the internal index of the search tree node being processed.
iterator begin()
Return an iterator to the beginning of the object.
BCP should continue to work on this node.
double start_time() const
Return when the LP process started.
bool had_numerical_problems() const
Return true if at least one child had numerical difficulties while presolving.
virtual void initialize_int_and_sos_list(std::vector< OsiObject * > &intAndSosObjects)
Create the list of objects that can be used for branching (simple integer vars and SOS sets)...
This class is just a collection of pointers to cuts with a number of methods to manipulate these cuts...
void pack_var(const BCP_var &var)
void reserve(const size_t n)
Reallocate the object to make space for n entries.
virtual void pack_primal_solution(BCP_buffer &buf, const BCP_lp_result &lp_result, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts)
Pack the information necessary for cut generation into the buffer.
Pack only dual variables currently at nonzero level.
int current_iteration() const
Return the iteration count within the search tree node being processed.
const BCP_vec< double > & ColUpperBound() const
A const reference to the vector of upper bounds on the variables.
This class is a very simple impelementation of a constant length string.
int current_phase() const
Return the phase the algorithm is in.
The problem is feasible if all primal variables take values 0 or 1.
bool fathomable(const double objval_limit) const
Return true if every children can be fathomed.
static const CouNumber pi
void push_back(const_reference x)
Append x to the end of the vector.
Only primal variables currently at nonzero level.
void broadcast_message(const BCP_process_t proc_type, const BCP_buffer &buf)
Broadcast the message to all processes of the given type.
BCP_solution_generic * test_integral(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const double etol) const
Test whether all variables are integer.
"new" is better and it's so good that even if there are more candidates forget them and use "new" a...
virtual void purge_slack_pool(const BCP_vec< BCP_cut * > &slack_pool, BCP_vec< int > &to_be_purged)
Selectively purge the list of slack cuts.
void send_message(const int target, const BCP_buffer &buf, BCP_message_tag tag=BCP_Msg_User)
Send a message to a particular process.
size_t varnum() const
Return the number of variables in the core.
Attempt column generation.
The problem is feasible if all primal variables are integral.
virtual void restore_feasibility(const BCP_lp_result &lpres, const std::vector< double * > dual_rays, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_var * > &vars_to_add, BCP_vec< BCP_col * > &cols_to_add)
Restoring feasibility.
virtual void set_actions_for_children(BCP_presolved_lp_brobj *best)
Decide what to do with the children of the selected branching object.
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.
void fint fint fint real fint real real real real real real real real real * e
void get_lower_bounds(BCP_vec< double > &obj)
Fill up obj with the lower bound on each child.
bool is_non_removable() const
Return whether the cut marked as NotRemovable.
double ub() const
Return the upper bound.
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.
virtual BCP_object_compare_result compare_vars(const BCP_var *v0, const BCP_var *v1)
Compare two generated variables.
void fint fint fint real fint real real real real real real real real real fint real fint * lp
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)
Decide whether to branch or not and select a set of branching candidates if branching is decided upon...
"old" is better, discard "new".
Purge the slack cuts when the LP starts processing a new search tree node.
virtual BCP_object_compare_result compare_cuts(const BCP_cut *c0, const BCP_cut *c1)
Compare two generated cuts.
OsiSolverInterface * lp_solver
A class that holds the methods about how to pack things.
void set_entry(const chr_params key, const char val)
BCP_lp_result * lp_result
void set_msgtag(const BCP_message_tag tag)
Set the message tag on the buffer.
int child_num
The number of children for this branching object.
Specifies how many branching variables with values close to half between two integers should be chose...
Pack only those variables that are currently at nonzero levels.
void append_branching_vars(const double *x, const BCP_vec< BCP_var * > &vars, const BCP_vec< int > &select_pos, BCP_vec< BCP_lp_branching_object * > &candidates)
This helper method creates branching variable candidates and appends them to cans.
size_t cutnum() const
Return the number of cuts in the core.
The slack cut discarding strategy used in the default version of the function purge_slack_pool().
BCP_solution_generic * test_binary(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const double etol) const
Test whether all variables are 0/1.
void select_positives(const double *first, const double *last, const double etol, BCP_vec< int > &positives) const
Select all positive entries.
This class describes a generic branching object.
virtual BCP_solution * generate_heuristic_solution(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts)
Try to generate a heuristic solution (or return one generated during cut/variable generation...
virtual void unpack_module_data(BCP_buffer &buf)
Unpack the initial information sent to the LP process by the Tree Manager.
BCP_vec< double > lb_at_cutgen
BCP_branching_decision
This enumerative constant is the return value of the select_branching_candidates() method in [BCP_lp_...
chr_params
Character parameters.
void clear()
Completely clear the buffer.
const BCP_vec< double > & Objective() const
A const reference to the vector of objective coefficients.
const BCP_lp_result & lpres(const int child_ind) const
Return a const reference to the presolved results of the child_ind-th child.
BCP_var_t var_type() const
Return the integrality type of the variable.
bool over_ub(double lb) const
virtual void select_vars_to_delete(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const bool before_fathom, BCP_vec< int > &deletable)
void add_entry(BCP_var *var, double value)
Append a variable and the corresponding value to the end of the appropriate vectors.
const BCP_vec< double > & ColLowerBound() const
A const reference to the vector of lower bounds on the variables.
virtual void logical_fixing(const BCP_lp_result &lpres, 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, const int var_bound_changes_since_logical_fixing, BCP_vec< int > &changed_pos, BCP_vec< double > &new_bd)
This method provides an opportunity for the user to tighten the bounds of variables.
bool is_non_removable() const
Return whether the variable is marked NotRemovable.
void pack_cut(const BCP_cut &cut)
double upper_bound() const
Return what is the best known upper bound (might be BCP_DBL_MAX)
The object is from the Tree Manager.
Abstract base class that defines members common to all types of variables.
int effective_count() const
Return the effectiveness count of the cut (only in LP process).
bool user_has_lp_result_processing
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.
Currently there isn't any error handling in BCP.
Only primal variables currently at fractional level.
Indicates what part of the dual solution is sent to the Variable Generator process if the BCP_lp_user...
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.
The node should be fathomed without even trying to branch.
A presolved branching object candidate.
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...
virtual int try_to_branch(OsiBranchingInformation &branchInfo, OsiSolverInterface *solver, OsiChooseVariable *choose, OsiBranchingObject *&branchObject, bool allowVarFix)
Select the "close-to-half" variables for strong branching.
virtual void select_cuts_to_delete(const BCP_lp_result &lpres, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts, const bool before_fathom, BCP_vec< int > &deletable)
static bool abort_on_error
size_t size() const
Return the current number of entries.
void receive_message(const int sender, BCP_buffer &buf, BCP_message_tag tag=BCP_Msg_User)
Wait for a message and receive it.
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.
iterator end()
Return an iterator to the end of the object.
void select_zeros(const double *first, const double *last, const double etol, BCP_vec< int > &zeros) const
Select all zero entries.
BCP_column_generation colgen
This class is just a collection of pointers to variables with a number of methods to manipulate these...
Whether we should refrain from compressing the problem description right before a fathomed node's des...
virtual void set_user_data_for_children(BCP_presolved_lp_brobj *best, const int selected)
For each child create a user data object and put it into the appropriate entry in best->user_data()...
After branching all children must be returned to the Tree Manager and the LP process should wait for ...
This class describes the message buffer used for all processes of BCP.
const double * pi() const
Turn on the user hook "display_lp_solution" for the last LP relaxation solved at a search tree node...
double _objective
The objective value of the solution.
Keep the child that has the lowest presolved objective value.
double dualTolerance() const
Return the dual tolerance of the solver.
The two objects are not comparable or neither is better than the other.
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
double lb() const
Return the lower bound.
void purge_ptr_vector(BCP_vec< T * > &pvec, typename BCP_vec< T * >::iterator first, typename BCP_vec< T * >::iterator last)
This function purges the entries [first,last) from the vector of pointers pvec.
Mainly for binary choices: take the up branch unconditionally.
BCP_branching_object_relation
This enumerative constant is the return value of the compare_presolved_branching_objects() method in ...
BCP_vec< BCP_child_action > & action()
Return a reference to the actions to be taken.
Specifies the rule used for selecting one of the children of the search tree node for diving...
This class exist only so that we can extract information from OsiIntegerBranchingObject.
BCP_message_environment * msg_env
A class that holds the methods about how to pack things.
BCP_user_data * user_data
Data the user wants to pass along with the search tree node.
This class holds the results after solving an LP relaxation.
Pack all primal variables.
iterator entry(const int i)
Return an iterator to the i-th entry.
bool over_ub(double lb) const
Return true / false depending on whether the lb argument is over the current upper bound or not...
virtual void pack_dual_solution(BCP_buffer &buf, const BCP_lp_result &lp_result, const BCP_vec< BCP_var * > &vars, const BCP_vec< BCP_cut * > &cuts)
Pack the information necessary for variable generation into the buffer.
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.
virtual void pack_feasible_solution(BCP_buffer &buf, const BCP_solution *sol)
Pack a MIP feasible solution into a buffer.
bool is_to_be_removed() const
Return whether the cut must be removed from the formulation.
BCP_lp_branching_object * candidate()
Return a pointer to the candidate.
This class holds a MIP feasible primal solution.
void send_feasible_solution(const BCP_solution *sol)
const BCP_vec< double > & RowUpperBound() const
A const reference to the vector of upper bounds on the cuts.
void fake_objective_values(const double itlim_objval)
Examine the termination codes for the children and for those that do not have a valid lower bound fak...
virtual void modify_lp_parameters(OsiSolverInterface *lp, const int changeType, bool in_strong_branching)
Modify parameters of the LP solver before optimization.
dbl_params
Double parameters.
General integer variable.
BCP_object_compare_result
This enumerative constant describes the possible outcomes when comparing two objects (variables or cu...
An object of type BCP_lp_relax holds the description of an lp relaxation.
void select_nonzeros(const double *first, const double *last, const double etol, BCP_vec< int > &nonzeros) const
Select all nonzero entries.
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.
The message contains a new MIP feasible solution.
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)
Initializing a new search tree node.
void fint fint fint real fint real * x
bool is_to_be_removed() const
Return whether the variable must be removed from the formulation.
This is the abstract base class for a solution to a Mixed Integer Programming problem.
int process_id() const
What is the process id of the current process.
bool using_deprecated_set_user_data_for_children