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 and library */
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-2026 Operations Research, RWTH Aachen University */
10/* Zuse Institute Berlin (ZIB) */
11/* */
12/* Licensed under the Apache License, Version 2.0 (the "License"); */
13/* you may not use this file except in compliance with the License. */
14/* You may obtain a copy of the License at */
15/* */
16/* http://www.apache.org/licenses/LICENSE-2.0 */
17/* */
18/* Unless required by applicable law or agreed to in writing, software */
19/* distributed under the License is distributed on an "AS IS" BASIS, */
20/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
21/* See the License for the specific language governing permissions and */
22/* limitations under the License. */
23/* */
24/* You should have received a copy of the Apache-2.0 license */
25/* along with GCG; see the file LICENSE. If not visit gcg.or.rwth-aachen.de.*/
26/* */
27/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
28
29/**@file dialog_master.c
30 * @brief user interface dialog for master problem
31 * @author Tobias Achterberg
32 * @author Timo Berthold
33 * @author Christian Puchert
34 */
35
36/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
37
38#include <string.h>
39
40#include "scip/dialog_default.h"
41#include "gcg/dialog_master.h"
42
43
44
45/** dialog execution method telling that a command is not available */
46SCIP_DECL_DIALOGEXEC(GCGmasterDialogExecNotAvailable)
47{ /*lint --e{715}*/
48 SCIPdialogMessage(scip, NULL, "Not available in the master problem\n");
49
50 *nextdialog = SCIPdialogGetParent(dialog);
51
52 return SCIP_OKAY;
53}
54
55/** creates a root dialog */
56static
58 SCIP* scip, /**< SCIP data structure */
59 SCIP_DIALOG** root /**< pointer to store the root dialog */
60 )
61{
63 NULL, SCIPdialogExecMenuLazy, NULL, NULL,
64 "GCG (master)", "GCG's master main menu", TRUE, NULL) );
65
68 *root = SCIPgetRootDialog(scip);
69
70 return SCIP_OKAY;
71}
72
73
74/** includes or updates the master dialog menus in GCG */
76 GCG* gcg /**< GCG data structure */
77 )
78{
79 SCIP* masterprob;
80 SCIP_DIALOG* root;
81 SCIP_DIALOG* dialog;
82
83 masterprob = GCGgetMasterprob(gcg);
84 assert(masterprob != NULL);
85
86 /* root menu */
87 root = SCIPgetRootDialog(masterprob);
88 if( root == NULL )
89 {
90 SCIP_CALL( createRootMasterDialog(masterprob, &root) );
91 }
92
93 /* change */
94 if( !SCIPdialogHasEntry(root, "change") )
95 {
96 SCIP_CALL( SCIPincludeDialog(masterprob, &dialog,
97 NULL,
98 GCGmasterDialogExecNotAvailable, NULL, NULL,
99 "change", "(not available in master problem)", FALSE, NULL) );
100 SCIP_CALL( SCIPaddDialogEntry(masterprob, root, dialog) );
101 SCIP_CALL( SCIPreleaseDialog(masterprob, &dialog) );
102 }
103
104 /* free */
105 if( !SCIPdialogHasEntry(root, "free") )
106 {
107 SCIP_CALL( SCIPincludeDialog(masterprob, &dialog,
108 NULL,
109 GCGmasterDialogExecNotAvailable, NULL, NULL,
110 "free", "(not available in master problem)", FALSE, NULL) );
111 SCIP_CALL( SCIPaddDialogEntry(masterprob, root, dialog) );
112 SCIP_CALL( SCIPreleaseDialog(masterprob, &dialog) );
113 }
114
115 /* newstart */
116 if( !SCIPdialogHasEntry(root, "newstart") )
117 {
118 SCIP_CALL( SCIPincludeDialog(masterprob, &dialog,
119 NULL,
120 GCGmasterDialogExecNotAvailable, NULL, NULL,
121 "newstart", "(not available in master problem)", FALSE, NULL) );
122 SCIP_CALL( SCIPaddDialogEntry(masterprob, root, dialog) );
123 SCIP_CALL( SCIPreleaseDialog(masterprob, &dialog) );
124 }
125
126 /* optimize */
127 if( !SCIPdialogHasEntry(root, "optimize") )
128 {
129 SCIP_CALL( SCIPincludeDialog(masterprob, &dialog,
130 NULL,
131 GCGmasterDialogExecNotAvailable, NULL, NULL,
132 "optimize", "(not available in master problem)", FALSE, NULL) );
133 SCIP_CALL( SCIPaddDialogEntry(masterprob, root, dialog) );
134 SCIP_CALL( SCIPreleaseDialog(masterprob, &dialog) );
135 }
136
137 /* presolve */
138 if( !SCIPdialogHasEntry(root, "presolve") )
139 {
140 SCIP_CALL( SCIPincludeDialog(masterprob, &dialog,
141 NULL,
142 GCGmasterDialogExecNotAvailable, NULL, NULL,
143 "presolve", "(not available in master problem)", FALSE, NULL) );
144 SCIP_CALL( SCIPaddDialogEntry(masterprob, root, dialog) );
145 SCIP_CALL( SCIPreleaseDialog(masterprob, &dialog) );
146 }
147
148 /* read */
149 if( !SCIPdialogHasEntry(root, "read") )
150 {
151 SCIP_CALL( SCIPincludeDialog(masterprob, &dialog,
152 NULL,
153 GCGmasterDialogExecNotAvailable, NULL, NULL,
154 "read", "(not available in master problem)", FALSE, NULL) );
155 SCIP_CALL( SCIPaddDialogEntry(masterprob, root, dialog) );
156 SCIP_CALL( SCIPreleaseDialog(masterprob, &dialog) );
157 }
158
159 /* quit */
160 if( !SCIPdialogHasEntry(root, "quit") )
161 {
162 SCIP_CALL( SCIPincludeDialog(masterprob, &dialog,
163 NULL,
164 SCIPdialogExecQuit, NULL, NULL,
165 "quit", "switch back to the original problem's dialog", FALSE, NULL) );
166 SCIP_CALL( SCIPaddDialogEntry(masterprob, root, dialog) );
167 SCIP_CALL( SCIPreleaseDialog(masterprob, &dialog) );
168 }
169
170 /* validatesolve */
171 if( !SCIPdialogHasEntry(root, "validatesolve") )
172 {
173 SCIP_CALL( SCIPincludeDialog(masterprob, &dialog,
174 NULL,
175 GCGmasterDialogExecNotAvailable, NULL, NULL,
176 "validatesolve", "(not available in master problem)", FALSE, NULL) );
177 SCIP_CALL( SCIPaddDialogEntry(masterprob, root, dialog) );
178 SCIP_CALL( SCIPreleaseDialog(masterprob, &dialog) );
179 }
180
181 /* concurrentopt */
182 if( !SCIPdialogHasEntry(root, "concurrentopt") )
183 {
184 SCIP_CALL( SCIPincludeDialog(masterprob, &dialog,
185 NULL,
186 GCGmasterDialogExecNotAvailable, NULL, NULL,
187 "concurrentopt", "(not available in master problem)", FALSE, NULL) );
188 SCIP_CALL( SCIPaddDialogEntry(masterprob, root, dialog) );
189 SCIP_CALL( SCIPreleaseDialog(masterprob, &dialog) );
190 }
191
193
194 return SCIP_OKAY;
195}
#define SCIP_CALL(x)
SCIP_RETCODE GCGincludeDialogMaster(GCG *gcg)
Definition: dialog_master.c:75
SCIP_DECL_DIALOGEXEC(GCGmasterDialogExecNotAvailable)
Definition: dialog_master.c:46
static SCIP_RETCODE createRootMasterDialog(SCIP *scip, SCIP_DIALOG **root)
Definition: dialog_master.c:57
user interface dialog for master problem
#define TRUE
#define FALSE
SCIP_RETCODE SCIPincludeDialogDefaultBasic(SCIP *scip)
SCIP * GCGgetMasterprob(GCG *gcg)
Definition: gcg.cpp:99
void SCIPdialogMessage(SCIP *scip, FILE *file, const char *formatstr,...)
SCIP_RETCODE SCIPreleaseDialog(SCIP *scip, SCIP_DIALOG **dialog)
SCIP_Bool SCIPdialogHasEntry(SCIP_DIALOG *dialog, const char *entryname)
SCIP_RETCODE SCIPincludeDialog(SCIP *scip, SCIP_DIALOG **dialog, SCIP_DECL_DIALOGCOPY((*dialogcopy)), SCIP_DECL_DIALOGEXEC((*dialogexec)), SCIP_DECL_DIALOGDESC((*dialogdesc)), SCIP_DECL_DIALOGFREE((*dialogfree)), const char *name, const char *desc, SCIP_Bool issubmenu, SCIP_DIALOGDATA *dialogdata)
SCIP_RETCODE SCIPaddDialogEntry(SCIP *scip, SCIP_DIALOG *dialog, SCIP_DIALOG *subdialog)
SCIP_RETCODE SCIPsetRootDialog(SCIP *scip, SCIP_DIALOG *dialog)
SCIP_DIALOG * SCIPgetRootDialog(SCIP *scip)
SCIP_DIALOG * SCIPdialogGetParent(SCIP_DIALOG *dialog)
#define NULL
Definition: struct_gcg.h:55
SCIP_OKAY
enum SCIP_Retcode SCIP_RETCODE