3 #include "CoinTime.hpp"
20 #ifndef BCP_DEBUG_PRINT
21 #define BCP_DEBUG_PRINT 0
35 ID(node_to_send->_index),
39 node_data_on_root_path(NULL),
40 explicit_core_level(-1),
41 explicit_var_level(-1),
42 explicit_cut_level(-1),
43 explicit_ws_level(-1),
44 explicit_all_level(-1),
110 int cnt, lclLevel, index;
113 bool has_user_data =
false;
116 assert(
root_path[lclLevel]->_index == index);
119 buf.
unpack(has_user_data);
180 std::map< int, BCP_vec<int> > tms_nodelevel;
188 std::map< int, BCP_vec<int> >::const_iterator tms;
190 for (tms = tms_nodelevel.begin(); tms != tms_nodelevel.end(); ++tms) {
195 const int size = nodelevel.
size();
197 for (i = 0; i < size; ++i) {
212 for (i = 0; i <=
level; ++i) {
227 std::map< int, BCP_vec<int> > tms_pos;
228 std::map< int, BCP_vec<int> >::const_iterator tms;
229 std::map<int, int>::iterator remote;
230 std::map<int, Coin::SmartPtr<BCP_var> >::iterator localvar;
231 std::map<int, Coin::SmartPtr<BCP_cut> >::iterator localcut;
245 const int varnum = var_inds.
size();
248 for (i = 0; i < varnum; ++i) {
251 tms_pos[remote->second].push_back(i);
263 TM: var in node description is neither local nor remote.\n");
265 for (tms = tms_pos.begin(); tms != tms_pos.end(); ++tms) {
269 const int num = pos.
size();
272 for (i = 0; i < num; ++i) {
290 const int cutnum = cut_inds.
size();
294 for (i = 0; i < cutnum; ++i) {
297 tms_pos[remote->second].push_back(i);
309 TM: cut in node description is neither local nor remote.\n");
311 for (tms = tms_pos.begin(); tms != tms_pos.end(); ++tms) {
315 const int num = pos.
size();
318 for (i = 0; i < num; ++i) {
347 pack(
node->getQuality()).pack(
node->getTrueLB()).pack(dive);
401 for (i = 0; i < cnt; ++i) {
406 for (i = 0; i < cnt; ++i) {
411 bool has_user_data = ud != 0;
412 buf.
pack(has_user_data);
417 #if (BCP_DEBUG_PRINT != 0)
419 printf(
"TM %.3lf: Sending to proc %i node: %i quality: %lf pref: %s\n",
422 node->getPreferred().str().c_str());
431 #ifdef BCP__DUMP_PROCINFO
432 #if (BCP__DUMP_PROCINFO == 1)
433 dump_procinfo(
p,
"BCP_tm_send_node()");
This class describes changes in the core of the problem.
BCP_buffer msg_buf
members to measure how long it took to process the root node.
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 stores data about how an object set (set of vars or set of cuts) changes.
BCP_buffer & pack(const T &value)
Pack a single object of type T.
virtual void update(const BCP_warmstart *const change)=0
Update the current data with the one in the argument.
BCP_obj_set_change cut_set
BCP_buffer & unpack(T &value)
Unpack a single object of type T.
int missing_cut_num
-1/nonneg unset/value : how many cut is missing
std::map< int, int > cuts_remote
pos
position where the operator should be printed when printing the expression
void clear()
Delete every entry.
Print out a message when the default version of an overridable method is executed.
std::map< int, Coin::SmartPtr< BCP_cut > > cuts_local
BCP_obj_set_change var_set
The explicit description of the vars/cuts of the parent as a BCP_obj_set_change and the vars/cuts the...
void update(const BCP_obj_set_change &objs_change)
virtual BCP_cut_algo * unpack_cut_algo(BCP_buffer &buf)
Unpack an algorithmic cut.
void pack(BCP_buffer &buf) const
Pack the core change into the buffer.
virtual BCP_user_data * unpack_user_data(BCP_buffer &buf)
Unpack an user data.
void pack(BCP_buffer &buf) const
int * child_index
at each level the index of the child in the parent's list
void reserve(const size_t n)
Reallocate the object to make space for n entries.
Warmstarting information for the LP solver.
const BCP_tm_node ** root_path
the path to the root.
The data stored is an explicit listing of values.
const int ID
An identifier of this object.
virtual void pack_warmstart(const BCP_warmstart *ws, BCP_buffer &buf, bool report_if_default=false)
Pack warmstarting information.
std::map< int, Coin::SmartPtr< BCP_var > > vars_local
void make_wrtcore_if_shorter(const BCP_problem_core_change &orig_core)
Replace the current explicitly stored core change with one stored with respect to the explicitly stor...
Coin::SmartPtr< BCP_node_change > _desc
BCP_diving_status
This enumerative constant describes the diving status of the search tree node processed by the LP pro...
The probability with which the LP process is directed to dive.
BCP_vec< Coin::SmartPtr< BCP_cut > > cuts
bool receive_cuts(BCP_buffer &buf)
return true if has everything to send the thing off to the LP.
BCP_tm_node_to_send(BCP_tm_prob &p, const BCP_tm_node *node, const BCP_message_tag tag)
The data stored is with respect to the same kind of data in the parent of the search tree node...
void clear()
Completely clear the buffer.
void pack_cut(const BCP_cut &cut)
BCP_vec< Coin::SmartPtr< BCP_var > > vars
The list of vars/cuts of the node when the changes of the node are applied to var_set and cut_set...
After branching the LP process is free to decide whether it keeps a child to dive into...
std::map< int, int > vars_remote
Coin::SmartPtr< BCP_user_data > _user
BCP_message_tag msgtag
the message tag to be used when finally the node is sent off
Currently there isn't any error handling in BCP.
BCP_message_environment * msg_env
A class that holds the methods about how to pack things.
void pack_var(const BCP_var &var)
BCP_user_pack * packer
A class that holds the methods about how to pack things.
size_t size() const
Return the current number of entries.
virtual BCP_var_algo * unpack_var_algo(BCP_buffer &buf)
Unpack an algorithmic variable.
This class describes the message buffer used for all processes of BCP.
int level
the level of node to be sent
static std::map< int, BCP_tm_node_to_send * > waiting
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
bool receive_vars(BCP_buffer &buf)
return true if has everything to send the thing off to the LP.
BCP_tm_user * user
A class that holds the methods about how to pack things.
int missing_desc_num
-1/nonneg unset/value : how many desc is missing
BCP_problem_core_change * core_as_change
BCP_tm_node_data * node_data_on_root_path
the node data on each level (well, up to the point where we have encountered an explicit description ...
void update(const BCP_problem_core_change &expl_core, const BCP_problem_core_change &core_change)
Update the current change according to core_change.
int missing_var_num
-1/nonneg unset/value : how many var is missing
virtual void display_node_information(BCP_tree &search_tree, const BCP_tm_node &node)
Display user information just before a new node is sent to the LP or diving into a node is acknowledg...
bool receive_node_desc(BCP_buffer &buf)
return true if has everything to send the thing off to the LP.
After branching the LP process must inquire of the Tree Manager whether it can dive into one of the c...
BCP_column_generation current_phase_colgen
virtual void pack_user_data(const BCP_user_data *ud, BCP_buffer &buf)
Pack an user data.
bool send()
return true or false depending on whether the node was really sent out or it's still waiting for some...
char param(BCP_tm_par::chr_params key) const
int explicit_core_level
where the various pieces start to be explicit (or wrt.
double root_node_sent_
members to measure how long it took to process the root node.