Dip  0.92.4
sym_cp.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 _CUT_POOL_H
16 #define _CUT_POOL_H
17 
18 #include "symphony.h"
19 #include "sym_proto.h"
20 #include "sym_types.h"
21 #include "sym_cp_params.h"
22 #include "sym_cp_u.h"
23 
24 #define PREPARE_TO_CHECK_CUTS 0
25 #define CHECK_ONE_CUT 1
26 #define FINISH_TO_CHECK_CUTS 2
27 
28 /*===========================================================================*\
29  * This data structure contains the cut pool itself
30 \*===========================================================================*/
31 
32 typedef struct CP_CUT_DATA{
34  int touches;
35  int level;
36  int check_num;
37  double quality;
39 
40 /*===========================================================================*/
41 
42 typedef struct CUT_POOL{
43  void *user;
44  int master;
46  double cut_pool_time;
47  int msgtag; /* the message tag of the last message */
48  double lpetol; /* the zero tolerance in the lp process */
49  cp_params par; /* cut pool parameters */
50  int size; /* the total size of all the cuts in the pool*/
51  int cut_num; /* the number of cuts in the pool */
52  int allocated_cut_num; /* the possible number of cuts */
53  cp_cut_data **cuts; /* the list of all the cuts in the pool*/
55  int reorder_count; /* Only reorder the cuts periodically */
57 #ifdef COMPILE_IN_CP
58  int cuts_to_add_num;
59  cut_data **cuts_to_add;
60  int cuts_to_add_size;
61 #endif
62 }cut_pool;
63 
64 /*===========================================================================*/
65 /*==================== CP basic functions (cp_func.c) =======================*/
66 /*===========================================================================*/
67 
68 cut_pool *get_cp_ptr PROTO((cut_pool ** cp_list, int index));
69 void cp_initialize PROTO((cut_pool *cp, int master_tid));
70 
71 /*------- Functions related to deletion of cuts (size management) -----------*/
72 
73 int unsigned_memcmp PROTO((char *coef0, char *coef1, int size));
74 int cutcmp PROTO((const void *cut0ptr, const void *cut1ptr));
75 int delete_ineffective_cuts PROTO((cut_pool *cp));
76 int delete_duplicate_cuts PROTO((cut_pool *cp));
77 int which_cut_to_delete PROTO((cut_data *cut1, cut_data *cut2));
78 
79 /*---------------------- Checking the cuts ----------------------------------*/
80 
81 int cut_quality_cmp PROTO((const void *cut0ptr, const void *cut1ptr));
82 void order_cuts_by_quality PROTO((cut_pool *cp));
83 
84 /*--------------- Functions related to logging ------------------------------*/
85 
86 int write_cp_cut_list PROTO((cut_pool *cp, char *file, char append));
87 int read_cp_cut_list PROTO((cut_pool *cp, char *file));
88 int cp_read_tm_cut_list PROTO((cut_pool *cp, char *file));
89 
90 /*---------------------------- Closing --------------------------------------*/
91 
92 void cp_close PROTO((cut_pool *cp));
93 
94 /*===========================================================================*/
95 /*=============== CP communication functions (cp_proccomm.c) ================*/
96 /*===========================================================================*/
97 
98 void cp_process_message PROTO((cut_pool *cp, int r_bufid));
99 void cut_pool_send_cut PROTO((cut_pool *cp, cut_data *cut, int tid));
100 void cut_pool_receive_cuts PROTO((cut_pool *cp, int bc_level));
101 
102 /*===========================================================================*/
103 /*================= CP wrapper functions (cp_wrapper.c) =====================*/
104 /*===========================================================================*/
105 
106 int receive_cp_data_u PROTO((cut_pool *cp));
107 int receive_lp_solution_cp_u PROTO((cut_pool *cp));
108 void free_cut_pool_u PROTO((cut_pool *cp));
109 int check_cuts_u PROTO((cut_pool *cp, lp_sol *cur_sol));
110 int check_cut_u PROTO((cut_pool *cp, lp_sol *cur_sol, cut_data *cut,
111  int *is_violated, double *quality));
112 
113 #endif
#define PROTO(x)
Definition: sym_proto.h:27
int allocated_cut_num
Definition: sym_cp.h:52
int tree_manager
Definition: sym_cp.h:45
int reorder_count
Definition: sym_cp.h:55
cp_cut_data ** cuts
Definition: sym_cp.h:53
int check_num
Definition: sym_cp.h:36
int msgtag
Definition: sym_cp.h:47
cp_params par
Definition: sym_cp.h:49
void * user
Definition: sym_cp.h:43
int total_cut_num
Definition: sym_cp.h:54
int level
Definition: sym_cp.h:35
cut_data cut
Definition: sym_cp.h:33
lp_sol cur_sol
Definition: sym_cp.h:56
double quality
Definition: sym_cp.h:37
int master
Definition: sym_cp.h:44
int size
Definition: sym_cp.h:50
double lpetol
Definition: sym_cp.h:48
double cut_pool_time
Definition: sym_cp.h:46
struct CUT_POOL cut_pool
struct CP_CUT_DATA cp_cut_data
int cut_num
Definition: sym_cp.h:51
int touches
Definition: sym_cp.h:34