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 _MESSAGES_H
16 #define _MESSAGES_H
17 
18 #define EMPTY_MSG_SEND(tid, msgtag) \
19 { \
20    int s_bufid; \
21    if ((s_bufid = pvm_initsend (PvmDataRaw)) < 0) PVM_ERROR(); \
22    if ((info = pvm_send((tid), (msgtag))) < 0) PVM_ERROR(); \
23    if ((info = pvm_freebuf(s_bufid)) < 0) PVM_ERROR(); \
24 }
25 
26 #define EMPTY_MSG_MCAST(tid, numtask, msgtag) \
27 { \
28    int s_bufid; \
29    if ((s_bufid = pvm_initsend (PvmDataRaw)) < 0) PVM_ERROR(); \
30    if ((info = pvm_mcast((tid), (numtask), (msgtag))) < 0) PVM_ERROR(); \
31    if ((info = pvm_freebuf(s_bufid)) < 0) PVM_ERROR(); \
32 }
33 
34 /*===========================================================================*
35  * Message types
36  * 1xx : general messages
37  * 2xx : messages to/from master
38  * 3xx : messages to/from tree manager
39  * 4xx : rest of the messages
40  *===========================================================================*/
41 
42 /* we allow a process to die */
43 #define YOU_CAN_DIE 100
44 
45 #define I_AM_DEAD 101
46 
47 /*pretend to die*/
48 #define YOU_CANNOT_DIE 102
49 
50 /* this is a new upper bound */
51 #define UPPER_BOUND 103
52 
53 /* the tid of the master process is going to be sent */
54 #define MASTER_TID_INFO 104
55 
56 /* tells the process to write a log file for a warm re-start in case of crash*/
57 #define WRITE_LOG_FILE 105
58 
59 
60 /* messages to set up an lp: lp-->master; master-->lp */
61 #define REQUEST_FOR_LP_DATA 200
62 #define LP_DATA             201
63 /* similar for cg */
64 #define REQUEST_FOR_CG_DATA 202
65 #define CG_DATA             203
66 /* similar for cp */
67 #define REQUEST_FOR_CP_DATA 204
68 #define CP_DATA             205
69 /* similar for sp */
70 #define REQUEST_FOR_SP_DATA 206
71 #define SP_DATA             207
72 /* similar for dg */
73 #define REQUEST_FOR_DG_DATA 208
74 #define DG_DATA             209
75 
76 /* startup data for the TM */
77 #define TM_DATA             210
78 
79 /* miscellaneous tm messages */
80 #define TM_ROOT_DESCRIPTION              211
81 #define TM_FIRST_PHASE_FINISHED          212
82 
83 /*===========================================================================*
84  * treemanager-->lp messages
85  *===========================================================================*/
86 /* lp-->tm; Describes a particular search tree node */
87 #define LP__NODE_DESCRIPTION 300
88 /* lp-->tm; Describes the branching at this node */
89 #define LP__BRANCHING_INFO 301
90 /* lp-->tm; The LP is free to process a new node */
91 #define LP__IS_FREE 302
92 /* tm-->lp; 2nd phase started, from now on price*/
93 #define LP__SECOND_PHASE_STARTS 303
94 
95 #define LP__CUT_NAMES_REQUESTED 304
96 #define LP__CUT_NAMES_SERVED  305
97 
98 /* tm --> lp;  tm-->lp: this is your new active node, process it. */
99 #define LP__ACTIVE_NODE_DATA 306
100 /* tm-->lp: Instruction to the LP process whether to dive or not */
101 #define LP__DIVING_INFO 307
102 
103 /* tm-->lp: The tid of the corresponding cut generator */
104 #define LP__CG_TID_INFO 308
105 
106 /* lp-->tm: the newly sent active node is too expensive, hold it for the
107             next phase */
108 #define LP__NODE_RESHELVED 309
109 /* lp-->tm: the newly sent active node is too expensive, discarded */
110 #define LP__NODE_DISCARDED 310
111 /* lp-->tm: timing data */
112 #define LP__TIMING 311
113 
114 
115 /*===========================================================================*
116  * lp-->... messages
117  *===========================================================================*/
118 /* lp-->master; different msgtypes for a feasible solution */
119 #define FEASIBLE_SOLUTION_NONZEROS  410
120 #define FEASIBLE_SOLUTION_FRACTIONS 411
121 #define FEASIBLE_SOLUTION_USER      412
122 
123 /* lp-->cutgen,cutpool; a solution to be checked to find violated cuts
124    and the solution is in a default format (userinds and values). Maybe
125    nonzeros or fractions at this time */
126 #define LP_SOLUTION_NONZEROS  420
127 #define LP_SOLUTION_FRACTIONS 421
128 #define LP_SOLUTION_USER      422
129 
130 /*===========================================================================*
131  * treemanager-->cut/sol_pool messages
132  *===========================================================================*/
133 /* notifies cut_pool to wait for a new set of cuts */
134 #define POOL_YOU_ARE_USELESS 501
135 #define POOL_USELESSNESS_ACKNOWLEDGED 502
136 /* tm asks a pool to copy itself into another pool */
137 #define POOL_COPY_YOURSELF 503
138 /* a pool reports back that it had finished and how much time it had used.
139    a pool dies only if every node that belongs to it is fathomed */
140 #define POOL_TIME 504
141 
142 /*****************************************************************************/
143 
144 #define PACKED_CUT        600
145 #define PACKED_CUTS_TO_CP 601
146 #define CUTPOOL_COPY      602
147 
148 #define NO_MORE_CUTS 605
149 
150 /*****************************************************************************/
151 
152 #define PACKED_COL 700
153 #define NO_MORE_COLS 701
154 #define CG_LP_SOLUTION 703
155 
156 /*****************************************************************************/
157 
158 #define SOMETHING_DIED 1000
159 #define NODE_DIED 1001
160 
161 
162 #endif
163