Dip  0.92.4
sym_master.h
Go to the documentation of this file.
1 /*===========================================================================*/
2 /* */
3 /* This file is part of the SYMPHONY MILP Solver Framework. */
4 /* */
5 /* SYMPHONY was jointly developed by Ted Ralphs (ted@lehigh.edu) and */
6 /* Laci Ladanyi (ladanyi@us.ibm.com). */
7 /* */
8 /* (c) Copyright 2000-2019 Ted Ralphs. All Rights Reserved. */
9 /* */
10 /* This software is licensed under the Eclipse Public License. Please see */
11 /* accompanying file for terms. */
12 /* */
13 /*===========================================================================*/
14 
15 #ifndef _MASTER_H
16 #define _MASTER_H
17 
18 #define COMPILING_FOR_MASTER
19 
20 #include <stdio.h>
21 
22 #include "symphony.h"
23 #include "sym_types.h"
24 #include "sym_macros.h"
25 #include "sym_master_params.h"
26 #ifdef COMPILE_IN_TM
27 #include "sym_tm.h"
28 #endif
29 
30 /*===========================================================================*\
31  * The problem data structure contains the data for a problem instance, as
32  * well as some of the tours that have been generated.
33 \*===========================================================================*/
34 
35 typedef struct SYM_ENVIRONMENT{
36  void *user;
37  int my_tid;
38  int tm_tid;
39  int dg_tid;
40  params par; /* problem parameters */
41  prob_times comp_times; /* keeps track of the computation times for
42  the problem */
43  int has_ub;
44  double ub;
46  int has_mc_ub;
47  double mc_ub;
48  double obj[2];
49  double utopia[2];
51  double ub_estimate;
52  double lb;
53  double obj_offset;
54 
55  MIPdesc *mip; /*For holding the description when read in from MPS
56  - also the working copy */
57 
58  MIPdesc *orig_mip; /*For holding the original description if
59  presolve is used*/
60  MIPdesc *prep_mip; /* For holding the presolved description if
61  presolve is used*/
62 
63  char probname[81];
64 
67 
68  int termcode;
69 
71 
72  double mc_time;
73 
74 #ifdef COMPILE_IN_TM
75  tm_prob *tm;
76 #ifdef COMPILE_IN_CP
77  cut_pool **cp;
78 #endif
79  /* solution pool */
80  sp_desc *sp;
81 #endif
83 
84 /*===========================================================================*/
85 /*=================== Master I/O functions (readparams.c) ===================*/
86 /*===========================================================================*/
87 
88 void usage PROTO((void));
89 void version PROTO((void));
90 int parse_command_line PROTO((sym_environment *env, int argc, char **argv));
91 void read_string PROTO((char *target, char *line, int maxlen));
92 void print_statistics PROTO((node_times *tim, problem_stat *stat,
93  lp_stat_desc *lp_stat, double ub,
94  double lb, double initial_time,
95  double start_time, double finish_time,
96  double obj_offset, char obj_sense, int has_ub,
97  sp_desc *solpool, int output_mode));
98 
99 /*===========================================================================*/
100 /*=============== Master wrapper functions (master_wrapper.c) ===============*/
101 /*===========================================================================*/
102 
103 int initialize_u PROTO((sym_environment *env));
104 int free_master_u PROTO((sym_environment *env));
105 int readparams_u PROTO((sym_environment *env, int argc, char **argv));
106 int io_u PROTO((sym_environment *env));
107 int init_draw_graph_u PROTO((sym_environment *env));
108 int start_heurs_u PROTO((sym_environment *env));
109 int display_solution_u PROTO((sym_environment *env, int thread_num));
110 int initialize_root_node_u PROTO((sym_environment *env));
111 int receive_feasible_solution_u PROTO((sym_environment *env, int msgtag));
112 int send_lp_data_u PROTO((sym_environment *env, int sender));
113 int send_cg_data_u PROTO((sym_environment *env, int sender));
114 int send_cp_data_u PROTO((sym_environment *env, int sender));
115 int send_sp_data_u PROTO((sym_environment *env, int sender));
116 int process_own_messages_u PROTO((sym_environment *env, int msgtag));
117 
118 /*===========================================================================*/
119 /*=================== Master helper functions (master_func.c) ===============*/
120 /*===========================================================================*/
121 
122 int resolve_node PROTO((sym_environment *env, bc_node * node));
123 int update_tree_bound PROTO((sym_environment *env, bc_node *root, int *cut_num,
124  int *cut_ind, char *cru_vars, int change_type));
125 void register_cuts PROTO((bc_node *root, int *cut_num, int *cuts_ind));
126 void update_node_desc PROTO((sym_environment *env, bc_node *root,
127  int change_type));
128 void update_branching_decisions PROTO((sym_environment *env, bc_node *root,
129  int change_type));
130 void check_trim_tree PROTO((sym_environment *env, bc_node *root, int *cut_num,
131  int *cuts_ind, int change_type));
132 void cut_ws_tree_index PROTO((sym_environment *env, bc_node *root, int index,
133  problem_stat * stat, int change_type));
134 void cut_ws_tree_level PROTO((sym_environment *env, bc_node *root, int level,
135  problem_stat * stat, int change_type));
136 void ws_free_subtree PROTO((sym_environment *env, bc_node *root,
137  int change_type, int check_solution, int update_stats));
138 void check_better_solution PROTO((sym_environment * env, bc_node *root,
139  int delete_node, int change_type));
140 int copy_node PROTO((bc_node * n_to, bc_node *n_from));
141 int copy_tree PROTO((bc_node *root_to, bc_node *root_from));
142 int read_node PROTO((bc_node * node, FILE *f));
143 int read_tree PROTO((bc_node * root, FILE *f));
144 int write_node PROTO((bc_node *node, FILE *f));
145 int write_tree PROTO((bc_node *root, FILE *f));
146 
147 int set_param PROTO((sym_environment *env, char *line));
148 
149 warm_start_desc *create_copy_warm_start PROTO((warm_start_desc * ws));
150 MIPdesc *create_copy_mip_desc PROTO((MIPdesc *mip));
151 sym_environment *create_copy_environment PROTO((sym_environment *env));
152 
153 double get_lb_for_new_rhs PROTO((bc_node *root, MIPdesc *mip, int cnt,
154  int *ind, double *val));
155 double get_ub_for_new_rhs PROTO((bc_node *root, MIPdesc *mip, int cnt,
156  int *ind, double *val));
157 #if 0
158 double get_lb_for_new_obj PROTO((bc_node *root, MIPdesc *mip, int cnt,
159  int *ind, double *val));
160 #endif
161 double get_ub_for_new_obj PROTO((bc_node *root, MIPdesc *mip, int cnt,
162  int *ind, double *val));
163 int check_feasibility_new_rhs PROTO((bc_node * node, MIPdesc * mip,
164  int cnt, int *ind, double *val));
165 int trim_warm_tree PROTO((sym_environment *env, bc_node *n));
166 void free_master PROTO((sym_environment *env));
167 #endif
#define PROTO(x)
Definition: sym_proto.h:27
MIPdesc * mip
Definition: sym_master.h:55
MIPdesc * orig_mip
Definition: sym_master.h:58
double obj[2]
Definition: sym_master.h:48
Definition: sym_tm.h:56
char probname[81]
Definition: sym_master.h:63
double ub_estimate
Definition: sym_master.h:51
double utopia[2]
Definition: sym_master.h:49
struct SYM_ENVIRONMENT sym_environment
lp_sol best_sol
Definition: sym_master.h:45
prob_times comp_times
Definition: sym_master.h:41
char has_ub_estimate
Definition: sym_master.h:50
warm_start_desc * warm_start
Definition: sym_master.h:70
node_desc * rootdesc
Definition: sym_master.h:66
double obj_offset
Definition: sym_master.h:53
double mc_time
Definition: sym_master.h:72
base_desc * base
Definition: sym_master.h:65
MIPdesc * prep_mip
Definition: sym_master.h:60