5 #include "CoinHelperFunctions.hpp"
6 #include "CoinSort.hpp"
42 int vars_to_add_size = 0;
63 printf(
"LP: Generating columns before fathoming/resolving\n");
68 std::vector<double*> dual_rays = p.
lp_solver->getDualRays(10);
69 if (dual_rays.size() > 0) {
71 for (i = dual_rays.size() - 1; i >= 0; --i) {
72 delete[] dual_rays[i];
76 BCP_lp_fathom(): infeasible but can't get a dual ray!\n");
78 vars_to_add_size = vars_to_add.
size();
79 if (vars_to_add_size == 0) {
82 LP: Fathoming node (discovered not restorable inf.)\n",
87 for (i = 0; i < vars_to_add_size; ++i) {
95 printf(
"LP: %i variables added while restoring feasibility\n",
96 static_cast<int>(vars_to_add.
size()));
108 if (vars_to_add.
size() == 0) {
111 LP: Fathoming node (discovered tdf & high cost)\n",
116 if (max_var < vars_to_add_size) {
121 for (i = 0; i < vars_to_add_size; ++i) {
122 rc[i] = (cols_to_add[i]->Objective() -
123 cols_to_add[i]->dotProduct(duals));
126 perm.
reserve(vars_to_add_size);
127 for (i = 0; i < vars_to_add_size; ++i)
130 const double rc_cutoff = rc[max_var];
132 for (i = 0, j = 0; i < vars_to_add_size; ++i) {
133 if (rc[i] <= rc_cutoff) {
145 added_size = vars_to_add.
size();
146 for (i = 0; i < added_size; ++i){
154 printf(
"LP: %i variables added in price-out (not TDF :-( )\n",
155 static_cast<int>(vars_to_add.
size()));
179 bool generated_algo_var =
false;
180 const size_t to_add = vars_to_add.
size();
188 from_fathom, vars_to_add, cols_to_add);
190 if (vars_to_add.
size() > to_add) {
191 generated_algo_var =
true;
192 if (cols_to_add.
size() > to_add) {
193 if (cols_to_add.
size() != vars_to_add.
size()) {
195 LP: uneven new_vars/new_cols sizes in BCP_price_vars().\n");
214 const std::vector<double*> dual_rays,
220 const size_t to_add = vars_to_add.
size();
223 vars_to_add, cols_to_add);
224 if (vars_to_add.
size() > to_add) {
225 if (cols_to_add.
size() > to_add) {
226 if (cols_to_add.
size() != vars_to_add.
size()) {
228 LP: uneven new_vars/new_cols sizes in BCP_restore_feasibility().\n");
int BCP_lp_send_node_description(BCP_lp_prob &p, BCP_presolved_lp_brobj *brobj, BCP_message_tag msgtag)
BCP_message_tag
This enumerative constant describes the message tags different processes of BCP understand.
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.
void clear()
Delete every entry.
char param(BCP_lp_par::chr_params key) const
int BCP_lp_next_var_index(BCP_lp_prob &p)
Do not generate columns, but send back the node to the Tree Manager for processing in the next phase...
bool BCP_lp_fathom(BCP_lp_prob &p, const bool from_repricing)
void BCP_lp_add_cols_to_lp(const BCP_vec< BCP_col * > &cols, OsiSolverInterface *lp)
The lower bound corresponding to the node is above the upper bound.
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.
iterator begin()
Return an iterator to the beginning of the object.
void reserve(const size_t n)
Reallocate the object to make space for n entries.
void BCP_price_vars(BCP_lp_prob &p, const bool from_fathom, BCP_vec< BCP_var * > &vars_to_add, BCP_vec< BCP_col * > &cols_to_add)
Print the number of variables generated before resolving the Lp ir fathoming a node.
void BCP_lp_perform_fathom(BCP_lp_prob &p, const char *msg, BCP_message_tag msgtag)
void BCP_restore_feasibility(BCP_lp_prob &p, const std::vector< double * > dual_rays, BCP_vec< BCP_var * > &vars_to_add, BCP_vec< BCP_col * > &cols_to_add)
BCP_vec< BCP_var * > new_vars
Attempt column generation.
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.
Whether to send back the description of fathomed search tree nodes to the Tree Manager.
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.
BCP_lp_cut_pool * local_cut_pool
void erase(iterator pos)
Erase the entry pointed to by pos.
BCP_lp_user * user
A class that holds the methods about how to pack things.
bool rows_are_valid() const
OsiSolverInterface * lp_solver
A class that holds the methods about how to pack things.
BCP_lp_result * lp_result
The maximum number of variables that can be added per iteration.
void insert(iterator position, const void *first, const size_t num)
Insert num entries starting from memory location first into the vector from position pos...
The lower bound corresponding to the node is above the upper bound.
Print information related to fathoming.
bool user_has_lp_result_processing
Currently there isn't any error handling in BCP.
void BCP_lp_check_ub(BCP_lp_prob &p)
void BCP_lp_clean_up_node(BCP_lp_prob &p)
The object was generated by a variable or cut generator.
size_t size() const
Return the current number of entries.
iterator end()
Return an iterator to the end of the object.
BCP_column_generation colgen
const double * pi() const
void keep_ptr_vector_by_index(BCP_vec< T * > &pvec, typename BCP_vec< int >::const_iterator first, typename BCP_vec< int >::const_iterator last)
This function keeps only the entries indexed by [first,last) from the vector of pointers pvec...
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
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.
void append(const BCP_vec< BCP_var * > &x)
Append the variables in the vector x to the end of the variable set.
This class holds the results after solving an LP relaxation.
iterator entry(const int i)
Return an iterator to the i-th entry.
void BCP_lp_delete_cols_and_rows(BCP_lp_prob &p, BCP_lp_branching_object *can, const int added_colnum, const int added_rownum, const bool from_fathom, const bool force_delete)
void append(const BCP_vec< T > &x)
Append the entries in x to the end of the vector.
BCP_vec< BCP_col * > new_cols