25 int my_id,
int parent,
double ub)
44 char *logname =
new char[len + 300];
45 memcpy(logname, log.
c_str(), len);
46 memcpy(logname + len,
"-cg-", 4);
49 len = strlen(logname);
51 sprintf(logname + len,
"%i", static_cast<int>(
GETPID));
52 logfile = freopen(logname,
"a", stdout);
54 fprintf(stderr,
"Error while redirecting stdout: %i\n", errno);
57 setvbuf(logfile, NULL, _IOLBF, 0);
60 setvbuf(stdout, NULL, _IOLBF, 0);
147 printf(
"Unknown message type arrived to CG: %i\n",
msg_buf.
msgtag());
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.
BCP_buffer & pack(const T &value)
Pack a single object of type T.
int node_index
The index of search tree node where the solution was generated.
BCP_vec< double > x
The primal values corresponding to the variables above.
Used when receiving, message with any message tag will be received.
Used to indicate that there is no message in the buffer of a process.
BCP_buffer & unpack(T &value)
Unpack a single object of type T.
int sender
The process id of the LP process that sent the solution.
virtual void receive(const int source, const BCP_message_tag tag, BCP_buffer &buf, const double timeout)=0
Blocking receive with timeout.
BCP_problem_core * core
The description of the core of the problem.
This is an abstract base class that describes the message passing environment.
BCP_process_t
This enumerative constant describes the various process types.
char entry(const chr_params key) const
const char * c_str() const
virtual BCP_user_pack * packer_init(BCP_user_class *p)
The TM sends the description of the core formulation to the slave process.
int sender() const
Return a const pointer to the process id of the sender of the message in the buffer.
This class is the central class of the Cut Generator process.
The TM sends the process type to the process (LP, Cut Generator, etc.)
void unpack(BCP_buffer &buf)
Unpack the contents of the core description from the buffer.
#define setpriority(x, y, z)
This class is a very simple impelementation of a constant length string.
bool BCP_cg_process_message(BCP_cg_prob &p, BCP_buffer &buf)
Only primal variables currently at nonzero level.
The user packed everything.
BCP_process_t BCP_cg_main(BCP_message_environment *msg_env, USER_initialize *user_init, int my_id, int parent, double ub)
bool probe_messages()
Test if there is a message in the message queue waiting to be processed.
virtual void unpack_primal_solution(BCP_buffer &buf)
Unpack the LP solution arriving from the LP process.
BCP_vec< BCP_var * > vars
Cuts are to be generated for the LP solution given by these variables and their values (next member)...
int phase
The phase the algorithm is in.
This class is an abstract base class for the initializer class the user has to provide.
BCP_user_class * user_class
A pointer ot the usr class of the process from which the methods of this class are invoked from...
#define gethostname(x, y)
The TM sends the appropriate parameters to the slave process.
The TM sends the initial user packed information to the slave process.
TM warns an LP process that the second phase will start.
void clear()
Completely clear the buffer.
BCP_message_tag msgtag() const
Return the message tag of the message in the buffer.
No more (violated) cuts could be found.
BCP_buffer msg_buf
The message buffer of the Cut Generator process.
double upper_bound
The proc id of the tree manager.
The file where the output from this process should be logged.
Currently there isn't any error handling in BCP.
Only primal variables currently at fractional level.
virtual BCP_cg_user * cg_init(BCP_cg_prob &p)
virtual void unpack_module_data(BCP_buffer &buf)
Unpack the initial information sent to the Cut Generator process by the Tree Manager.
virtual void generate_cuts(BCP_vec< BCP_var * > &vars, BCP_vec< double > &x)
Perform the actual cut generation.
int node_iteration
The iteration within the search tree node where the solution was generated.
This class describes the message buffer used for all processes of BCP.
BCP_user_pack * packer
A class that holds the methods about how to pack things.
void unpack(BCP_buffer &buf)
Unpack the parameter set from the buffer.
virtual void process_message()
BCP_message_environment * msg_env
The message passing environment.
Any process to TM or TM to any process: a new upper bound found.
virtual bool alive(const int pid)=0
Test if the process given by the argument is alive or not.
The "nice" level the process should run at.
int node_level
The level of search tree node where the solution was generated.
BCP_parameter_set< BCP_cg_par > par
The parameters controlling the Cut Generator process.
void setCgProblemPointer(BCP_cg_prob *ptr)
Set the pointer.
BCP_cg_user * user
The user object holding the user's data.
CouExpr & log(CouExpr &e)