00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef _MASTER_H
00016 #define _MASTER_H
00017
00018 #define COMPILING_FOR_MASTER
00019
00020 #include <stdio.h>
00021
00022 #include "symphony.h"
00023 #include "sym_types.h"
00024 #include "sym_macros.h"
00025 #include "sym_master_params.h"
00026 #ifdef COMPILE_IN_TM
00027 #include "sym_tm.h"
00028 #endif
00029
00030
00031
00032
00033
00034
00035 typedef struct SYM_ENVIRONMENT{
00036 void *user;
00037 int my_tid;
00038 int tm_tid;
00039 int dg_tid;
00040 params par;
00041 prob_times comp_times;
00042
00043 char has_ub;
00044 double ub;
00045 lp_sol best_sol;
00046 char has_mc_ub;
00047 double mc_ub;
00048 double obj[2];
00049 double utopia[2];
00050 char has_ub_estimate;
00051 double ub_estimate;
00052 double lb;
00053 double obj_offset;
00054
00055 MIPdesc *mip;
00056
00057 char probname[81];
00058
00059 base_desc *base;
00060 node_desc *rootdesc;
00061
00062 int termcode;
00063
00064 warm_start_desc *warm_start;
00065
00066 double mc_time;
00067
00068 #ifdef COMPILE_IN_TM
00069 tm_prob *tm;
00070 #ifdef COMPILE_IN_CP
00071 cut_pool **cp;
00072 #endif
00073 #endif
00074 }sym_environment;
00075
00076
00077
00078
00079
00080 void usage PROTO((void));
00081 void version PROTO((void));
00082 int parse_command_line PROTO((sym_environment *env, int argc, char **argv));
00083 void read_string PROTO((char *target, char *line, int maxlen));
00084 void print_statistics PROTO((node_times *tim, problem_stat *stat, double ub,
00085 double lb, double initial_time,
00086 double start_time, double finish_time,
00087 double obj_offset, char obj_sense, char has_ub));
00088
00089
00090
00091
00092
00093 int initialize_u PROTO((sym_environment *env));
00094 int free_master_u PROTO((sym_environment *env));
00095 int readparams_u PROTO((sym_environment *env, int argc, char **argv));
00096 int io_u PROTO((sym_environment *env));
00097 int init_draw_graph_u PROTO((sym_environment *env));
00098 int start_heurs_u PROTO((sym_environment *env));
00099 int display_solution_u PROTO((sym_environment *env, int thread_num));
00100 int initialize_root_node_u PROTO((sym_environment *env));
00101 int receive_feasible_solution_u PROTO((sym_environment *env, int msgtag));
00102 int send_lp_data_u PROTO((sym_environment *env, int sender));
00103 int send_cg_data_u PROTO((sym_environment *env, int sender));
00104 int send_cp_data_u PROTO((sym_environment *env, int sender));
00105 int send_sp_data_u PROTO((sym_environment *env, int sender));
00106 int process_own_messages_u PROTO((sym_environment *env, int msgtag));
00107
00108
00109
00110
00111
00112 int resolve_node PROTO((sym_environment *env, bc_node * node));
00113 void update_tree_bound PROTO((sym_environment *env, bc_node *root,
00114 int change_type));
00115 void update_branching_decisions PROTO((sym_environment *env, bc_node *root,
00116 int change_type));
00117 void cut_ws_tree_index PROTO((sym_environment *env, bc_node *root, int index,
00118 problem_stat * stat, int change_type));
00119 void cut_ws_tree_level PROTO((sym_environment *env, bc_node *root, int level,
00120 problem_stat * stat, int change_type));
00121 void ws_free_subtree PROTO((sym_environment *env, bc_node *root,
00122 int change_type, int check_solution, int update_stats));
00123 void check_better_solution PROTO((sym_environment * env, bc_node *root,
00124 int delete_node, int change_type));
00125 int copy_node PROTO((bc_node * n_to, bc_node *n_from));
00126 int copy_tree PROTO((bc_node *root_to, bc_node *root_from));
00127 int read_node PROTO((bc_node * node, FILE *f));
00128 int read_tree PROTO((bc_node * root, FILE *f));
00129 int write_node PROTO((bc_node *node, FILE *f));
00130 int write_tree PROTO((bc_node *root, FILE *f));
00131
00132 int set_param PROTO((sym_environment *env, char *line));
00133
00134 warm_start_desc *create_copy_warm_start PROTO((warm_start_desc * ws));
00135 MIPdesc *create_copy_mip_desc PROTO((MIPdesc *mip));
00136 sym_environment *create_copy_environment PROTO((sym_environment *env));
00137
00138 double get_lb_for_new_rhs PROTO((bc_node *root, MIPdesc *mip, int cnt,
00139 int *ind, double *val));
00140 double get_ub_for_new_rhs PROTO((bc_node *root, MIPdesc *mip, int cnt,
00141 int *ind, double *val));
00142 #if 0
00143 double get_lb_for_new_obj PROTO((bc_node *root, MIPdesc *mip, int cnt,
00144 int *ind, double *val));
00145 #endif
00146 double get_ub_for_new_obj PROTO((bc_node *root, MIPdesc *mip, int cnt,
00147 int *ind, double *val));
00148 int check_feasibility_new_rhs PROTO((bc_node * node, MIPdesc * mip,
00149 int cnt, int *ind, double *val));
00150 int trim_warm_tree PROTO((sym_environment *env, bc_node *n));
00151
00152 #endif