Scippy

GCG

Branch-and-Price & Column Generation for Everyone

dialog_gcg.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_gcg.c
29  * @brief GCG user interface dialog
30  * @author Tobias Achterberg
31  * @author Timo Berthold
32  * @author Gerald Gamrath
33  * @author Martin Bergner
34  * @author Christian Puchert
35  */
36 
37 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
38 
39 #include <sys/stat.h>
40 #include <assert.h>
41 #include <string.h>
42 
43 #include "scip/pub_dialog.h"
44 #include "scip/type_dialog.h"
45 #include "scip/dialog_default.h"
46 
47 #include "gcg.h"
48 
49 #include "dialog_gcg.h"
50 #include "relax_gcg.h"
51 #include "pricer_gcg.h"
52 #include "cons_decomp.h"
53 #include "pub_gcgheur.h"
54 #include "pub_gcgsepa.h"
55 #include "stat.h"
56 #include "reader_tex.h"
57 #include "reader_gp.h"
58 #include "params_visu.h"
59 #include "dialog_explore.h"
60 
61 /** display the reader information
62  * @returns nothing */
63 static
65  SCIP* scip, /**< SCIP data structure */
66  SCIP_Bool reader, /**< display reader which can read */
67  SCIP_Bool writer /**< display reader which can write */
68  )
69 {
70  SCIP_READER** readers;
71  int nreaders;
72  int r;
73 
74  assert( scip != NULL );
75 
76  readers = SCIPgetReaders(scip);
77  nreaders = SCIPgetNReaders(scip);
78 
79  /* display list of readers */
80  SCIPdialogMessage(scip, NULL, "\n");
81  SCIPdialogMessage(scip, NULL, " file reader extension description\n");
82  SCIPdialogMessage(scip, NULL, " ----------- --------- -----------\n");
83  for( r = 0; r < nreaders; ++r )
84  {
85  if( (reader && SCIPreaderCanRead(readers[r])) || (writer && SCIPreaderCanWrite(readers[r])) )
86  {
87  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPreaderGetName(readers[r]));
88  if( strlen(SCIPreaderGetName(readers[r])) > 20 )
89  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
90  SCIPdialogMessage(scip, NULL, "%9s ", SCIPreaderGetExtension(readers[r]));
91  SCIPdialogMessage(scip, NULL, "%s", SCIPreaderGetDesc(readers[r]));
92  SCIPdialogMessage(scip, NULL, "\n");
93  }
94  }
95  SCIPdialogMessage(scip, NULL, "\n");
96 }
97 
98 
99 /** writes out all decompositions currently known to cons_decomp
100  * @returns SCIP return code */
101 static
103  SCIP* scip, /**< SCIP data structure */
104  SCIP_DIALOG* dialog, /**< dialog menu */
105  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
106  SCIP_DIALOG** nextdialog, /**< pointer to store next dialog to execute */
107  SCIP_Bool original, /**< should decomps for original problem be written */
108  SCIP_Bool presolved /**< should decomps for presolved problem be written */
109 
110  )
111 {
112  char extension[SCIP_MAXSTRLEN];
113  char dirname[SCIP_MAXSTRLEN];
114  char* tmp;
115  SCIP_Bool endoffile;
116 
117  if( GCGconshdlrDecompGetNDecomps(scip) == 0 )
118  {
119  SCIPdialogMessage(scip, NULL, "No decomposition to write, please read or detect one first.\n");
120  SCIPdialoghdlrClearBuffer(dialoghdlr);
121  *nextdialog = NULL;
122  return SCIP_OKAY;
123  }
124 
125  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter directory: ", &tmp, &endoffile) );
126 
127 
128  if( endoffile )
129  {
130  *nextdialog = NULL;
131  return SCIP_OKAY;
132  }
133 
134  SCIPdebugMessage("dirname: %s\n", tmp);
135 
136  snprintf(dirname, sizeof(dirname), "%s", tmp);
137 
138  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, tmp, TRUE) );
139 
140  /* if no directory is specified, initialize it with a standard solution */
141  if( dirname[0] == '\0' )
142  {
143  strcpy(dirname, "alldecompositions/");
144  }
145 
146  /* make sure directory exists */
147  mkdir(dirname, S_IRWXU | S_IRWXG | S_IRWXO);
148 
149  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter extension: ", &tmp, &endoffile) );
150  snprintf(extension, sizeof(extension), "%s", tmp);
151 
152  if( extension[0] != '\0' )
153  {
154  SCIP_RETCODE retcode;
155 
156  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, extension, TRUE) );
157 
158  retcode = DECwriteAllDecomps(scip, dirname, extension, original, presolved);
159 
160  if( retcode == SCIP_FILECREATEERROR )
161  {
162  SCIPdialogMessage(scip, NULL, "error creating files\n");
163  SCIPdialoghdlrClearBuffer(dialoghdlr);
164  }
165  else if( retcode == SCIP_WRITEERROR )
166  {
167  SCIPdialogMessage(scip, NULL, "error writing files\n");
168  SCIPdialoghdlrClearBuffer(dialoghdlr);
169  }
170  else if( retcode == SCIP_PLUGINNOTFOUND )
171  {
172  SCIPdialogMessage(scip, NULL, "The chosen output format (%s) is unknown.\n", extension);
173  SCIPdialogMessage(scip, NULL, "The following readers are available for writing:\n");
174  displayReaders(scip, FALSE, TRUE);
175  }
176  else
177  {
178  /* check for unexpected errors */
179  SCIP_CALL( retcode );
180 
181  /* print result message if writing was successful */
182  SCIPdialogMessage(scip, NULL, "All decompositions were written (directory: %s, format: %s).\n",
183  dirname, extension);
184  }
185  }
186 
187  return SCIP_OKAY;
188 }
189 
190 
191 /** writes out all decompositions currently known to cons_decomp */
192 static
194  SCIP* scip, /**< SCIP data structure */
195  SCIP_DIALOG* dialog, /**< dialog menu */
196  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
197  SCIP_DIALOG** nextdialog /**< pointer to store next dialog to execute */
198  )
199 {
200  char extension[SCIP_MAXSTRLEN];
201  char dirname[SCIP_MAXSTRLEN];
202  char* tmp;
203  SCIP_Bool endoffile;
204 
205  if( GCGconshdlrDecompGetNDecomps(scip) == 0 )
206  {
207  SCIPdialogMessage(scip, NULL, "No decomposition to write, please read or detect one first.\n");
208  SCIPdialoghdlrClearBuffer(dialoghdlr);
209  *nextdialog = NULL;
210  return SCIP_OKAY;
211  }
212 
213  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter directory: ", &tmp, &endoffile) );
214 
215  if( endoffile )
216  {
217  *nextdialog = NULL;
218  return SCIP_OKAY;
219  }
220 
221  SCIPdebugMessage("dirname: %s\n", tmp);
222 
223  snprintf(dirname, sizeof(dirname), "%s", tmp);
224 
225  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, tmp, TRUE) );
226 
227  /* if no directory is specified, initialize it with a standard solution */
228  if( dirname[0] == '\0' )
229  {
230  strcpy(dirname, "selecteddecompositions/");
231  }
232 
233  /* make sure directory exists */
234  mkdir(dirname, S_IRWXU | S_IRWXG | S_IRWXO);
235 
236  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter extension: ", &tmp, &endoffile) );
237  snprintf(extension, sizeof(extension), "%s", tmp);
238 
239  if( extension[0] != '\0' )
240  {
241  SCIP_RETCODE retcode;
242 
243  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, extension, TRUE) );
244 
245  retcode = DECwriteSelectedDecomps(scip, dirname, extension);
246 
247  if( retcode == SCIP_FILECREATEERROR )
248  {
249  SCIPdialogMessage(scip, NULL, "error creating files\n");
250  SCIPdialoghdlrClearBuffer(dialoghdlr);
251  }
252  else if( retcode == SCIP_WRITEERROR )
253  {
254  SCIPdialogMessage(scip, NULL, "error writing files\n");
255  SCIPdialoghdlrClearBuffer(dialoghdlr);
256  }
257  else if( retcode == SCIP_PLUGINNOTFOUND )
258  {
259  SCIPdialogMessage(scip, NULL, "The chosen output format (%s) is unknown.\n", extension);
260  SCIPdialogMessage(scip, NULL, "The following readers are available for writing:\n");
261  displayReaders(scip, FALSE, TRUE);
262  }
263  else
264  {
265  /* check for unexpected errors */
266  SCIP_CALL( retcode );
267 
268  /* print result message if writing was successful */
269  SCIPdialogMessage(scip, NULL, "All selected decompositions were written (directory: %s, format: %s).\n",
270  dirname, extension);
271  }
272  }
273 
274  return SCIP_OKAY;
275 }
276 
277 
278 /** writes a block matrix to the location specified by the user
279  * @returns SCIP return code */
280 static
281 SCIP_RETCODE writeMatrix(
282  SCIP* scip, /**< SCIP data structure */
283  SCIP_DIALOG* dialog, /**< dialog menu */
284  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
285  SCIP_DIALOG** nextdialog, /**< pointer to store next dialog to execute */
286  SCIP_Bool originalmatrix /**< should the original (or transformed) matrix be written */
287  )
288 {
289  SCIP_Bool endoffile;
290  SCIP_RETCODE retcode;
291  char* probname;
292  char* tmpstring;
293  const char* extension = "gp";
294  char dirname[SCIP_MAXSTRLEN];
295  char probnamepath[SCIP_MAXSTRLEN];
296  char filename[SCIP_MAXSTRLEN];
297  char outname[SCIP_MAXSTRLEN];
298 
299  /* create the file path */
300  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,"Enter directory for output (e.g. ../path/to/directory):\n",
301  &tmpstring, &endoffile) );
302  if( endoffile )
303  {
304  *nextdialog = NULL;
305  return SCIP_OKAY;
306  }
307 
308  strncpy(dirname, tmpstring, SCIP_MAXSTRLEN);
309 
310  /* if no directory is specified, initialize it with a standard solution */
311  if( dirname[0] == '\0' )
312  {
313  strcpy(dirname, "./");
314  }
315 
316  /* make sure directory exists */
317  if( dirname != NULL )
318  {
319  mkdir(dirname, S_IRWXU | S_IRWXG | S_IRWXO);
320  }
321 
322  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, dirname, TRUE) );
323 
324  (void) SCIPsnprintf(probnamepath, SCIP_MAXSTRLEN, "%s", SCIPgetProbName(scip));
325  SCIPsplitFilename(probnamepath, NULL, &probname, NULL, NULL);
326  (void) SCIPsnprintf(filename, SCIP_MAXSTRLEN, "matrix-%s", probname);
327 
328  /* make sure there are no dots in the pure filename */
329  for(size_t i = 0; i < strlen(filename); i++)
330  {
331  if(filename[i] == '.')
332  filename[i] = '-';
333  }
334 
335  (void) SCIPsnprintf(outname, SCIP_MAXSTRLEN, "%s/%s.%s", dirname, filename, extension);
336 
337  /* call the creation of the matrix visualization */
338  retcode = GCGWriteGpDecompMatrix( scip, outname, dirname, originalmatrix );
339 
340  if( retcode == SCIP_FILECREATEERROR )
341  {
342  SCIPdialogMessage(scip, NULL, "error creating file\n");
343  SCIPdialoghdlrClearBuffer(dialoghdlr);
344  }
345  else if( retcode == SCIP_WRITEERROR )
346  {
347  SCIPdialogMessage(scip, NULL, "error writing file\n");
348  SCIPdialoghdlrClearBuffer(dialoghdlr);
349  }
350  else
351  {
352  /* check for unexpected errors */
353  SCIP_CALL( retcode );
354 
355  /* print result message if writing was successful */
356  SCIPdialogMessage(scip, NULL,
357  "Matrix file is written to %s. \n ", outname);
358  }
359 
360  return SCIP_OKAY;
361 }
362 
363 
364 /** writes out visualizations and statistics of all decompositions currently known to cons_decomp to a PDF file
365  * @returns SCIP return code */
366 static
368  SCIP* scip, /**< SCIP data structure */
369  SCIP_DIALOG* dialog, /**< dialog menu */
370  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
371  SCIP_DIALOG** nextdialog /**< pointer to store next dialog to execute */
372  )
373 {
374  FILE* file;
375  SCIP_Bool endoffile;
376  char* pname;
377  char* dirname;
378  const char* nameinfix = "report_";
379  const char* extension = "tex";
380  char ppath[SCIP_MAXSTRLEN];
381  char outname[SCIP_MAXSTRLEN];
382  int* decids;
383  int ndecs;
384  int ndecswritten;
385 
386  ndecs = GCGconshdlrDecompGetNDecomps(scip);
387  ndecswritten = ndecs;
388 
389  if( ndecs == 0 )
390  {
391  SCIPdialogMessage(scip, NULL, "No decomposition to write, please read or detect one first.\n");
392  SCIPdialoghdlrClearBuffer(dialoghdlr);
393  *nextdialog = NULL;
394  return SCIP_OKAY;
395  }
396 
397  /* get a directory to write to */
398  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter a directory: ", &dirname, &endoffile) );
399  if( endoffile )
400  {
401  *nextdialog = NULL;
402  return SCIP_OKAY;
403  }
404  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, dirname, TRUE) );
405 
406  /* if no directory is specified, initialize it with a standard solution */
407  if( dirname[0] == '\0' )
408  {
409  strcpy(dirname, "report/");
410  }
411 
412  /* make sure directory exists */
413  if( dirname != NULL )
414  {
415  mkdir(dirname, S_IRWXU | S_IRWXG | S_IRWXO);
416  }
417 
418  /* create a name for the new file */
419  SCIPsnprintf(ppath, SCIP_MAXSTRLEN, "%s", SCIPgetProbName(scip));
420  SCIPsplitFilename(ppath, NULL, &pname, NULL, NULL);
421 
422  (void) SCIPsnprintf(outname, SCIP_MAXSTRLEN, "%s/%s%s.%s", dirname, nameinfix, pname, extension);
423 
424  /* create output file and write report */
425  file = fopen(outname, "w");
426  if( file == NULL )
427  {
428  SCIPdialogMessage(scip, NULL, "error creating report file\n");
429  SCIPdialoghdlrClearBuffer(dialoghdlr);
430  }
431 
432  /* get finished partial decomps */
433  SCIPallocBlockMemoryArray(scip, &decids, ndecs);
434  GCGconshdlrDecompGetFinishedPartialdecsList(scip, &decids, &ndecs);
435  GCGwriteTexReport(scip, file, decids, &ndecswritten, GCGreportGetShowTitlepage(scip), GCGreportGetShowToc(scip),
437  fclose(file);
438 
439  SCIPfreeBlockMemoryArray(scip, &decids, ndecs);
440 
441  /* print result message if writing was successful */
442  SCIPdialogMessage(scip, NULL,
443  "Report on %d decompositions is written to file '%s'.\nFor compilation read the README in the same folder.\n", ndecswritten, outname);
444 
445  return SCIP_OKAY;
446 }
447 
448 /** dialog execution method for the display statistics command */
449 SCIP_DECL_DIALOGEXEC(GCGdialogExecDisplayStatistics)
450 { /*lint --e{715}*/
451  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
452 
453  SCIP_CALL( GCGprintStatistics(scip, NULL) );
454 
455  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
456 
457  return SCIP_OKAY;
458 }
459 
460 
461 /** dialog execution method print complete detection information */
462 SCIP_DECL_DIALOGEXEC(GCGdialogExecPrintDetectionInformation)
463 { /*lint --e{715}*/
464  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
465 
466  SCIP_CALL( GCGprintCompleteDetectionStatistics(scip, NULL) );
467 
468  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
469 
470  return SCIP_OKAY;
471 }
472 
473 
474 /** dialog execution method for adding block number candidate */
475 SCIP_DECL_DIALOGEXEC(GCGdialogExecChangeAddBlocknr)
476 { /*lint --e{715}*/
477  char* blocknrchar;
478  char* token;
479  int blocknr;
480  char tempstr[SCIP_MAXSTRLEN];
481  SCIP_Bool endoffile;
482 
483  tempstr[0] = '\0';
484 
485  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
486 
487  (void) SCIPsnprintf(tempstr, SCIP_MAXSTRLEN, "Please type the block number candidates you want to add (as white space separated list): ");
488  SCIP_CALL( SCIPdialoghdlrGetLine(dialoghdlr, dialog, (char*)tempstr, &blocknrchar, &endoffile) );
489 
490  token = strtok(blocknrchar, " ");
491 
492  while( token )
493  {
494  blocknr = atoi( token );
495  if ( blocknr == 0 )
496  {
497  SCIPdialogMessage(scip, NULL,
498  "%s is not a compatible number; no new block number candidate added. \n", token);
499  return SCIP_OKAY;
500  }
501 
503  token = strtok(NULL, " ");
504  }
505 
506  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
507 
508  return SCIP_OKAY;
509 }
510 
511 /** dialog execution method for the display decomposition command */
512 SCIP_DECL_DIALOGEXEC(GCGdialogExecDisplayDecomposition)
513 { /*lint --e{715}*/
514  DEC_DECOMP* decomp;
515  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
516 
517  if( SCIPgetStage(scip) < SCIP_STAGE_PROBLEM )
518  SCIPdialogMessage(scip, NULL, "no problem exists\n");
519  else if( SCIPgetStage(scip) < SCIP_STAGE_PRESOLVED )
520  SCIPwriteOrigProblem(scip, NULL, "dec", FALSE);
521  else
522  SCIPwriteTransProblem(scip, NULL, "dec", FALSE);
523 
524  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
525 
526  return SCIP_OKAY;
527 }
528 
529 /** dialog execution method for the display block number candidates */
530 SCIP_DECL_DIALOGEXEC(GCGdialogExecDisplayNBlockcandidates)
531 { /*lint --e{715}*/
532  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
533 
534  SCIP_CALL(GCGprintBlockcandidateInformation(scip, NULL) );
535 
536  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
537 
538  return SCIP_OKAY;
539 }
540 
541 
542 /** dialog execution method for the display additionalstatistics command */
543 SCIP_DECL_DIALOGEXEC(GCGdialogExecDisplayAdditionalStatistics)
544 { /*lint --e{715}*/
545 
546  DEC_DECOMP* bestdecomp;
547 
548 
549  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
550  if( SCIPgetStage(scip) == SCIP_STAGE_SOLVING || SCIPgetStage(scip) == SCIP_STAGE_SOLVED )
551  {
552  if( SCIPgetStage(GCGgetMasterprob(scip)) < SCIP_STAGE_PRESOLVED )
553  {
554  SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), NULL, "No Dantzig-Wolfe reformulation applied. No decomposition statistics available.\n");
555  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
556  return SCIP_OKAY;
557  }
558 
559  SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), NULL, "\nAdditional statistics:\n");
560  bestdecomp = DECgetBestDecomp(scip, FALSE);
561  if( DECdecompGetType(bestdecomp) == DEC_DECTYPE_DIAGONAL )
562  {
563  SCIPmessageFPrintInfo(SCIPgetMessagehdlr(GCGgetMasterprob(scip)), NULL, "\n");
564  SCIP_CALL( GCGwriteDecompositionData(scip) );
565 
566  }
567  else
568  {
570  SCIPmessageFPrintInfo(SCIPgetMessagehdlr(GCGgetMasterprob(scip)), NULL, "\n");
571  SCIP_CALL( GCGwriteDecompositionData(scip) );
572  SCIP_CALL( GCGwriteVarCreationDetails(GCGgetMasterprob(scip)) );
573  }
574  DECdecompFree(scip, &bestdecomp);
575  }
576  else
577  {
578  SCIPdialogMessage(scip, NULL, "Problem needs to solved first for additional statistics");
579  }
580  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
581 
582  return SCIP_OKAY;
583 }
584 
585 
586 /** dialog execution method for the display detectors command */
587 SCIP_DECL_DIALOGEXEC(GCGdialogExecDisplayDetectors)
588 { /*lint --e{715}*/
589  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
590 
592  SCIPdialogMessage(scip, NULL, "\n");
593 
594  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
595 
596  return SCIP_OKAY;
597 }
598 
599 /** dialog execution method for the display solvers command */
600 SCIP_DECL_DIALOGEXEC(GCGdialogExecDisplaySolvers)
601 { /*lint --e{715}*/
602  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
603 
605  SCIPdialogMessage(scip, NULL, "\n");
606 
607  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
608 
609  return SCIP_OKAY;
610 }
611 
612 /** dialog execution method for the master command */
613 SCIP_DECL_DIALOGEXEC(GCGdialogExecSetMaster)
614 { /*lint --e{715}*/
615  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
616 
617  if( SCIPgetStage(GCGgetMasterprob(scip)) != SCIP_STAGE_INIT )
618  {
619  SCIPverbMessage(scip, SCIP_VERBLEVEL_DIALOG, NULL, "switching to the master problem shell is only possible before the solving process is started\n");
620 
621  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
622 
623  return SCIP_OKAY;
624  }
625 
626  SCIPverbMessage(scip, SCIP_VERBLEVEL_DIALOG, NULL, "switching to the master problem...\n");
627  SCIP_CALL( SCIPstartInteraction(GCGgetMasterprob(scip)) );
628  SCIPverbMessage(scip, SCIP_VERBLEVEL_DIALOG, NULL, "back in the original problem...\n");
629 
630  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
631 
632  return SCIP_OKAY;
633 }
634 
635 /** dialog execution method for the set loadmaster command */
636 SCIP_DECL_DIALOGEXEC(GCGdialogExecSetLoadmaster)
637 { /*lint --e{715}*/
638  SCIP* masterprob;
639  char* filename;
640  SCIP_Bool endoffile;
641 
642  masterprob = GCGgetMasterprob(scip);
643  assert(masterprob != NULL);
644 
645  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
646  if( endoffile )
647  {
648  *nextdialog = NULL;
649  return SCIP_OKAY;
650  }
651 
652  if( filename[0] != '\0' )
653  {
654  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
655 
656  if( SCIPfileExists(filename) )
657  {
658  SCIP_CALL( SCIPreadParams(masterprob, filename) );
659  SCIPdialogMessage(scip, NULL, "loaded master parameter file <%s>\n", filename);
660  }
661  else
662  {
663  SCIPdialogMessage(scip, NULL, "file <%s> not found\n", filename);
664  SCIPdialoghdlrClearBuffer(dialoghdlr);
665  }
666  }
667 
668  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
669 
670  return SCIP_OKAY;
671 }
672 
673 /** dialog execution method for the transform command */
674 SCIP_DECL_DIALOGEXEC(GCGdialogExecTransform)
675 { /*lint --e{715}*/
676  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
677 
678  SCIPdialogMessage(scip, NULL, "\n");
679  switch( SCIPgetStage(scip) )
680  {
681  case SCIP_STAGE_INIT:
682  SCIPdialogMessage(scip, NULL, "no problem exists\n");
683  break;
684 
685  case SCIP_STAGE_PROBLEM:
686  SCIP_CALL( GCGtransformProb(scip) );
687  break;
688 
689  case SCIP_STAGE_TRANSFORMED:
690  SCIPdialogMessage(scip, NULL, "problem is already transformed\n");
691  break;
692 
693  case SCIP_STAGE_TRANSFORMING:
694  case SCIP_STAGE_INITPRESOLVE:
695  case SCIP_STAGE_PRESOLVING:
696  case SCIP_STAGE_PRESOLVED:
697  case SCIP_STAGE_EXITPRESOLVE:
698  case SCIP_STAGE_INITSOLVE:
699  case SCIP_STAGE_SOLVING:
700  case SCIP_STAGE_SOLVED:
701  case SCIP_STAGE_EXITSOLVE:
702  case SCIP_STAGE_FREETRANS:
703  case SCIP_STAGE_FREE:
704  default:
705  SCIPerrorMessage("invalid SCIP stage\n");
706  return SCIP_INVALIDCALL;
707  }
708  SCIPdialogMessage(scip, NULL, "\n");
709 
710  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
711 
712  return SCIP_OKAY;
713 }
714 
715 
716 /** dialog execution method for the presolve command */
717 SCIP_DECL_DIALOGEXEC(GCGdialogExecPresolve)
718 { /*lint --e{715}*/
719  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
720 
721  SCIPdialogMessage(scip, NULL, "\n");
722  switch( SCIPgetStage(scip) )
723  {
724  case SCIP_STAGE_INIT:
725  SCIPdialogMessage(scip, NULL, "no problem exists\n");
726  break;
727 
728  case SCIP_STAGE_PROBLEM:
729  case SCIP_STAGE_TRANSFORMED:
730  case SCIP_STAGE_PRESOLVING:
731  SCIP_CALL( GCGpresolve(scip) );
732  break;
733 
734  case SCIP_STAGE_PRESOLVED:
735  case SCIP_STAGE_SOLVING:
736  SCIPdialogMessage(scip, NULL, "problem is already presolved\n");
737  break;
738 
739  case SCIP_STAGE_SOLVED:
740  SCIPdialogMessage(scip, NULL, "problem is already solved\n");
741  break;
742 
743  case SCIP_STAGE_TRANSFORMING:
744  case SCIP_STAGE_INITPRESOLVE:
745  case SCIP_STAGE_EXITPRESOLVE:
746  case SCIP_STAGE_INITSOLVE:
747  case SCIP_STAGE_EXITSOLVE:
748  case SCIP_STAGE_FREETRANS:
749  case SCIP_STAGE_FREE:
750  default:
751  SCIPerrorMessage("invalid SCIP stage\n");
752  return SCIP_INVALIDCALL;
753  }
754  SCIPdialogMessage(scip, NULL, "\n");
755 
756  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
757 
758  return SCIP_OKAY;
759 }
760 
761 
762 /** dialog execution method for the detect command */
763 SCIP_DECL_DIALOGEXEC(GCGdialogExecDetect)
764 { /*lint --e{715}*/
765  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
766 
767  SCIPdialogMessage(scip, NULL, "\n");
768  switch( SCIPgetStage(scip) )
769  {
770  case SCIP_STAGE_INIT:
771  SCIPdialogMessage(scip, NULL, "no problem exists\n");
772  break;
773 
774  case SCIP_STAGE_PROBLEM:
775  case SCIP_STAGE_TRANSFORMED:
776  case SCIP_STAGE_PRESOLVING:
777  case SCIP_STAGE_PRESOLVED:
778  SCIP_CALL( GCGdetect(scip) );
779  break;
780 
781  case SCIP_STAGE_SOLVING:
782  case SCIP_STAGE_SOLVED:
783  case SCIP_STAGE_TRANSFORMING:
784  case SCIP_STAGE_INITPRESOLVE:
785  case SCIP_STAGE_EXITPRESOLVE:
786  case SCIP_STAGE_INITSOLVE:
787  case SCIP_STAGE_EXITSOLVE:
788  case SCIP_STAGE_FREETRANS:
789  case SCIP_STAGE_FREE:
790  default:
791  SCIPerrorMessage("invalid SCIP stage\n");
792  return SCIP_INVALIDCALL;
793  }
794  SCIPdialogMessage(scip, NULL, "\n");
795 
796  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
797 
798  return SCIP_OKAY;
799 }
800 
801 
802 /** dialog execution method for the displaying and selecting decompositions command */
803 SCIP_DECL_DIALOGEXEC(GCGdialogExecSelect)
804 { /*lint --e{715}*/
805  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
806 
807  SCIP_CALL( GCGdialogExecExplore(scip, dialoghdlr, dialog ) );
808 
809  SCIPdialogMessage(scip, NULL, "\n");
810 
811  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
812 
813  return SCIP_OKAY;
814 }
815 
816 
817 /** dialog execution method for the optimize command */
818 SCIP_DECL_DIALOGEXEC(GCGdialogExecOptimize)
819 { /*lint --e{715}*/
820  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
821 
822  SCIPdialogMessage(scip, NULL, "\n");
823  switch( SCIPgetStage(scip) )
824  {
825  case SCIP_STAGE_INIT:
826  SCIPdialogMessage(scip, NULL, "no problem exists\n");
827  break;
828 
829  case SCIP_STAGE_PROBLEM:
830  case SCIP_STAGE_TRANSFORMED:
831  case SCIP_STAGE_PRESOLVING:
832  case SCIP_STAGE_PRESOLVED:
833  case SCIP_STAGE_SOLVING:
834  SCIP_CALL( GCGsolve(scip) );
835  break;
836 
837  case SCIP_STAGE_SOLVED:
838  SCIPdialogMessage(scip, NULL, "problem is already solved\n");
839  break;
840 
841  case SCIP_STAGE_TRANSFORMING:
842  case SCIP_STAGE_INITPRESOLVE:
843  case SCIP_STAGE_EXITPRESOLVE:
844  case SCIP_STAGE_INITSOLVE:
845  case SCIP_STAGE_EXITSOLVE:
846  case SCIP_STAGE_FREETRANS:
847  case SCIP_STAGE_FREE:
848  default:
849  SCIPerrorMessage("invalid SCIP stage\n");
850  return SCIP_INVALIDCALL;
851  }
852  SCIPdialogMessage(scip, NULL, "\n");
853 
854  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
855 
856  return SCIP_OKAY;
857 }
858 
859 
860 /** dialog execution method for writing all known decompositions */
861 static
862 SCIP_DECL_DIALOGEXEC(GCGdialogExecWriteAllDecompositions)
863 {
864  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
865 
866  if( SCIPgetStage(scip) >= SCIP_STAGE_PROBLEM )
867  {
868  SCIP_CALL( writeAllDecompositions(scip, dialog, dialoghdlr, nextdialog, TRUE, TRUE) );
869  }
870  else
871  SCIPdialogMessage(scip, NULL, "no problem available\n");
872 
873  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
874 
875  return SCIP_OKAY;
876 }
877 
878 
879 /** dialog execution method for writing selected decompositions */
880 static
881 SCIP_DECL_DIALOGEXEC(GCGdialogExecWriteSelectedDecompositions)
882 {
883  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
884 
885  if( SCIPgetStage(scip) >= SCIP_STAGE_PROBLEM )
886  {
887  SCIP_CALL( writeSelectedDecompositions(scip, dialog, dialoghdlr, nextdialog ) );
888  }
889  else
890  SCIPdialogMessage(scip, NULL, "no problem available\n");
891 
892  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
893 
894  return SCIP_OKAY;
895 }
896 
897 
898 /** dialog execution method for writing the original matrix */
899 static
900 SCIP_DECL_DIALOGEXEC(GCGdialogExecWriteOrigMatrix)
901 {
902  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
903 
904  if( SCIPgetStage(scip) >= SCIP_STAGE_PROBLEM )
905  {
906  SCIP_CALL( writeMatrix(scip, dialog, dialoghdlr, nextdialog, TRUE) );
907  }
908  else
909  SCIPdialogMessage(scip, NULL, "No problem available.\n");
910 
911  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
912 
913  return SCIP_OKAY;
914 }
915 
916 /** dialog execution method for writing the transformed matrix */
917 static
918 SCIP_DECL_DIALOGEXEC(GCGdialogExecWriteTransMatrix)
919 {
920  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
921 
922  if( SCIPgetStage(scip) >= SCIP_STAGE_PRESOLVED )
923  {
924  SCIP_CALL( writeMatrix(scip, dialog, dialoghdlr, nextdialog, FALSE) );
925  }
926  else
927  SCIPdialogMessage(scip, NULL, "No transformed problem available.\n");
928 
929  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
930 
931  return SCIP_OKAY;
932 }
933 
934 
935 
936 /** dialog execution method for reporting all known decompositions in a PDF file */
937 static
938 SCIP_DECL_DIALOGEXEC(GCGdialogExecReportAllDecompositions)
939 {
940  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
941 
942  if( SCIPgetStage(scip) >= SCIP_STAGE_PROBLEM )
943  {
944  SCIP_CALL( reportAllDecompositions(scip, dialog, dialoghdlr, nextdialog) );
945  }
946  else
947  SCIPdialogMessage(scip, NULL, "no problem available\n");
948 
949  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
950 
951  return SCIP_OKAY;
952 }
953 
954 /** dialog execution method for writing problem statistics */
955 static
956 SCIP_DECL_DIALOGEXEC(GCGdialogExecWriteStatistics)
957 {
958  char* filename;
959  SCIP_Bool endoffile;
960 
961  SCIPdialogMessage(scip, NULL, "\n");
962 
963  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
964  if( endoffile )
965  {
966  *nextdialog = NULL;
967  return SCIP_OKAY;
968  }
969  if( filename[0] != '\0' )
970  {
971  FILE* file;
972 
973  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
974 
975  file = fopen(filename, "w");
976  if( file == NULL )
977  {
978  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
979  SCIPprintSysError(filename);
980  SCIPdialoghdlrClearBuffer(dialoghdlr);
981  }
982  else
983  {
984  SCIP_RETCODE retcode;
985  retcode = GCGprintStatistics(scip, file);
986  if( retcode != SCIP_OKAY )
987  {
988  fclose(file);
989  SCIP_CALL( retcode );
990  }
991  else
992  {
993  SCIPdialogMessage(scip, NULL, "written statistics to file <%s>\n", filename);
994  fclose(file);
995  }
996  }
997  }
998 
999  SCIPdialogMessage(scip, NULL, "\n");
1000 
1001  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1002 
1003  return SCIP_OKAY;
1004 }
1005 /** dialog execution method for the set detectors aggressive command */
1006 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetDetectorsAggressive)
1007 { /*lint --e{715}*/
1008  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1009 
1010  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1011 
1012  SCIP_CALL( GCGconshdlrDecompSetDetection(scip, SCIP_PARAMSETTING_AGGRESSIVE, FALSE) );
1013 
1014  return SCIP_OKAY;
1015 }
1016 
1017 /** dialog execution method for the set detectors default command */
1018 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetDetectorsDefault)
1019 { /*lint --e{715}*/
1020  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1021 
1022  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1023 
1024  SCIP_CALL( GCGconshdlrDecompSetDetection(scip, SCIP_PARAMSETTING_DEFAULT, FALSE) );
1025 
1026  return SCIP_OKAY;
1027 }
1028 
1029 /** dialog execution method for the set detectors off command */
1030 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetDetectorsOff)
1031 { /*lint --e{715}*/
1032  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1033 
1034  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1035 
1036  SCIP_CALL( GCGconshdlrDecompSetDetection(scip, SCIP_PARAMSETTING_OFF, FALSE) );
1037 
1038  return SCIP_OKAY;
1039 }
1040 
1041 /** dialog execution method for the set detectors fast command */
1042 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetDetectorsFast)
1043 { /*lint --e{715}*/
1044  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1045 
1046  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1047 
1048  SCIP_CALL( GCGconshdlrDecompSetDetection(scip, SCIP_PARAMSETTING_FAST, FALSE) );
1049 
1050  return SCIP_OKAY;
1051 }
1052 
1053 /** dialog execution method for the set heuristics aggressive command */
1054 SCIP_DECL_DIALOGEXEC(GCGdialogExecSetHeuristicsAggressive)
1055 { /*lint --e{715}*/
1056  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1057 
1058  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1059 
1060  SCIP_CALL( SCIPsetHeuristics(scip, SCIP_PARAMSETTING_AGGRESSIVE, FALSE) );
1061  SCIP_CALL( GCGsetHeuristics(scip, SCIP_PARAMSETTING_AGGRESSIVE) );
1062 
1063  return SCIP_OKAY;
1064 }
1065 
1066 /** dialog execution method for the set heuristics off command */
1067 SCIP_DECL_DIALOGEXEC(GCGdialogExecSetHeuristicsOff)
1068 { /*lint --e{715}*/
1069  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1070 
1071  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1072 
1073  SCIP_CALL( SCIPsetHeuristics(scip, SCIP_PARAMSETTING_OFF, FALSE) );
1074  SCIP_CALL( GCGsetHeuristics(scip, SCIP_PARAMSETTING_OFF) );
1075 
1076  return SCIP_OKAY;
1077 }
1078 
1079 /** dialog execution method for the set heuristics fast command */
1080 SCIP_DECL_DIALOGEXEC(GCGdialogExecSetHeuristicsFast)
1081 { /*lint --e{715}*/
1082  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1083 
1084  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1085 
1086  SCIP_CALL( SCIPsetHeuristics(scip, SCIP_PARAMSETTING_FAST, FALSE) );
1087  SCIP_CALL( GCGsetHeuristics(scip, SCIP_PARAMSETTING_FAST) );
1088 
1089  return SCIP_OKAY;
1090 }
1091 
1092 /** dialog execution method for the set gcg separators default command */
1093 SCIP_DECL_DIALOGEXEC(GCGdialogExecSetSeparatorsDefault)
1094 { /*lint --e{715}*/
1095  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1096 
1097  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1098 
1099  SCIP_CALL( GCGsetSeparators(scip, SCIP_PARAMSETTING_DEFAULT) );
1100 
1101  return SCIP_OKAY;
1102 }
1103 
1104 /** dialog execution method for the set gcg separators aggressive command */
1105 SCIP_DECL_DIALOGEXEC(GCGdialogExecSetSeparatorsAggressive)
1106 { /*lint --e{715}*/
1107  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1108 
1109  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1110 
1111  SCIP_CALL( GCGsetSeparators(scip, SCIP_PARAMSETTING_AGGRESSIVE) );
1112 
1113  return SCIP_OKAY;
1114 }
1115 
1116 /** dialog execution method for the set gcg separators off command */
1117 SCIP_DECL_DIALOGEXEC(GCGdialogExecSetSeparatorsOff)
1118 { /*lint --e{715}*/
1119  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1120 
1121  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1122 
1123  SCIP_CALL( GCGsetSeparators(scip, SCIP_PARAMSETTING_OFF) );
1124 
1125  return SCIP_OKAY;
1126 }
1127 
1128 /** dialog execution method for the set gcg separators fast command */
1129 SCIP_DECL_DIALOGEXEC(GCGdialogExecSetSeparatorsFast)
1130 { /*lint --e{715}*/
1131  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1132 
1133  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1134 
1135  SCIP_CALL( GCGsetSeparators(scip, SCIP_PARAMSETTING_FAST) );
1136 
1137  return SCIP_OKAY;
1138 }
1139 
1140 /** creates a root dialog
1141  * @returns SCIP return code */
1142 SCIP_RETCODE GCGcreateRootDialog(
1143  SCIP* scip, /**< SCIP data structure */
1144  SCIP_DIALOG** root /**< pointer to store the root dialog */
1145  )
1146 {
1147  SCIP_CALL( SCIPincludeDialog(scip, root, NULL, SCIPdialogExecMenuLazy, NULL, NULL,
1148  "GCG", "GCG's main menu", TRUE, NULL) );
1149 
1150  SCIP_CALL( SCIPsetRootDialog(scip, *root) );
1151  SCIP_CALL( SCIPreleaseDialog(scip, root) );
1152  *root = SCIPgetRootDialog(scip);
1153 
1154  return SCIP_OKAY;
1155 }
1156 
1157 /** create an "emphasis" sub menu
1158  * @returns SCIP return code */
1159 static
1161  SCIP* scip, /**< SCIP data structure */
1162  SCIP_DIALOG* root, /**< the menu to add the empty sub menu */
1163  SCIP_DIALOG** submenu /**< pointer to store the created emphasis sub menu */
1164  )
1165 {
1166  if( !SCIPdialogHasEntry(root, "emphasis") )
1167  {
1168  SCIP_CALL( SCIPincludeDialog(scip, submenu,
1169  NULL, SCIPdialogExecMenu, NULL, NULL,
1170  "emphasis", "predefined parameter settings", TRUE, NULL) );
1171  SCIP_CALL( SCIPaddDialogEntry(scip, root, *submenu) );
1172  SCIP_CALL( SCIPreleaseDialog(scip, submenu) );
1173  }
1174  else if( SCIPdialogFindEntry(root, "emphasis", submenu) != 1 )
1175  {
1176  SCIPerrorMessage("emphasis sub menu not found\n");
1177  return SCIP_PLUGINNOTFOUND;
1178  }
1179 
1180  assert(*submenu != NULL);
1181 
1182  return SCIP_OKAY;
1183 }
1184 
1185 /** includes or updates the GCG dialog menus in SCIP
1186  * @returns SCIP return code */
1188  SCIP* scip /**< SCIP data structure */
1189  )
1190 {
1191  SCIP_DIALOG* root;
1192  SCIP_DIALOG* submenu;
1193  SCIP_DIALOG* dialog;
1194  SCIP_DIALOG* setmenu;
1195  SCIP_DIALOG* emphasismenu;
1196  SCIP_DIALOG* classimenu;
1197  SCIP_DIALOG* blocknrmenu;
1198 
1199  /* root menu */
1200  root = SCIPgetRootDialog(scip);
1201  if( root == NULL )
1202  {
1203  SCIP_CALL( GCGcreateRootDialog(scip, &root) );
1204  }
1205 
1206  /* display */
1207  if( !SCIPdialogHasEntry(root, "display") )
1208  {
1209  SCIP_CALL( SCIPincludeDialog(scip, &submenu, NULL, SCIPdialogExecMenu, NULL, NULL,
1210  "display", "display information", TRUE, NULL) );
1211  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
1212  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
1213  }
1214  if( SCIPdialogFindEntry(root, "display", &submenu) != 1 )
1215  {
1216  SCIPerrorMessage("display sub menu not found\n");
1217  return SCIP_PLUGINNOTFOUND;
1218  }
1219 
1220  /* display statistics */
1221  if( !SCIPdialogHasEntry(submenu, "statistics") )
1222  {
1223  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecDisplayStatistics, NULL, NULL,
1224  "statistics", "display problem and optimization statistics", FALSE, NULL) );
1225  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1226  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1227  }
1228  /* display statistics */
1229  if( !SCIPdialogHasEntry(submenu, "detectionstatistics") )
1230  {
1231  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecPrintDetectionInformation, NULL, NULL,
1232  "detectionstatistics", "display complete detection information", FALSE, NULL) );
1233  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1234  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1235  }
1236 
1237  /* display decomposition */
1238  if( !SCIPdialogHasEntry(submenu, "decomposition") )
1239  {
1240  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecDisplayDecomposition, NULL, NULL,
1241  "decomposition", "display decomposition", FALSE, NULL) );
1242  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1243  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1244  }
1245 
1246  /* display nblockcandidates */
1247  if( !SCIPdialogHasEntry(submenu, "blocknumbercandidates") )
1248  {
1249  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecDisplayNBlockcandidates, NULL, NULL,
1250  "blocknumbercandidates", "display number of blocks candidates ", FALSE, NULL) );
1251  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1252  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1253  }
1254 
1255  /* display additionalstatistics */
1256  if( !SCIPdialogHasEntry(submenu, "additionalstatistics") )
1257  {
1258  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecDisplayAdditionalStatistics, NULL, NULL,
1259  "additionalstatistics", "display additional solving statistics", FALSE, NULL) );
1260  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1261  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1262  }
1263 
1264  /* display solvers */
1265  if( !SCIPdialogHasEntry(submenu, "solvers") )
1266  {
1267  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecDisplaySolvers, NULL, NULL,
1268  "solvers", "display available pricing problem solvers", FALSE, NULL) );
1269  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1270  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1271  }
1272 
1273  /* master */
1274  if( !SCIPdialogHasEntry(root, "master") )
1275  {
1276  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecSetMaster, NULL, NULL,
1277  "master", "switch to the interactive shell of the master problem", FALSE, NULL) );
1278  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
1279  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1280  }
1281 
1282  /* transform */
1283  if( !SCIPdialogHasEntry(root, "transform") )
1284  {
1285  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1286  NULL,
1287  GCGdialogExecTransform, NULL, NULL,
1288  "transform", "transform the problem", FALSE, NULL) );
1289  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
1290  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1291  }
1292 
1293  /* presolve */
1294  if( !SCIPdialogHasEntry(root, "presolve") )
1295  {
1296  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1297  NULL,
1298  GCGdialogExecPresolve, NULL, NULL,
1299  "presolve", "presolve the problem", FALSE, NULL) );
1300  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
1301  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1302  }
1303 
1304  /* optimize */
1305  if( !SCIPdialogHasEntry(root, "optimize") )
1306  {
1307  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1308  NULL,
1309  GCGdialogExecOptimize, NULL, NULL,
1310  "optimize", "solve the problem", FALSE, NULL) );
1311  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
1312  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1313  }
1314 
1315  /* explore */
1316  if( !SCIPdialogHasEntry(root, "explore") )
1317  {
1318  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
1319  NULL,
1320  GCGdialogExecSelect, NULL, NULL,
1321  "explore", "explore decompositions", FALSE, NULL) );
1322  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
1323  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
1324  }
1325 
1326  /* detect */
1327  if( !SCIPdialogHasEntry(root, "detect") )
1328  {
1329  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecDetect, NULL, NULL,
1330  "detect", "detect structure", FALSE, NULL) );
1331  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
1332  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1333  }
1334 
1335  /* quit */
1336  if( !SCIPdialogHasEntry(root, "quit") )
1337  {
1338  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1339  NULL,
1340  SCIPdialogExecQuit, NULL, NULL,
1341  "quit", "leave GCG", FALSE, NULL) );
1342  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
1343  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1344  }
1345 
1346  /* set */
1347  if( !SCIPdialogHasEntry(root, "set") )
1348  {
1349  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
1350  NULL, SCIPdialogExecMenu, NULL, NULL,
1351  "set", "load/save/change parameters", TRUE, NULL) );
1352  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
1353  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
1354  }
1355  if( SCIPdialogFindEntry(root, "set", &setmenu) != 1 )
1356  {
1357  SCIPerrorMessage("set sub menu not found\n");
1358  return SCIP_PLUGINNOTFOUND;
1359  }
1360 
1361  /* set loadmaster */
1362  if( !SCIPdialogHasEntry(setmenu, "loadmaster") )
1363  {
1364  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1365  NULL,
1366  GCGdialogExecSetLoadmaster, NULL, NULL,
1367  "loadmaster", "load parameter settings for master problem from a file", FALSE, NULL) );
1368  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, dialog) );
1369  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1370  }
1371 
1372  /* set detectors */
1373  if( !SCIPdialogHasEntry(setmenu, "detection") )
1374  {
1375  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
1376  NULL,
1377  SCIPdialogExecMenu, NULL, NULL,
1378  "detection", "change parameters for detection in general", TRUE, NULL) );
1379  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
1380  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
1381  }
1382  if( SCIPdialogFindEntry(setmenu, "detection", &submenu) != 1 )
1383  {
1384  SCIPerrorMessage("detection sub menu not found\n");
1385  return SCIP_PLUGINNOTFOUND;
1386  }
1387 
1388  if( !SCIPdialogHasEntry(submenu, "classification") )
1389  {
1390  SCIP_CALL( SCIPincludeDialog(scip, &classimenu,
1391  NULL, SCIPdialogExecMenu, NULL, NULL,
1392  "classification", "classification settings", TRUE, NULL) );
1393  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, classimenu) );
1394  SCIP_CALL( SCIPreleaseDialog(scip, &classimenu) );
1395  }
1396  else if( SCIPdialogFindEntry(submenu, "classification", &classimenu) != 1 )
1397  {
1398  SCIPerrorMessage("classification sub menu not found\n");
1399  return SCIP_PLUGINNOTFOUND;
1400  }
1401 
1402  if( !SCIPdialogHasEntry(submenu, "blocknrcandidates") )
1403  {
1404  SCIP_CALL( SCIPincludeDialog(scip, &blocknrmenu,
1405  NULL, SCIPdialogExecMenu, NULL, NULL,
1406  "blocknrcandidates", "set block number and related parameter", TRUE, NULL) );
1407  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, blocknrmenu) );
1408  SCIP_CALL( SCIPreleaseDialog(scip, &blocknrmenu) );
1409  }
1410  else if( SCIPdialogFindEntry(submenu, "blocknrcandidates", &blocknrmenu) != 1 )
1411  {
1412  SCIPerrorMessage("blocknrcandidates sub menu not found\n");
1413  return SCIP_PLUGINNOTFOUND;
1414  }
1415 
1416  /* create set detectors emphasis */
1417  SCIP_CALL( createEmphasisSubmenu(scip, submenu, &emphasismenu) );
1418  assert(emphasismenu != NULL);
1419 
1420  /* set detectors emphasis aggressive */
1421  if( !SCIPdialogHasEntry(emphasismenu, "aggressive") )
1422  {
1423  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1424  NULL, SCIPdialogExecSetDetectorsAggressive, NULL, NULL,
1425  "aggressive", "sets detection <aggressive>", FALSE, NULL) );
1426  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
1427  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1428  }
1429 
1430  /* set detectors emphasis default */
1431  if( !SCIPdialogHasEntry(emphasismenu, "default") )
1432  {
1433  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1434  NULL, SCIPdialogExecSetDetectorsDefault, NULL, NULL,
1435  "default", "sets detection <default>", FALSE, NULL) );
1436  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
1437  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1438  }
1439 
1440  /* set detectors emphasis fast */
1441  if( !SCIPdialogHasEntry(emphasismenu, "fast") )
1442  {
1443  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1444  NULL, SCIPdialogExecSetDetectorsFast, NULL, NULL,
1445  "fast", "sets detection <fast>", FALSE, NULL) );
1446  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
1447  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1448  }
1449 
1450  /* set detectors emphasis off */
1451  if( !SCIPdialogHasEntry(emphasismenu, "off") )
1452  {
1453  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1454  NULL, SCIPdialogExecSetDetectorsOff, NULL, NULL,
1455  "off", "turns <off> all detectors", FALSE, NULL) );
1456  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
1457  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1458  }
1459 
1460  /* set heuristics */
1461  if( !SCIPdialogHasEntry(setmenu, "heuristics") )
1462  {
1463  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
1464  NULL,
1465  SCIPdialogExecMenu, NULL, NULL,
1466  "heuristics", "change parameters for primal heuristics", TRUE, NULL) );
1467  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
1468  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
1469  }
1470  if( SCIPdialogFindEntry(setmenu, "heuristics", &submenu) != 1 )
1471  {
1472  SCIPerrorMessage("heuristics sub menu not found\n");
1473  return SCIP_PLUGINNOTFOUND;
1474  }
1475 
1476  /* create set heuristics emphasis */
1477  SCIP_CALL( createEmphasisSubmenu(scip, submenu, &emphasismenu) );
1478  assert(emphasismenu != NULL);
1479 
1480  /* set heuristics emphasis aggressive */
1481  if( !SCIPdialogHasEntry(emphasismenu, "aggressive") )
1482  {
1483  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1484  NULL, GCGdialogExecSetHeuristicsAggressive, NULL, NULL,
1485  "aggressive", "sets heuristics <aggressive>", FALSE, NULL) );
1486  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
1487  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1488  }
1489 
1490  /* set heuristics emphasis fast */
1491  if( !SCIPdialogHasEntry(emphasismenu, "fast") )
1492  {
1493  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1494  NULL, GCGdialogExecSetHeuristicsFast, NULL, NULL,
1495  "fast", "sets heuristics <fast>", FALSE, NULL) );
1496  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
1497  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1498  }
1499 
1500  /* set heuristics emphasis off */
1501  if( !SCIPdialogHasEntry(emphasismenu, "off") )
1502  {
1503  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1504  NULL, GCGdialogExecSetHeuristicsOff, NULL, NULL,
1505  "off", "turns <off> all heuristics", FALSE, NULL) );
1506  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
1507  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1508  }
1509 
1510  /* set heuristics */
1511  if( !SCIPdialogHasEntry(setmenu, "sepa") )
1512  {
1513  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
1514  NULL,
1515  SCIPdialogExecMenu, NULL, NULL,
1516  "sepa", "change parameters for gcg separators", TRUE, NULL) );
1517  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
1518  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
1519  }
1520  if( SCIPdialogFindEntry(setmenu, "sepa", &submenu) != 1 )
1521  {
1522  SCIPerrorMessage("gcg separators sub menu not found\n");
1523  return SCIP_PLUGINNOTFOUND;
1524  }
1525 
1526  /* create set separators emphasis */
1527  SCIP_CALL( createEmphasisSubmenu(scip, submenu, &emphasismenu) );
1528  assert(emphasismenu != NULL);
1529 
1530  /* set separators emphasis default */
1531  if( !SCIPdialogHasEntry(emphasismenu, "default") )
1532  {
1533  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1534  NULL, GCGdialogExecSetSeparatorsDefault, NULL, NULL,
1535  "default", "sets separators <default>", FALSE, NULL) );
1536  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
1537  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1538  }
1539 
1540  /* set separators emphasis aggressive */
1541  if( !SCIPdialogHasEntry(emphasismenu, "aggressive") )
1542  {
1543  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1544  NULL, GCGdialogExecSetSeparatorsAggressive, NULL, NULL,
1545  "aggressive", "sets separators <aggressive>", FALSE, NULL) );
1546  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
1547  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1548  }
1549 
1550  /* set separators emphasis fast */
1551  if( !SCIPdialogHasEntry(emphasismenu, "fast") )
1552  {
1553  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1554  NULL, GCGdialogExecSetSeparatorsFast, NULL, NULL,
1555  "fast", "sets separators <fast>", FALSE, NULL) );
1556  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
1557  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1558  }
1559 
1560  /* set separators emphasis off */
1561  if( !SCIPdialogHasEntry(emphasismenu, "off") )
1562  {
1563  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1564  NULL, GCGdialogExecSetSeparatorsOff, NULL, NULL,
1565  "off", "turns <off> all separators", FALSE, NULL) );
1566  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
1567  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1568  }
1569 
1570  /* write */
1571  if( !SCIPdialogHasEntry(root, "write") )
1572  {
1573  SCIP_CALL( SCIPincludeDialog(scip, &submenu, NULL, SCIPdialogExecMenu, NULL, NULL,
1574  "write", "write information to file", TRUE, NULL) );
1575  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
1576  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
1577  }
1578  if( SCIPdialogFindEntry(root, "write", &submenu) != 1 )
1579  {
1580  SCIPerrorMessage("write sub menu not found\n");
1581  return SCIP_PLUGINNOTFOUND;
1582  }
1583 
1584  /* write alldecompositions */
1585  if( !SCIPdialogHasEntry(submenu, "alldecompositions") )
1586  {
1587  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecWriteAllDecompositions, NULL, NULL,
1588  "alldecompositions",
1589  "write all known decompositions to files (format is given by file extension, e.g. {dec,blk,ref,gp,tex})",
1590  FALSE, NULL) );
1591  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1592  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1593  }
1594 
1595  /* write selecteddecompositions */
1596  if( !SCIPdialogHasEntry(submenu, "selected") )
1597  {
1598  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecWriteSelectedDecompositions, NULL, NULL,
1599  "selected",
1600  "write selected (in \"explore\" submenu) decompositions to files (format is given by file extension, e.g. {dec,blk,ref,gp,tex})",
1601  FALSE, NULL) );
1602  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1603  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1604  }
1605 
1606  /* write orig matrix */
1607  if( !SCIPdialogHasEntry(submenu, "matrix") )
1608  {
1609  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecWriteOrigMatrix, NULL, NULL,
1610  "matrix",
1611  "write gnuplot file showing the nonzero structure of the original matrix",
1612  FALSE, NULL) );
1613  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1614  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1615  }
1616 
1617  /* write orig matrix */
1618  if( !SCIPdialogHasEntry(submenu, "transmatrix") )
1619  {
1620  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecWriteTransMatrix, NULL, NULL,
1621  "transmatrix",
1622  "write gnuplot file showing the nonzero structure of the transformed (presolved) matrix",
1623  FALSE, NULL) );
1624  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1625  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1626  }
1627 
1628  /* write reportdecompositions */
1629  if( !SCIPdialogHasEntry(submenu, "report") )
1630  {
1631  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecReportAllDecompositions, NULL, NULL,
1632  "report",
1633  "write report of all finished decompositions to LaTeX format",
1634  FALSE, NULL) );
1635  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1636  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1637  }
1638 
1639  /* write statistics */
1640  if( !SCIPdialogHasEntry(submenu, "statistics") )
1641  {
1642  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, GCGdialogExecWriteStatistics, NULL, NULL,
1643  "statistics",
1644  "write statistics to file",
1645  FALSE, NULL) );
1646  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
1647  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1648  }
1649 
1650  /* change */
1651  if( !SCIPdialogHasEntry(root, "change") )
1652  {
1653  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
1654  NULL,
1655  SCIPdialogExecMenu, NULL, NULL,
1656  "change", "change the problem", TRUE, NULL) );
1657  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
1658  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
1659  }
1660  if( SCIPdialogFindEntry(root, "change", &submenu) != 1 )
1661  {
1662  SCIPerrorMessage("change sub menu not found\n");
1663  return SCIP_PLUGINNOTFOUND;
1664  }
1665 
1666  if( SCIPdialogFindEntry(root, "set", &submenu) != 1 )
1667  {
1668  SCIPerrorMessage("set sub menu not found\n");
1669  return SCIP_PLUGINNOTFOUND;
1670  }
1671  if( SCIPdialogFindEntry(submenu, "detection", &submenu) != 1 )
1672  {
1673  SCIPerrorMessage("set/detection sub menu not found\n");
1674  return SCIP_PLUGINNOTFOUND;
1675  }
1676  if( SCIPdialogFindEntry(submenu, "blocknrcandidates", &blocknrmenu) != 1 )
1677  {
1678  SCIPerrorMessage("set/detection/blocknrcandidates sub menu not found\n");
1679  return SCIP_PLUGINNOTFOUND;
1680  }
1681 
1682  /* add blocknr candidate*/
1683  if( !SCIPdialogHasEntry(blocknrmenu, "addblocknr") )
1684  {
1685  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
1686  NULL,
1687  GCGdialogExecChangeAddBlocknr, NULL, NULL,
1688  "addblocknr", "add block number candidates (as white space separated list)", FALSE, NULL) );
1689  SCIP_CALL( SCIPaddDialogEntry(scip, blocknrmenu, dialog) );
1690  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
1691  }
1692 
1693  SCIP_CALL( SCIPincludeDialogDefaultBasic(scip) );
1694 
1695  return SCIP_OKAY;
1696 }
static SCIP_RETCODE writeAllDecompositions(SCIP *scip, SCIP_DIALOG *dialog, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG **nextdialog, SCIP_Bool original, SCIP_Bool presolved)
Definition: dialog_gcg.c:102
SCIP_RETCODE GCGWriteGpDecompMatrix(SCIP *scip, const char *filename, const char *workfolder, SCIP_Bool originalmatrix)
Definition: reader_gp.cpp:496
void GCGconshdlrDecompAddUserCandidatesNBlocks(SCIP *scip, int candidate)
adds a candidate for block size given by the user
DEC_DECTYPE DECdecompGetType(DEC_DECOMP *decomp)
Definition: decomp.c:691
GCG interface methods.
SCIP_RETCODE GCGcreateRootDialog(SCIP *scip, SCIP_DIALOG **root)
Definition: dialog_gcg.c:1142
SCIP_RETCODE DECwriteAllDecomps(SCIP *scip, char *directory, char *extension, SCIP_Bool original, SCIP_Bool presolved)
write out all known decompositions
constraint handler for structure detection
SCIP_Bool GCGgetUseGp(SCIP *scip)
Definition: params_visu.c:592
SCIP_RETCODE GCGdialogExecExplore(SCIP *scip, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG *dialog)
method to handle user input for "explore" command
SCIP_RETCODE GCGsolve(SCIP *scip)
Definition: relax_gcg.c:5341
static SCIP_RETCODE reportAllDecompositions(SCIP *scip, SCIP_DIALOG *dialog, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG **nextdialog)
Definition: dialog_gcg.c:367
SCIP_RETCODE GCGprintStatistics(SCIP *scip, FILE *file)
Definition: misc.c:685
SCIP_Bool GCGreportGetShowToc(SCIP *scip)
Definition: params_visu.c:660
static SCIP_RETCODE writeSelectedDecompositions(SCIP *scip, SCIP_DIALOG *dialog, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG **nextdialog)
Definition: dialog_gcg.c:193
SCIP_RETCODE GCGconshdlrDecompGetFinishedPartialdecsList(SCIP *scip, int **idlist, int *listlength)
Gets a list of ids of the current partialdecs that are finished.
void GCGpricerPrintListOfSolvers(SCIP *scip)
public methods for GCG separators
GCG variable pricer.
void DECprintListOfDetectors(SCIP *scip)
writes out a list of all detectors
SCIP_RETCODE GCGtransformProb(SCIP *scip)
Definition: relax_gcg.c:5199
SCIP_RETCODE GCGwriteDecompositionData(SCIP *scip)
Definition: stat.c:50
SCIP * GCGgetMasterprob(SCIP *scip)
Definition: relax_gcg.c:3920
static SCIP_RETCODE createEmphasisSubmenu(SCIP *scip, SCIP_DIALOG *root, SCIP_DIALOG **submenu)
Definition: dialog_gcg.c:1160
SCIP_RETCODE GCGwriteTexReport(SCIP *scip, FILE *file, int *partialdecids, int *npartialdecs, SCIP_Bool titlepage, SCIP_Bool toc, SCIP_Bool statistics, SCIP_Bool usegp)
Definition: reader_tex.cpp:675
SCIP_DECL_DIALOGEXEC(GCGdialogExecDisplayStatistics)
Definition: dialog_gcg.c:449
SCIP_RETCODE GCGprintCompleteDetectionStatistics(SCIP *scip, FILE *file)
Definition: misc.c:755
SCIP_RETCODE GCGsetSeparators(SCIP *scip, SCIP_PARAMSETTING paramsetting)
Definition: gcgsepa.c:179
SCIP_RETCODE DECdecompFree(SCIP *scip, DEC_DECOMP **decdecomp)
Definition: decomp.c:530
static SCIP_RETCODE writeMatrix(SCIP *scip, SCIP_DIALOG *dialog, SCIP_DIALOGHDLR *dialoghdlr, SCIP_DIALOG **nextdialog, SCIP_Bool originalmatrix)
Definition: dialog_gcg.c:281
SCIP_RETCODE GCGwriteVarCreationDetails(SCIP *scip)
Definition: stat.c:122
int GCGconshdlrDecompGetNDecomps(SCIP *scip)
gets the number of decompositions (= amount of finished partialdecs)
void GCGpricerPrintStatistics(SCIP *scip, FILE *file)
public methods for GCG heuristics
static void displayReaders(SCIP *scip, SCIP_Bool reader, SCIP_Bool writer)
Definition: dialog_gcg.c:64
GCG relaxator.
Prints information about the best decomposition.
SCIP_Bool GCGreportGetShowTitlepage(SCIP *scip)
Definition: params_visu.c:643
SCIP_RETCODE GCGdetect(SCIP *scip)
Definition: relax_gcg.c:5283
SCIP_RETCODE SCIPincludeDialogGcg(SCIP *scip)
Definition: dialog_gcg.c:1187
@ DEC_DECTYPE_DIAGONAL
Definition: type_decomp.h:52
GCG user interface dialog.
SCIP_RETCODE GCGprintBlockcandidateInformation(SCIP *scip, FILE *file)
SCIP_RETCODE GCGsetHeuristics(SCIP *scip, SCIP_PARAMSETTING paramsetting)
Definition: gcgheur.c:152
dialog menu for exploring decompositions
SCIP_Bool GCGreportGetShowStatistics(SCIP *scip)
Definition: params_visu.c:677
GP file reader writing decompositions to gnuplot files.
SCIP_RETCODE DECwriteSelectedDecomps(SCIP *scip, char *directory, char *extension)
writes all selected decompositions
parameter settings for visualization readers
SCIP_RETCODE GCGpresolve(SCIP *scip)
Definition: relax_gcg.c:5237
SCIP_RETCODE GCGconshdlrDecompSetDetection(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
sets detector parameters values
DEC_DECOMP * DECgetBestDecomp(SCIP *scip, SCIP_Bool printwarnings)
Gets the best known decomposition.