12 int main(
int argc,
char* argv[])
15 return bcp_main(argc, argv, &mc_init);
56 for (i = 0; i <
m; ++i) {
69 if (added_cuts.
size() > 0)
76 double*
x =
new double[
m];
81 for (i = 0; i <
m; ++i)
82 x[i] = edges[i].cost > 0.0 ? 0.0 : 1.0;
92 const int grid =
static_cast<int>(sqrt(
mc.
num_nodes + 1.0));
93 const int grid_nodes = grid*grid;
96 x, 0.9, added_cuts, new_rows);
99 x, 0.9, added_cuts, new_rows);
102 sol =
new MC_solution(sig,
mc, improve_round, edge_switch, struct_switch);
107 improve_round, edge_switch, struct_switch,
108 0.9, COIN_INT_MAX, added_cuts, new_rows);
122 const int cutnum = added_cuts.
size();
123 for (j = 0, i = 1; i < cutnum; ++i) {
125 delete added_cuts[i];
126 added_cuts[i] = NULL;
133 for (j = 0, i = 0; i < cutnum; ++i) {
134 if (added_cuts[i] != NULL) {
135 added_cuts[j++] = added_cuts[i];
149 MC_tm::display_feasible_solution() invoked with non-MC_solution.\n");
153 const int grid =
static_cast<int>(sqrt(
mc.
num_nodes + 1.0));
154 const int grid_size = grid * grid;
157 for (
int i = grid_size - 1; i >= 0; --i) {
163 const double energy =
166 printf(
"MC: field: %.6f energy: %.6f\n", field, energy);
MC_solution * MC_mst_cutgen(const MC_problem &mc, const double *x, const double *w, const double alpha, const double beta, const MC_EdgeOrdering edge_ordering, const int heurswitchround, const bool do_edge_switch_heur, const int struct_switch_heur, const double minviol, const int maxnewcuts, BCP_vec< BCP_cut * > &new_cuts, BCP_vec< BCP_row * > &new_rows)
bool MC_cycle_cut_equal(const BCP_cut *bc0, const BCP_cut *bc1)
int main(int argc, char *argv[])
BCP_solution * unpack_feasible_solution(BCP_buffer &buf)
Unpack a MIP feasible solution that was packed by the BCP_lp_user::pack_feasible_solution() method...
BCP_process_t
This enumerative constant describes the various process types.
char entry(const chr_params key) const
BCP_parameter_set< MC_lp_par > lp_par
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.
Core variables are the variables that always stay in the LP formulation.
int bcp_main(int argc, char *argv[], USER_initialize *user_init)
This is the function the user must invoke when (s)he is ready to turn contrl over to BCP...
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...
void erase(iterator pos)
Erase the entry pointed to by pos.
BCP_parameter_set< MC_tm_par > tm_par
void display_feasible_solution(const BCP_solution *sol)
Display a feasible solution.
void create_root(BCP_vec< BCP_var * > &added_vars, BCP_vec< BCP_cut * > &added_cuts, BCP_user_data *&user_data)
Create the set of extra variables and cuts that should be added to the formulation in the root node...
virtual double objective_value() const
The method returning the objective value of the solution.
Currently there isn't any error handling in BCP.
size_t size() const
Return the current number of entries.
iterator end()
Return an iterator to the end of the object.
BCP_buffer & unpack(BCP_buffer &buf)
This class describes the message buffer used for all processes of BCP.
void unchecked_push_back(const_reference x)
Append x to the end of the vector.
BCP_tm_prob * getTmProblemPointer() const
Get the pointer.
void initialize_core(BCP_vec< BCP_var_core * > &vars, BCP_vec< BCP_cut_core * > &cuts, BCP_lp_relax *&matrix)
Create the core of the problem by filling out the last three arguments.
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 MC_test_ising_triangles(const int n, const int *cycles, const double *x, const double minviol, BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_row * > &rows)
iterator entry(const int i)
Return an iterator to the i-th entry.
void pack(BCP_buffer &buf)
Pack the parameter set into the buffer.
void display(const BCP_string &fname) const
void MC_test_ising_four_cycles(const int n, const int *cycles, const double *x, const double minviol, BCP_vec< BCP_cut * > &cuts, BCP_vec< BCP_row * > &rows)
bool MC_cycle_cut_less(const BCP_cut *bc0, const BCP_cut *bc1)
An object of type BCP_lp_relax holds the description of an lp relaxation.
BCP_buffer & pack(BCP_buffer &buf)
void fint fint fint real fint real * x
This is the abstract base class for a solution to a Mixed Integer Programming problem.