6 #include "CoinTime.hpp"
40 const char*
const * args)
43 for (i =
_argnum - 1; i >= 0; --i) {
48 for (i =
_argnum - 1; i >= 0; --i) {
57 for (
int i =
_argnum - 1; i >= 0; --i) {
74 #if ! defined(BCP_ONLY_LP_PROCESS_HANDLING_WORKS)
109 #if ! defined(BCP_ONLY_LP_PROCESS_HANDLING_WORKS)
112 for (
int i = _tm_prob->slaves.cp->procs().size() - 1; i >= 0; --i)
114 (std::make_pair(_tm_prob->slaves.cp->procs()[i], 0));
118 for (
int i = _tm_prob->slaves.vp->procs().size() - 1; i >= 0; --i)
120 (std::make_pair(_tm_prob->slaves.vp->procs()[i], 0));
149 _tm_prob->
lp_procs.push_back(_lp_id);
170 #if ! defined(BCP_ONLY_LP_PROCESS_HANDLING_WORKS)
175 _tm_prob->slaves.cg =
new BCP_proc_array;
176 _tm_prob->slaves.cg->add_proc(_cg_id);
177 _tm_prob->slaves.all->add_proc(_cg_id);
185 _tm_prob->slaves.vg =
new BCP_proc_array;
186 _tm_prob->slaves.vg->add_proc(_vg_id);
187 _tm_prob->slaves.all->add_proc(_vg_id);
192 _cp_prob =
new BCP_cp_prob(_cp_id, _tm_id);
195 _tm_prob->slaves.cp =
new BCP_proc_array;
196 _tm_prob->slaves.cp->add_proc(_cp_id);
197 _tm_prob->slaves.all->add_proc(_cp_id);
202 _vp_prob =
new BCP_vp_prob(_vp_id, _tm_id);
205 _tm_prob->slaves.vp =
new BCP_proc_array;
206 _tm_prob->slaves.vp->add_proc(_vp_id);
207 _tm_prob->slaves.all->add_proc(_vp_id);
222 _cg_prob->core->unpack(_tm_prob->
msg_buf);
258 _cg_prob->user = user_init->
cg_init(*_cg_prob);
260 _cg_prob->packer = user_init->
packer_init(_cg_prob->user);
261 _cg_prob->packer->
user_class = _cg_prob->user;
267 _cg_prob->user->unpack_module_data(_tm_prob->
msg_buf);
293 bool something_died =
false;
295 for ( _tm_prob->
phase = 0;
true ; ++_tm_prob->
phase) {
303 something_died =
false;
309 something_died =
true;
353 BCP_single_environment::parent_process() invoked.\n");
402 for (
int i = 0; i < num; ++i) {
403 send(targets[i], tag);
412 for (
int i = 0; i < num; ++i) {
413 send(targets[i], tag, buf);
429 printf(
"BCP_single_environment::receive() is called with %i as tag.\n",
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_problem_core * BCP_tm_create_core(BCP_tm_prob &p)
BCP_message_tag
This enumerative constant describes the message tags different processes of BCP understand.
BCP_vg_user * user
The user object holding the user's data.
BCP_parameter_set< BCP_lp_par > par
void set_arguments(const int argnum, const char *const *args)
Parameters related to scheduling the LP processes.
BCP_parameter_set< BCP_vg_par > vg
BCP_parameter_set< BCP_cg_par > cg
int start_process(const BCP_string &exe, const bool debug)
Spawn a new process.
bool alive(const int pid)
Test if the process given by the argument is alive or not.
virtual OsiSolverInterface * initialize_solver_interface()
Create LP solver environment.
virtual void pack_module_data(BCP_buffer &buf, BCP_process_t ptype)
Pack the initial information (info that the user wants to send over) for the process specified by the...
int parent_process()
Return the process id of the parent process (the process that spawned the currnet process...
Parameters related to scheduling the LP processes.
void insert(BCP_tm_node *node)
Return the worst true lower bound in the search tree.
bool start_processes(const BCP_string &exe, const int proc_num, const bool debug, int *ids)
Spawn proc_num processes, all with the same executable.
BCP_message_environment * msg_env
The message passing environment.
Indicates whether message passing is serial (all processes are on the same processor) or not...
int _sender
The process id of the sender of the last received message.
virtual BCP_user_pack * packer_init(BCP_user_class *p)
BCP_vec< std::pair< int, int > > leaves_per_cp
OsiSolverInterface * master_lp
A class that holds the methods about how to pack things.
void BCP_lp_process_core(BCP_lp_prob &p, BCP_buffer &buf)
Indicates whether message passing is serial (all processes are on the same processor) or not...
The number of Variable Generator processes that should be spawned.
This class is the central class of the Cut Generator process.
CoinSearchTreeManager candidate_list
void unpack(BCP_buffer &buf)
Unpack the contents of the core description from the buffer.
BCP_vec< BCP_tm_node * > next_phase_nodes
a vector of nodes to be processed in the next phase
void reserve(const size_t n)
Reallocate the object to make space for n entries.
Indicates whether message passing is serial (all processes are on the same processor) or not...
This class is a very simple impelementation of a constant length string.
void add_free_ids(int numIds, const int *ids)
Pass in a list of freeIds_ to add.
void setTmProblemPointer(BCP_tm_prob *ptr)
Set the pointer.
TM sends diving information.
Indicates whether message passing is serial (all processes are on the same processor) or not...
Parameters related to scheduling the LP processes.
void multicast(int num, const int *targets, const BCP_message_tag tag)
Send an empty message (message tag only) to all the processes in the process array.
void push_back(const_reference x)
Append x to the end of the vector.
virtual void process_message()=0
bool probe(const int source, const BCP_message_tag tag)
Probe if there are any messages from the given process with the given message tag.
void setVgProblemPointer(BCP_vg_prob *ptr)
Set the pointer.
void BCP_tm_parse_command_line(BCP_tm_prob &p, const int argnum, const char *const *arglist)
int numNodeIds() const
Return the number of busy LP processes.
void receive(const int source, const BCP_message_tag tag, BCP_buffer &buf, const double timeout)
Blocking receive with timeout.
BCP_node_start_result BCP_tm_start_new_nodes(BCP_tm_prob &p)
void BCP_tm_tasks_before_new_phase(BCP_tm_prob &p)
BCP_lp_user * user
A class that holds the methods about how to pack things.
The number of Cut Generator processes that should be spawned.
This class is an abstract base class for the initializer class the user has to provide.
static std::map< int, BCP_process * > processes
BCP_vec< std::pair< int, int > > leaves_per_vp
void set_entry(const chr_params key, const char val)
void pack(BCP_buffer &buf) const
Pack the contents of the core description into the buffer.
BCP_user_class * user_class
A pointer ot the usr class of the process from which the methods of this class are invoked from...
virtual void unpack_module_data(BCP_buffer &buf)
Unpack the initial information sent to the LP process by the Tree Manager.
virtual BCP_buffer & get_message_buffer()=0
void setLpProblemPointer(BCP_lp_prob *ptr)
Set the pointer.
BCP_parameter_set< BCP_tm_par > par
void clear()
Completely clear the buffer.
virtual BCP_vg_user * vg_init(BCP_vg_prob &p)
void BCP_sanity_checks(BCP_tm_prob &p)
BCP_parameter_set< BCP_vg_par > par
The parameters controlling the Variable Generator process.
void BCP_tm_wrapup(BCP_tm_prob *tm, BCP_lp_prob *lp, BCP_cg_prob *cg, BCP_vg_prob *vg, bool final_stat)
BCP_problem_core * core
The description of the core of the problem.
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.
virtual BCP_cg_user * cg_init(BCP_cg_prob &p)
BCP_user_pack * packer
A class that holds the methods about how to pack things.
virtual BCP_tm_user * tm_init(BCP_tm_prob &p, const int argnum, const char *const *arglist)
size_t size() const
Return the current number of entries.
std::vector< int > lp_procs
members to measure how long it took to process the root node.
int register_process(USER_initialize *user_init)
A process can register (receive its process id) with the message passing environment.
This class describes the message buffer used for all processes of BCP.
virtual BCP_lp_user * lp_init(BCP_lp_prob &p)
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
BCP_scheduler lp_scheduler
members to measure how long it took to process the root node.
BCP_parameter_set< BCP_lp_par > lp
BCP_tm_user * user
A class that holds the methods about how to pack things.
BCP_problem_core_change * core_as_change
The number of Variable Pool processes that should be spawned.
BCP_slave_params slave_pars
BCP_message_environment * msg_env
A class that holds the methods about how to pack things.
BCP_user_pack * packer
A class that holds the methods about how to pack things.
BCP_tm_node * BCP_tm_create_root(BCP_tm_prob &p)
Any process to TM or TM to any process: a new upper bound found.
This class is the central class of the Variable Generator process.
virtual ~BCP_single_environment()
Max how many SB nodes should the scheduler give to an LP process.
void setCgProblemPointer(BCP_cg_prob *ptr)
Set the pointer.
char param(BCP_tm_par::chr_params key) const
BCP_message_tag _msgtag
The message tag of the last received message.
The number of Cut Pool processes that should be spawned.
virtual void unpack_module_data(BCP_buffer &buf)
Unpack the initial information sent to the Variable Generator process by the Tree Manager...
void send(const int target, const BCP_message_tag tag)
Send an empty message (message tag only) to the process given by the frist argument.
BCP_user_pack * packer
A class that holds the methods about how to pack things.