Scippy

GCG

Branch-and-Price & Column Generation for Everyone

dialog_master.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program */
4 /* GCG --- Generic Column Generation */
5 /* a Dantzig-Wolfe decomposition based extension */
6 /* of the branch-cut-and-price framework */
7 /* SCIP --- Solving Constraint Integer Programs */
8 /* */
9 /* Copyright (C) 2010-2021 Operations Research, RWTH Aachen University */
10 /* Zuse Institute Berlin (ZIB) */
11 /* */
12 /* This program is free software; you can redistribute it and/or */
13 /* modify it under the terms of the GNU Lesser General Public License */
14 /* as published by the Free Software Foundation; either version 3 */
15 /* of the License, or (at your option) any later version. */
16 /* */
17 /* This program is distributed in the hope that it will be useful, */
18 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
19 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
20 /* GNU Lesser General Public License for more details. */
21 /* */
22 /* You should have received a copy of the GNU Lesser General Public License */
23 /* along with this program; if not, write to the Free Software */
24 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
25 /* */
26 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27 
28 /**@file dialog_master.c
29  * @brief user interface dialog for master problem
30  * @author Tobias Achterberg
31  * @author Timo Berthold
32  * @author Christian Puchert
33  */
34 
35 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36 
37 #include <string.h>
38 
39 #include "scip/dialog_default.h"
40 #include "dialog_master.h"
41 
42 
43 
44 /** dialog execution method telling that a command is not available */
45 SCIP_DECL_DIALOGEXEC(GCGmasterDialogExecNotAvailable)
46 { /*lint --e{715}*/
47  SCIPdialogMessage(scip, NULL, "Not available in the master problem\n");
48 
49  *nextdialog = SCIPdialogGetParent(dialog);
50 
51  return SCIP_OKAY;
52 }
53 
54 /** creates a root dialog */
56  SCIP* scip, /**< SCIP data structure */
57  SCIP_DIALOG** root /**< pointer to store the root dialog */
58  )
59 {
60  SCIP_CALL( SCIPincludeDialog(scip, root,
61  NULL, SCIPdialogExecMenuLazy, NULL, NULL,
62  "GCG (master)", "GCG's master main menu", TRUE, NULL) );
63 
64  SCIP_CALL( SCIPsetRootDialog(scip, *root) );
65  SCIP_CALL( SCIPreleaseDialog(scip, root) );
66  *root = SCIPgetRootDialog(scip);
67 
68  return SCIP_OKAY;
69 }
70 
71 
72 /** includes or updates the master dialog menus in GCG */
74  SCIP* scip /**< SCIP data structure */
75  )
76 {
77  SCIP_DIALOG* root;
78  SCIP_DIALOG* dialog;
79 
80  /* root menu */
81  root = SCIPgetRootDialog(scip);
82  if( root == NULL )
83  {
84  SCIP_CALL( GCGcreateRootMasterDialog(scip, &root) );
85  }
86 
87  /* change */
88  if( !SCIPdialogHasEntry(root, "change") )
89  {
90  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
91  NULL,
92  GCGmasterDialogExecNotAvailable, NULL, NULL,
93  "change", "(not available in master problem)", FALSE, NULL) );
94  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
95  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
96  }
97 
98  /* free */
99  if( !SCIPdialogHasEntry(root, "free") )
100  {
101  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
102  NULL,
103  GCGmasterDialogExecNotAvailable, NULL, NULL,
104  "free", "(not available in master problem)", FALSE, NULL) );
105  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
106  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
107  }
108 
109  /* newstart */
110  if( !SCIPdialogHasEntry(root, "newstart") )
111  {
112  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
113  NULL,
114  GCGmasterDialogExecNotAvailable, NULL, NULL,
115  "newstart", "(not available in master problem)", FALSE, NULL) );
116  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
117  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
118  }
119 
120  /* optimize */
121  if( !SCIPdialogHasEntry(root, "optimize") )
122  {
123  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
124  NULL,
125  GCGmasterDialogExecNotAvailable, NULL, NULL,
126  "optimize", "(not available in master problem)", FALSE, NULL) );
127  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
128  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
129  }
130 
131  /* presolve */
132  if( !SCIPdialogHasEntry(root, "presolve") )
133  {
134  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
135  NULL,
136  GCGmasterDialogExecNotAvailable, NULL, NULL,
137  "presolve", "(not available in master problem)", FALSE, NULL) );
138  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
139  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
140  }
141 
142  /* read */
143  if( !SCIPdialogHasEntry(root, "read") )
144  {
145  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
146  NULL,
147  GCGmasterDialogExecNotAvailable, NULL, NULL,
148  "read", "(not available in master problem)", FALSE, NULL) );
149  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
150  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
151  }
152 
153  /* quit */
154  if( !SCIPdialogHasEntry(root, "quit") )
155  {
156  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
157  NULL,
158  SCIPdialogExecQuit, NULL, NULL,
159  "quit", "switch back to the original problem's dialog", FALSE, NULL) );
160  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
161  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
162  }
163 
164  /* validatesolve */
165  if( !SCIPdialogHasEntry(root, "validatesolve") )
166  {
167  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
168  NULL,
169  GCGmasterDialogExecNotAvailable, NULL, NULL,
170  "validatesolve", "(not available in master problem)", FALSE, NULL) );
171  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
172  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
173  }
174 
175  /* concurrentopt */
176  if( !SCIPdialogHasEntry(root, "concurrentopt") )
177  {
178  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
179  NULL,
180  GCGmasterDialogExecNotAvailable, NULL, NULL,
181  "concurrentopt", "(not available in master problem)", FALSE, NULL) );
182  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
183  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
184  }
185 
186  SCIP_CALL( SCIPincludeDialogDefaultBasic(scip) );
187 
188  return SCIP_OKAY;
189 }
SCIP_RETCODE GCGcreateRootMasterDialog(SCIP *scip, SCIP_DIALOG **root)
Definition: dialog_master.c:55
user interface dialog for master problem
SCIP_RETCODE SCIPincludeDialogMaster(SCIP *scip)
Definition: dialog_master.c:73
SCIP_DECL_DIALOGEXEC(GCGmasterDialogExecNotAvailable)
Definition: dialog_master.c:45