Scippy

SCIP

Solving Constraint Integer Programs

dialog_default.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file dialog_default.c
17  * @brief default user interface dialog
18  * @author Tobias Achterberg
19  * @author Timo Berthold
20  * @author Gerald Gamrath
21  */
22 
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
24 
25 #include <assert.h>
26 #include <string.h>
27 
28 #include "scip/dialog_default.h"
29 #include "nlpi/nlpi.h"
30 
31 
32 
33 /** executes a menu dialog */
34 static
36  SCIP* scip, /**< SCIP data structure */
37  SCIP_DIALOG* dialog, /**< dialog menu */
38  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
39  SCIP_DIALOG** nextdialog /**< pointer to store next dialog to execute */
40  )
41 {
42  char* command;
43  SCIP_Bool again;
44  SCIP_Bool endoffile;
45  int nfound;
46 
47  do
48  {
49  again = FALSE;
50 
51  /* get the next word of the command string */
52  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, NULL, &command, &endoffile) );
53  if( endoffile )
54  {
55  *nextdialog = NULL;
56  return SCIP_OKAY;
57  }
58 
59  /* exit to the root dialog, if command is empty */
60  if( command[0] == '\0' )
61  {
62  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
63  return SCIP_OKAY;
64  }
65  else if( strcmp(command, "..") == 0 )
66  {
67  *nextdialog = SCIPdialogGetParent(dialog);
68  if( *nextdialog == NULL )
69  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
70  return SCIP_OKAY;
71  }
72 
73  /* find command in dialog */
74  nfound = SCIPdialogFindEntry(dialog, command, nextdialog);
75 
76  /* check result */
77  if( nfound == 0 )
78  {
79  SCIPdialogMessage(scip, NULL, "command <%s> not available\n", command);
80  SCIPdialoghdlrClearBuffer(dialoghdlr);
81  *nextdialog = dialog;
82  }
83  else if( nfound >= 2 )
84  {
85  SCIPdialogMessage(scip, NULL, "\npossible completions:\n");
86  SCIP_CALL( SCIPdialogDisplayCompletions(dialog, scip, command) );
87  SCIPdialogMessage(scip, NULL, "\n");
88  SCIPdialoghdlrClearBuffer(dialoghdlr);
89  again = TRUE;
90  }
91  }
92  while( again );
93 
94  return SCIP_OKAY;
95 }
96 
97 
98 /* parse the given string to detect a Boolean value and returns it */
99 static
101  SCIP* scip, /**< SCIP data structure */
102  const char* valuestr, /**< string to parse */
103  SCIP_Bool* error /**< pointer to store the error result */
104  )
105 {
106  assert( scip != NULL );
107  assert( valuestr != NULL );
108  assert( error != NULL );
109 
110  *error = FALSE;
111 
112  switch( valuestr[0] )
113  {
114  case 'f':
115  case 'F':
116  case '0':
117  case 'n':
118  case 'N':
119  return FALSE;
120  case 't':
121  case 'T':
122  case '1':
123  case 'y':
124  case 'Y':
125  return TRUE;
126  default:
127  *error = TRUE;
128  break;
129  }
130 
131  return FALSE;
132 }
133 
134 
135 /* display the reader information */
136 static
138  SCIP* scip, /**< SCIP data structure */
139  SCIP_Bool reader, /**< display reader which can read */
140  SCIP_Bool writer /**< display reader which can write */
141  )
142 {
143  SCIP_READER** readers;
144  int nreaders;
145  int r;
146 
147  assert( scip != NULL );
148 
149  readers = SCIPgetReaders(scip);
150  nreaders = SCIPgetNReaders(scip);
151 
152  /* display list of readers */
153  SCIPdialogMessage(scip, NULL, "\n");
154  SCIPdialogMessage(scip, NULL, " file reader extension description\n");
155  SCIPdialogMessage(scip, NULL, " ----------- --------- -----------\n");
156  for( r = 0; r < nreaders; ++r )
157  {
158  if( (reader && SCIPreaderCanRead(readers[r])) || (writer && SCIPreaderCanWrite(readers[r])) )
159  {
160  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPreaderGetName(readers[r]));
161  if( strlen(SCIPreaderGetName(readers[r])) > 20 )
162  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
163  SCIPdialogMessage(scip, NULL, "%9s ", SCIPreaderGetExtension(readers[r]));
164  SCIPdialogMessage(scip, NULL, "%s", SCIPreaderGetDesc(readers[r]));
165  SCIPdialogMessage(scip, NULL, "\n");
166  }
167  }
168  SCIPdialogMessage(scip, NULL, "\n");
169 }
170 
171 
172 /* writes problem to file */
173 static
175  SCIP* scip, /**< SCIP data structure */
176  SCIP_DIALOG* dialog, /**< dialog menu */
177  SCIP_DIALOGHDLR* dialoghdlr, /**< dialog handler */
178  SCIP_DIALOG** nextdialog, /**< pointer to store next dialog to execute */
179  SCIP_Bool transformed, /**< output the transformed problem? */
180  SCIP_Bool genericnames /**< using generic variable and constraint names? */
181  )
182 {
183  char* filename;
184  SCIP_Bool endoffile;
185  SCIP_RETCODE retcode;
186 
187  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
188  if( endoffile )
189  {
190  *nextdialog = NULL;
191  return SCIP_OKAY;
192  }
193 
194  if( filename[0] != '\0' )
195  {
196  char* tmpfilename;
197  char* extension;
198 
199  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
200 
201  /* copy filename */
202  SCIP_CALL( SCIPduplicateBufferArray(scip, &tmpfilename, filename, (int)strlen(filename)+1) );
203  extension = NULL;
204 
205  do
206  {
207  if( transformed )
208  retcode = SCIPwriteTransProblem(scip, tmpfilename, extension, genericnames);
209  else
210  retcode = SCIPwriteOrigProblem(scip, tmpfilename, extension, genericnames);
211 
212  if( retcode == SCIP_FILECREATEERROR )
213  {
214  SCIPdialogMessage(scip, NULL, "error creating the file <%s>\n", filename);
215  SCIPdialoghdlrClearBuffer(dialoghdlr);
216  break;
217  }
218  else if(retcode == SCIP_WRITEERROR )
219  {
220  SCIPdialogMessage(scip, NULL, "error writing file <%s>\n", filename);
221  SCIPdialoghdlrClearBuffer(dialoghdlr);
222  break;
223  }
224  else if( retcode == SCIP_PLUGINNOTFOUND )
225  {
226  /* ask user once for a suitable reader */
227  if( extension == NULL )
228  {
229  SCIPdialogMessage(scip, NULL, "no reader for requested output format\n");
230 
231  SCIPdialogMessage(scip, NULL, "following readers are avaliable for writing:\n");
232  displayReaders(scip, FALSE, TRUE);
233 
234  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
235  "select a suitable reader by extension (or return): ", &extension, &endoffile) );
236 
237  if( extension[0] == '\0' )
238  break;
239  }
240  else
241  {
242  SCIPdialogMessage(scip, NULL, "no reader for output in <%s> format\n", extension);
243  extension = NULL;
244  }
245  }
246  else
247  {
248  /* check for unexpected errors */
249  SCIP_CALL( retcode );
250 
251  /* print result message if writing was successful */
252  if( transformed )
253  SCIPdialogMessage(scip, NULL, "written transformed problem to file <%s>\n", tmpfilename);
254  else
255  SCIPdialogMessage(scip, NULL, "written original problem to file <%s>\n", tmpfilename);
256  break;
257  }
258  }
259  while( extension != NULL );
260 
261  SCIPfreeBufferArray(scip, &tmpfilename);
262  }
263 
264  return SCIP_OKAY;
265 }
266 
267 /** copy method for dialog plugins (called when SCIP copies plugins) */
268 static
269 SCIP_DECL_DIALOGCOPY(dialogCopyDefault)
270 { /*lint --e{715}*/
271  assert(scip != NULL);
272  assert(dialog != NULL);
273 
274  /* call inclusion method of dialog */
276 
277  return SCIP_OKAY;
278 }
279 
280 /** standard menu dialog execution method, that displays it's help screen if the remaining command line is empty */
281 SCIP_DECL_DIALOGEXEC(SCIPdialogExecMenu)
282 { /*lint --e{715}*/
283  /* if remaining command string is empty, display menu of available options */
284  if( SCIPdialoghdlrIsBufferEmpty(dialoghdlr) )
285  {
286  SCIPdialogMessage(scip, NULL, "\n");
288  SCIPdialogMessage(scip, NULL, "\n");
289  }
290 
291  SCIP_CALL( dialogExecMenu(scip, dialog, dialoghdlr, nextdialog) );
292 
293  return SCIP_OKAY;
294 }
295 
296 /** standard menu dialog execution method, that doesn't display it's help screen */
297 SCIP_DECL_DIALOGEXEC(SCIPdialogExecMenuLazy)
298 { /*lint --e{715}*/
299  SCIP_CALL( dialogExecMenu(scip, dialog, dialoghdlr, nextdialog) );
300 
301  return SCIP_OKAY;
302 }
303 
304 /** dialog execution method for the change add constraint */
305 SCIP_DECL_DIALOGEXEC(SCIPdialogExecChangeAddCons)
306 { /*lint --e{715}*/
307 
309  SCIPdialogMessage(scip, NULL, "cannot call method after problem was transformed\n");
310  else if( SCIPgetStage(scip) < SCIP_STAGE_PROBLEM )
311  SCIPdialogMessage(scip, NULL, "cannot call method before problem was created\n");
312  else
313  {
314  SCIP_CONS* cons;
315  SCIP_Bool endoffile;
316  char* str;
317 
318  cons = NULL;
319 
320  SCIP_CALL( SCIPdialoghdlrGetLine(dialoghdlr, dialog, "write constraint in <cip> format\n", &str, &endoffile) );
321 
322  if( str[0] != '\0' )
323  {
324  SCIP_Bool success;
325 
326  printf("<%s>\n", str);
327 
328  SCIP_CALL( SCIPparseCons(scip, &cons, str, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, &success) );
329 
330  if( success )
331  {
332  char consstr[SCIP_MAXSTRLEN];
333 
334  /* add and release constraint */
335  SCIP_CALL( SCIPaddCons(scip, cons) );
336  SCIP_CALL( SCIPreleaseCons(scip, &cons) );
337 
338  SCIPdialogMessage(scip, NULL, "successfully added constraint\n");
339  SCIPescapeString(consstr, SCIP_MAXSTRLEN, str);
340 
341  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, consstr, FALSE) );
342  }
343  else
344  {
345  SCIPdialogMessage(scip, NULL, "constraint was not recognizable\n");
346  }
347  }
348  }
349 
350  /* set root dialog as next dialog */
351  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
352 
353  return SCIP_OKAY;
354 }
355 
356 /** dialog execution method for the change bounds command */
357 SCIP_DECL_DIALOGEXEC(SCIPdialogExecChangeBounds)
358 { /*lint --e{715}*/
359 
361  SCIPdialogMessage(scip, NULL, "cannot call method after problem was transformed\n");
362  else if( SCIPgetStage(scip) < SCIP_STAGE_PROBLEM )
363  SCIPdialogMessage(scip, NULL, "cannot call method before problem was created\n");
364  else
365  {
366  SCIP_VAR* var;
367  SCIP_Bool endoffile;
368  char* varname;
369 
370  var = NULL;
371 
372  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
373 
374  do
375  {
376  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter variable name: ", &varname, &endoffile) );
377 
378  /* if we get a return or we reached the end of the file, then we stop */
379  if( varname[0] == '\0' || endoffile )
380  break;
381 
382  var = SCIPfindVar(scip, varname);
383 
384  if( var == NULL )
385  SCIPdialogMessage(scip, NULL, "variable <%s> does not exist\n", varname);
386  }
387  while( var == NULL );
388 
389  if( var != NULL )
390  {
391  do
392  {
393  char* boundstr;
394  char message[SCIP_MAXSTRLEN];
396 
397  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, varname, FALSE) );
398 
399  (void)SCIPsnprintf(message, SCIP_MAXSTRLEN, "current lower bound <%.15g> (Return to skip): ", SCIPvarGetLbGlobal(var));
400  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, message, &boundstr, &endoffile) );
401 
402  /* if we reached the end of the file, then we stop */
403  if( endoffile )
404  break;
405 
406  if( boundstr[0] != '\0' )
407  {
408  char* endptr;
409 
410  bound = strtod(boundstr, &endptr);
411  if( endptr == boundstr || *endptr != '\0' )
412  {
413  printf("<%s> <%s>\n", endptr, boundstr);
414  SCIPdialogMessage(scip, NULL, "ignore none value string\n");
415  }
416  else if( SCIPisGT(scip, bound, SCIPvarGetUbGlobal(var)) )
417  {
418  SCIPdialogMessage(scip, NULL, "ignore lower bound <%.15g> since it is larger than the current upper bound <%.15g>\n",
419  bound, SCIPvarGetUbGlobal(var));
420  }
421  else
422  {
423  SCIP_CALL( SCIPchgVarLbGlobal(scip, var, bound) );
424  }
425  }
426 
427  (void)SCIPsnprintf(message, SCIP_MAXSTRLEN, "current upper bound <%.15g> (Return to skip): ", SCIPvarGetUbGlobal(var));
428  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, message, &boundstr, &endoffile) );
429 
430  /* if we reached the end of the file, then we stop */
431  if( endoffile )
432  break;
433 
434  if( boundstr[0] != '\0' )
435  {
436  char* endptr;
437 
438  bound = strtod(boundstr, &endptr);
439  if( endptr == boundstr || *endptr != '\0' )
440  {
441  SCIPdialogMessage(scip, NULL, "ignore none value string\n");
442  }
443  else if( SCIPisLT(scip, bound, SCIPvarGetLbGlobal(var)) )
444  {
445  SCIPdialogMessage(scip, NULL, "ignore new upper bound <%.15g> since it is smaller than the current lower bound <%.15g>\n",
446  bound, SCIPvarGetLbGlobal(var));
447  }
448  else
449  {
450  SCIP_CALL( SCIPchgVarUbGlobal(scip, var, bound) );
451  }
452  }
453  }
454  while( FALSE);
455 
456  SCIPdialogMessage(scip, NULL, "variable <%s> global bounds [%.15g,%.15g]\n", SCIPvarGetName(var), SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var));
457  }
458  }
459 
460  /* set root dialog as next dialog */
461  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
462 
463  return SCIP_OKAY;
464 }
465 
466 /** dialog execution method for the freetransproblem command */
467 SCIP_DECL_DIALOGEXEC(SCIPdialogExecChangeFreetransproblem)
468 { /*lint --e{715}*/
469  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
470 
471  /* free transformed problem */
473 
474  /* set root dialog as next dialog */
475  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
476 
477  return SCIP_OKAY;
478 }
479 
480 /** dialog execution method for the changing the objective sense */
481 SCIP_DECL_DIALOGEXEC(SCIPdialogExecChangeObjSense)
482 { /*lint --e{715}*/
483  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
484 
486  SCIPdialogMessage(scip, NULL, "cannot call method after problem was transformed\n");
487  else if( SCIPgetStage(scip) < SCIP_STAGE_PROBLEM )
488  SCIPdialogMessage(scip, NULL, "cannot call method before problem was created\n");
489  else
490  {
491  SCIP_Bool endoffile;
492  char* objsense;
493 
494  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "new objective sense {min,max}: ", &objsense, &endoffile) );
495 
496  /* if we get a return or we reached the end of the file, then we stop */
497  if( objsense[0] != '\0' && !endoffile )
498  {
499  if( strncmp(objsense, "max", 3) == 0 )
500  {
502  }
503  else if( strncmp(objsense , "min", 3) == 0 )
504  {
506  }
507  else
508  {
509  SCIPdialogMessage(scip, NULL, "invalid argument <%s>\n", objsense);
510  }
511  }
512  }
513 
514  /* set root dialog as next dialog */
515  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
516 
517  return SCIP_OKAY;
518 }
519 
520 /** dialog execution method for the checksol command */
521 SCIP_DECL_DIALOGEXEC(SCIPdialogExecChecksol)
522 { /*lint --e{715}*/
523  SCIP_SOL* sol;
524  SCIP_Bool feasible;
525 
526  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
527 
528  SCIPdialogMessage(scip, NULL, "\n");
530  sol = SCIPgetBestSol(scip);
531  else
532  sol = NULL;
533 
534  if( sol == NULL )
535  SCIPdialogMessage(scip, NULL, "no feasible solution available\n");
536  else
537  {
538  SCIP_Real oldfeastol;
539  SCIP_Real checkfeastolfac;
540  SCIP_Bool dispallviols;
541 
542  oldfeastol = SCIPfeastol(scip);
543  SCIP_CALL( SCIPgetRealParam(scip, "numerics/checkfeastolfac", &checkfeastolfac) );
544  SCIP_CALL( SCIPgetBoolParam(scip, "display/allviols", &dispallviols) );
545 
546  /* scale feasibility tolerance by set->num_checkfeastolfac */
547  if( !SCIPisEQ(scip, checkfeastolfac, 1.0) )
548  {
549  SCIP_CALL( SCIPchgFeastol(scip, oldfeastol * checkfeastolfac) );
550  }
551 
552  SCIPinfoMessage(scip, NULL, "check best solution\n");
553  SCIP_CALL( SCIPcheckSolOrig(scip, sol, &feasible, TRUE, dispallviols) );
554 
555  /* restore old feasibilty tolerance */
556  if( !SCIPisEQ(scip, checkfeastolfac, 1.0) )
557  {
558  SCIP_CALL( SCIPchgFeastol(scip, oldfeastol) );
559  }
560 
561  if( feasible )
562  SCIPdialogMessage(scip, NULL, "solution is feasible in original problem\n");
563  }
564  SCIPdialogMessage(scip, NULL, "\n");
565 
566  *nextdialog = SCIPdialogGetParent(dialog);
567 
568  return SCIP_OKAY;
569 }
570 
571 /** dialog execution method for the cliquegraph command */
572 SCIP_DECL_DIALOGEXEC(SCIPdialogExecCliquegraph)
573 { /*lint --e{715}*/
574  SCIP_RETCODE retcode;
575  SCIP_Bool endoffile;
576  char* filename;
577 
578  assert(nextdialog != NULL);
579 
580  *nextdialog = NULL;
581 
582  if( !SCIPisTransformed(scip) )
583  {
584  SCIPdialogMessage(scip, NULL, "cannot call method before problem was transformed\n");
585  SCIPdialoghdlrClearBuffer(dialoghdlr);
586  }
587  else
588  {
589  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
590  if( endoffile )
591  {
592  *nextdialog = NULL;
593  return SCIP_OKAY;
594  }
595 
596  if( filename[0] != '\0' )
597  {
598  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
599 
600  retcode = SCIPwriteCliqueGraph(scip, filename, FALSE);
601  if( retcode == SCIP_FILECREATEERROR )
602  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
603  else
604  {
605  SCIP_CALL( retcode );
606  }
607  }
608  }
609 
610  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
611 
612  return SCIP_OKAY;
613 }
614 
615 /** dialog execution method for the display branching command */
616 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayBranching)
617 { /*lint --e{715}*/
618  SCIP_BRANCHRULE** branchrules;
619  SCIP_BRANCHRULE** sorted;
620  int nbranchrules;
621  int i;
622 
623  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
624 
625  branchrules = SCIPgetBranchrules(scip);
626  nbranchrules = SCIPgetNBranchrules(scip);
627 
628  /* copy branchrules array into temporary memory for sorting */
629  SCIP_CALL( SCIPduplicateBufferArray(scip, &sorted, branchrules, nbranchrules) );
630 
631  /* sort the branching rules */
632  SCIPsortPtr((void**)sorted, SCIPbranchruleComp, nbranchrules);
633 
634  /* display sorted list of branching rules */
635  SCIPdialogMessage(scip, NULL, "\n");
636  SCIPdialogMessage(scip, NULL, " branching rule priority maxdepth maxbddist description\n");
637  SCIPdialogMessage(scip, NULL, " -------------- -------- -------- --------- -----------\n");
638  for( i = 0; i < nbranchrules; ++i )
639  {
640  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPbranchruleGetName(sorted[i]));
641  if( strlen(SCIPbranchruleGetName(sorted[i])) > 20 )
642  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
643  SCIPdialogMessage(scip, NULL, "%8d %8d %8.1f%% ", SCIPbranchruleGetPriority(sorted[i]),
644  SCIPbranchruleGetMaxdepth(sorted[i]), 100.0 * SCIPbranchruleGetMaxbounddist(sorted[i]));
645  SCIPdialogMessage(scip, NULL, "%s", SCIPbranchruleGetDesc(sorted[i]));
646  SCIPdialogMessage(scip, NULL, "\n");
647  }
648  SCIPdialogMessage(scip, NULL, "\n");
649 
650  /* free temporary memory */
651  SCIPfreeBufferArray(scip, &sorted);
652 
653  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
654 
655  return SCIP_OKAY;
656 }
657 
658 /** dialog execution method for the display relaxators command */
659 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayRelaxators)
660 { /*lint --e{715}*/
661  SCIP_RELAX** relaxs;
662  SCIP_RELAX** sorted;
663  int nrelaxs;
664  int i;
665 
666  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
667 
668  relaxs = SCIPgetRelaxs(scip);
669  nrelaxs = SCIPgetNRelaxs(scip);
670 
671  /* copy relaxs array into temporary memory for sorting */
672  if( nrelaxs != 0 )
673  {
674  SCIP_CALL( SCIPduplicateBufferArray(scip, &sorted, relaxs, nrelaxs) );
675  }
676  else
677  sorted = NULL;
678 
679  /* sort the relaxators */
680  SCIPsortPtr((void**)sorted, SCIPrelaxComp, nrelaxs);
681 
682  /* display sorted list of relaxators */
683  SCIPdialogMessage(scip, NULL, "\n");
684  SCIPdialogMessage(scip, NULL, " relaxator priority freq description\n");
685  SCIPdialogMessage(scip, NULL, " -------------- -------- ---- -----------\n");
686  for( i = 0; i < nrelaxs; ++i )
687  {
688  assert(sorted != NULL); /* for flexelint */
689  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPrelaxGetName(sorted[i]));
690  if( strlen(SCIPrelaxGetName(sorted[i])) > 20 )
691  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
692  SCIPdialogMessage(scip, NULL, "%8d %4d ", SCIPrelaxGetPriority(sorted[i]),
693  SCIPrelaxGetFreq(sorted[i]));
694  SCIPdialogMessage(scip, NULL, "%s", SCIPrelaxGetDesc(sorted[i]));
695  SCIPdialogMessage(scip, NULL, "\n");
696  }
697  SCIPdialogMessage(scip, NULL, "\n");
698 
699  /* free temporary memory */
700  SCIPfreeBufferArrayNull(scip, &sorted);
701 
702  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
703 
704  return SCIP_OKAY;
705 }
706 
707 /** dialog execution method for the display conflict command */
708 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayConflict)
709 { /*lint --e{715}*/
710  SCIP_CONFLICTHDLR** conflicthdlrs;
711  SCIP_CONFLICTHDLR** sorted;
712  int nconflicthdlrs;
713  int i;
714 
715  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
716 
717  conflicthdlrs = SCIPgetConflicthdlrs(scip);
718  nconflicthdlrs = SCIPgetNConflicthdlrs(scip);
719 
720  /* copy conflicthdlrs array into temporary memory for sorting */
721  SCIP_CALL( SCIPduplicateBufferArray(scip, &sorted, conflicthdlrs, nconflicthdlrs) );
722 
723  /* sort the conflict handlers */
724  SCIPsortPtr((void**)sorted, SCIPconflicthdlrComp, nconflicthdlrs);
725 
726  /* display sorted list of conflict handlers */
727  SCIPdialogMessage(scip, NULL, "\n");
728  SCIPdialogMessage(scip, NULL, " conflict handler priority description\n");
729  SCIPdialogMessage(scip, NULL, " ---------------- -------- -----------\n");
730  for( i = 0; i < nconflicthdlrs; ++i )
731  {
732  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPconflicthdlrGetName(sorted[i]));
733  if( strlen(SCIPconflicthdlrGetName(sorted[i])) > 20 )
734  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
737  SCIPdialogMessage(scip, NULL, "\n");
738  }
739  SCIPdialogMessage(scip, NULL, "\n");
740 
741  /* free temporary memory */
742  SCIPfreeBufferArray(scip, &sorted);
743 
744  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
745 
746  return SCIP_OKAY;
747 }
748 
749 /** dialog execution method for the display conshdlrs command */
750 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayConshdlrs)
751 { /*lint --e{715}*/
752  SCIP_CONSHDLR** conshdlrs;
753  int nconshdlrs;
754  int i;
755 
756  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
757 
758  conshdlrs = SCIPgetConshdlrs(scip);
759  nconshdlrs = SCIPgetNConshdlrs(scip);
760 
761  /* display list of constraint handlers */
762  SCIPdialogMessage(scip, NULL, "\n");
763  SCIPdialogMessage(scip, NULL, " Legend:\n");
764  SCIPdialogMessage(scip, NULL, " prestim (presolve timing): 'f'ast, 'm'edium, 'e'xhaustive\n\n");
765  SCIPdialogMessage(scip, NULL, " constraint handler chckprio enfoprio sepaprio sepaf propf eager prestim description\n");
766  SCIPdialogMessage(scip, NULL, " ------------------ -------- -------- -------- ----- ----- ----- ------- -----------\n");
767  for( i = 0; i < nconshdlrs; ++i )
768  {
769  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPconshdlrGetName(conshdlrs[i]));
770  if( strlen(SCIPconshdlrGetName(conshdlrs[i])) > 20 )
771  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
772  SCIPdialogMessage(scip, NULL, "%8d %8d %8d %5d %5d %5d ",
773  SCIPconshdlrGetCheckPriority(conshdlrs[i]),
774  SCIPconshdlrGetEnfoPriority(conshdlrs[i]),
775  SCIPconshdlrGetSepaPriority(conshdlrs[i]),
776  SCIPconshdlrGetSepaFreq(conshdlrs[i]),
777  SCIPconshdlrGetPropFreq(conshdlrs[i]),
778  SCIPconshdlrGetEagerFreq(conshdlrs[i]));
779  SCIPdialogMessage(scip, NULL, " %c", (SCIPconshdlrGetPresolTiming(conshdlrs[i]) & SCIP_PRESOLTIMING_FAST) ? 'f' : ' ');
780  SCIPdialogMessage(scip, NULL, "%c", (SCIPconshdlrGetPresolTiming(conshdlrs[i]) & SCIP_PRESOLTIMING_MEDIUM) ? 'm' : ' ');
782  SCIPdialogMessage(scip, NULL, "%s", SCIPconshdlrGetDesc(conshdlrs[i]));
783  SCIPdialogMessage(scip, NULL, "\n");
784  }
785  SCIPdialogMessage(scip, NULL, "\n");
786 
787  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
788 
789  return SCIP_OKAY;
790 }
791 
792 /** dialog execution method for the display displaycols command */
793 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayDisplaycols)
794 { /*lint --e{715}*/
795  SCIP_DISP** disps;
796  int ndisps;
797  int i;
798 
799  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
800 
801  disps = SCIPgetDisps(scip);
802  ndisps = SCIPgetNDisps(scip);
803 
804  /* display list of display columns */
805  SCIPdialogMessage(scip, NULL, "\n");
806  SCIPdialogMessage(scip, NULL, " display column header position width priority status description\n");
807  SCIPdialogMessage(scip, NULL, " -------------- ------ -------- ----- -------- ------ -----------\n");
808  for( i = 0; i < ndisps; ++i )
809  {
810  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPdispGetName(disps[i]));
811  if( strlen(SCIPdispGetName(disps[i])) > 20 )
812  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
813  SCIPdialogMessage(scip, NULL, "%-16s ", SCIPdispGetHeader(disps[i]));
814  if( strlen(SCIPdispGetHeader(disps[i])) > 16 )
815  SCIPdialogMessage(scip, NULL, "\n %20s %16s ", "", "-->");
816  SCIPdialogMessage(scip, NULL, "%8d ", SCIPdispGetPosition(disps[i]));
817  SCIPdialogMessage(scip, NULL, "%5d ", SCIPdispGetWidth(disps[i]));
818  SCIPdialogMessage(scip, NULL, "%8d ", SCIPdispGetPriority(disps[i]));
819  switch( SCIPdispGetStatus(disps[i]) )
820  {
821  case SCIP_DISPSTATUS_OFF:
822  SCIPdialogMessage(scip, NULL, "%6s ", "off");
823  break;
825  SCIPdialogMessage(scip, NULL, "%6s ", "auto");
826  break;
827  case SCIP_DISPSTATUS_ON:
828  SCIPdialogMessage(scip, NULL, "%6s ", "on");
829  break;
830  default:
831  SCIPdialogMessage(scip, NULL, "%6s ", "?");
832  break;
833  }
834  SCIPdialogMessage(scip, NULL, "%s", SCIPdispGetDesc(disps[i]));
835  SCIPdialogMessage(scip, NULL, "\n");
836  }
837  SCIPdialogMessage(scip, NULL, "\n");
838 
839  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
840 
841  return SCIP_OKAY;
842 }
843 
844 /** dialog execution method for the display heuristics command */
845 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayHeuristics)
846 { /*lint --e{715}*/
847  SCIP_HEUR** heurs;
848  int nheurs;
849  int i;
850 
851  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
852 
853  heurs = SCIPgetHeurs(scip);
854  nheurs = SCIPgetNHeurs(scip);
855 
856  /* display list of primal heuristics */
857  SCIPdialogMessage(scip, NULL, "\n");
858  SCIPdialogMessage(scip, NULL, " primal heuristic c priority freq ofs description\n");
859  SCIPdialogMessage(scip, NULL, " ---------------- - -------- ---- --- -----------\n");
860  for( i = 0; i < nheurs; ++i )
861  {
862  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPheurGetName(heurs[i]));
863  if( strlen(SCIPheurGetName(heurs[i])) > 20 )
864  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
865  SCIPdialogMessage(scip, NULL, "%c ", SCIPheurGetDispchar(heurs[i]));
866  SCIPdialogMessage(scip, NULL, "%8d ", SCIPheurGetPriority(heurs[i]));
867  SCIPdialogMessage(scip, NULL, "%4d ", SCIPheurGetFreq(heurs[i]));
868  SCIPdialogMessage(scip, NULL, "%3d ", SCIPheurGetFreqofs(heurs[i]));
869  SCIPdialogMessage(scip, NULL, "%s", SCIPheurGetDesc(heurs[i]));
870  SCIPdialogMessage(scip, NULL, "\n");
871  }
872  SCIPdialogMessage(scip, NULL, "\n");
873 
874  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
875 
876  return SCIP_OKAY;
877 }
878 
879 /** dialog execution method for the display memory command */
880 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayMemory)
881 { /*lint --e{715}*/
882  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
883 
884  SCIPdialogMessage(scip, NULL, "\n");
886  SCIPdialogMessage(scip, NULL, "\n");
887 
888  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
889 
890  return SCIP_OKAY;
891 }
892 
893 /** dialog execution method for the display nlpi command */
894 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayNlpi)
895 { /*lint --e{715}*/
896  SCIP_NLPI** nlpis;
897  SCIP_NLPI** sorted;
898  int nnlpis;
899  int i;
900 
901  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
902 
903  nlpis = SCIPgetNlpis(scip);
904  nnlpis = SCIPgetNNlpis(scip);
905 
906  /* copy nlpis array into temporary memory for sorting */
907  if( nnlpis != 0 )
908  {
909  SCIP_CALL( SCIPduplicateBufferArray(scip, &sorted, nlpis, nnlpis) );
910  }
911  else
912  sorted = NULL;
913 
914  /* sort the branching rules */
915  SCIPsortPtr((void**)sorted, SCIPnlpiComp, nnlpis);
916 
917  /* display sorted list of branching rules */
918  SCIPdialogMessage(scip, NULL, "\n");
919  SCIPdialogMessage(scip, NULL, " NLP interface priority description\n");
920  SCIPdialogMessage(scip, NULL, " ------------- -------- -----------\n");
921  for( i = 0; i < nnlpis; ++i )
922  {
923  assert(sorted != NULL);
924  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPnlpiGetName(sorted[i]));
925  if( strlen(SCIPnlpiGetName(sorted[i])) > 20 )
926  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
927  SCIPdialogMessage(scip, NULL, "%8d ", SCIPnlpiGetPriority(sorted[i]));
928  SCIPdialogMessage(scip, NULL, "%s", SCIPnlpiGetDesc(sorted[i]));
929  SCIPdialogMessage(scip, NULL, "\n");
930  }
931  SCIPdialogMessage(scip, NULL, "\n");
932 
933  /* free temporary memory */
934  if( nnlpis != 0 )
935  {
936  SCIPfreeBufferArray(scip, &sorted);
937  }
938 
939  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
940 
941  return SCIP_OKAY;
942 }
943 
944 /** dialog execution method for the display nodeselectors command */
945 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayNodeselectors)
946 { /*lint --e{715}*/
947  SCIP_NODESEL** nodesels;
948  int nnodesels;
949  int i;
950 
951  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
952 
953  nodesels = SCIPgetNodesels(scip);
954  nnodesels = SCIPgetNNodesels(scip);
955 
956  /* display list of node selectors */
957  SCIPdialogMessage(scip, NULL, "\n");
958  SCIPdialogMessage(scip, NULL, " node selector std priority memsave prio description\n");
959  SCIPdialogMessage(scip, NULL, " ------------- ------------ ------------ -----------\n");
960  for( i = 0; i < nnodesels; ++i )
961  {
962  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPnodeselGetName(nodesels[i]));
963  if( strlen(SCIPnodeselGetName(nodesels[i])) > 20 )
964  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
965  SCIPdialogMessage(scip, NULL, "%12d ", SCIPnodeselGetStdPriority(nodesels[i]));
966  SCIPdialogMessage(scip, NULL, "%12d ", SCIPnodeselGetMemsavePriority(nodesels[i]));
967  SCIPdialogMessage(scip, NULL, "%s", SCIPnodeselGetDesc(nodesels[i]));
968  SCIPdialogMessage(scip, NULL, "\n");
969  }
970  SCIPdialogMessage(scip, NULL, "\n");
971 
972  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
973 
974  return SCIP_OKAY;
975 }
976 
977 /** dialog execution method for the display parameters command */
978 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayParameters)
979 { /*lint --e{715}*/
980  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
981 
982  SCIPdialogMessage(scip, NULL, "\n");
983  SCIPdialogMessage(scip, NULL, "number of parameters = %d\n", SCIPgetNParams(scip));
984  SCIPdialogMessage(scip, NULL, "non-default parameter settings:\n");
986  SCIPdialogMessage(scip, NULL, "\n");
987 
988  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
989 
990  return SCIP_OKAY;
991 }
992 
993 /** dialog execution method for the display presolvers command */
994 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayPresolvers)
995 { /*lint --e{715}*/
996  SCIP_PRESOL** presols;
997  int npresols;
998  int i;
999 
1000  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1001 
1002  presols = SCIPgetPresols(scip);
1003  npresols = SCIPgetNPresols(scip);
1004 
1005  /* display list of presolvers */
1006  SCIPdialogMessage(scip, NULL, "\n");
1007  SCIPdialogMessage(scip, NULL, " Legend:\n");
1008  SCIPdialogMessage(scip, NULL, " priority: presolver called before constraint handlers iff priority > 0\n");
1009  SCIPdialogMessage(scip, NULL, " timing: 'f'ast, 'm'edium, 'e'xhaustive\n\n");
1010  SCIPdialogMessage(scip, NULL, " maxrounds: -1: no limit, 0: off, >0: limited number of rounds\n\n");
1011  SCIPdialogMessage(scip, NULL, " presolver priority timing maxrounds description\n");
1012  SCIPdialogMessage(scip, NULL, " --------- -------- ------ --------- -----------\n");
1013  for( i = 0; i < npresols; ++i )
1014  {
1015  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPpresolGetName(presols[i]));
1016  if( strlen(SCIPpresolGetName(presols[i])) > 20 )
1017  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
1018  SCIPdialogMessage(scip, NULL, "%8d ", SCIPpresolGetPriority(presols[i]));
1019  SCIPdialogMessage(scip, NULL, " %c", (SCIPpresolGetTiming(presols[i]) & SCIP_PRESOLTIMING_FAST) ? 'f' : ' ');
1020  SCIPdialogMessage(scip, NULL, "%c", (SCIPpresolGetTiming(presols[i]) & SCIP_PRESOLTIMING_MEDIUM) ? 'm' : ' ');
1021  SCIPdialogMessage(scip, NULL, "%c ", (SCIPpresolGetTiming(presols[i]) & SCIP_PRESOLTIMING_EXHAUSTIVE) ? 'e' : ' ');
1022  SCIPdialogMessage(scip, NULL, "%9d ", SCIPpresolGetMaxrounds(presols[i]));
1023  SCIPdialogMessage(scip, NULL, "%s", SCIPpresolGetDesc(presols[i]));
1024  SCIPdialogMessage(scip, NULL, "\n");
1025  }
1026  SCIPdialogMessage(scip, NULL, "\n");
1027 
1028  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1029 
1030  return SCIP_OKAY;
1031 }
1032 
1033 /** dialog execution method for the display pricer command */
1034 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayPricers)
1035 { /*lint --e{715}*/
1036  SCIP_PRICER** pricers;
1037  int npricers;
1038  int i;
1039 
1040  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1041 
1042  pricers = SCIPgetPricers(scip);
1043  npricers = SCIPgetNPricers(scip);
1044 
1045  /* display list of pricers */
1046  SCIPdialogMessage(scip, NULL, "\n");
1047  SCIPdialogMessage(scip, NULL, " pricer priority description\n");
1048  SCIPdialogMessage(scip, NULL, " ---------- -------- -----------\n");
1049  for( i = 0; i < npricers; ++i )
1050  {
1051  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPpricerGetName(pricers[i]));
1052  if( strlen(SCIPpricerGetName(pricers[i])) > 20 )
1053  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
1054  SCIPdialogMessage(scip, NULL, "%8d%c ", SCIPpricerGetPriority(pricers[i]), SCIPpricerIsDelayed(pricers[i]) ? 'd' : ' ');
1055  SCIPdialogMessage(scip, NULL, "%s", SCIPpricerGetDesc(pricers[i]));
1056  SCIPdialogMessage(scip, NULL, "\n");
1057  }
1058  SCIPdialogMessage(scip, NULL, "\n");
1059 
1060  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1061 
1062  return SCIP_OKAY;
1063 }
1064 
1065 /** dialog execution method for the display problem command */
1066 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayProblem)
1067 { /*lint --e{715}*/
1068  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1069 
1070  SCIPdialogMessage(scip, NULL, "\n");
1071 
1073  {
1075  }
1076  else
1077  SCIPdialogMessage(scip, NULL, "no problem available\n");
1078 
1079  SCIPdialogMessage(scip, NULL, "\n");
1080 
1081  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1082 
1083  return SCIP_OKAY;
1084 }
1085 
1086 /** dialog execution method for the display propagators command */
1087 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayPropagators)
1088 { /*lint --e{715}*/
1089  SCIP_PROP** props;
1090  int nprops;
1091  int i;
1092 
1093  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1094 
1095  props = SCIPgetProps(scip);
1096  nprops = SCIPgetNProps(scip);
1097 
1098  /* display list of propagators */
1099  SCIPdialogMessage(scip, NULL, "\n");
1100  SCIPdialogMessage(scip, NULL, " Legend:\n");
1101  SCIPdialogMessage(scip, NULL, " presprio: propagator presolving called before constraint handlers iff presprio > 0\n");
1102  SCIPdialogMessage(scip, NULL, " prestim (presolve timing): 'f'ast, 'm'edium, 'e'xhaustive\n\n");
1103 
1104  SCIPdialogMessage(scip, NULL, " propagator propprio freq presprio prestim description\n");
1105  SCIPdialogMessage(scip, NULL, " ---------- -------- ---- -------- ------- -----------\n");
1106  for( i = 0; i < nprops; ++i )
1107  {
1108  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPpropGetName(props[i]));
1109  if( strlen(SCIPpropGetName(props[i])) > 20 )
1110  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
1111  SCIPdialogMessage(scip, NULL, "%8d%c ", SCIPpropGetPriority(props[i]), SCIPpropIsDelayed(props[i]) ? 'd' : ' ');
1112  SCIPdialogMessage(scip, NULL, "%4d ", SCIPpropGetFreq(props[i]));
1114  SCIPdialogMessage(scip, NULL, " %c", (SCIPpropGetPresolTiming(props[i]) & SCIP_PRESOLTIMING_FAST) ? 'f' : ' ');
1115  SCIPdialogMessage(scip, NULL, "%c", (SCIPpropGetPresolTiming(props[i]) & SCIP_PRESOLTIMING_MEDIUM) ? 'm' : ' ');
1117  SCIPdialogMessage(scip, NULL, "%s", SCIPpropGetDesc(props[i]));
1118  SCIPdialogMessage(scip, NULL, "\n");
1119  }
1120  SCIPdialogMessage(scip, NULL, "\n");
1121 
1122  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1123 
1124  return SCIP_OKAY;
1125 }
1126 
1127 /** dialog execution method for the display readers command */
1128 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayReaders)
1129 { /*lint --e{715}*/
1130  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1131 
1132  /* print reader information */
1134 
1135  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1136 
1137  return SCIP_OKAY;
1138 }
1139 
1140 /** dialog execution method for the display separators command */
1141 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplaySeparators)
1142 { /*lint --e{715}*/
1143  SCIP_SEPA** sepas;
1144  int nsepas;
1145  int i;
1146 
1147  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1148 
1149  sepas = SCIPgetSepas(scip);
1150  nsepas = SCIPgetNSepas(scip);
1151 
1152  /* display list of separators */
1153  SCIPdialogMessage(scip, NULL, "\n");
1154  SCIPdialogMessage(scip, NULL, " separator priority freq bddist description\n");
1155  SCIPdialogMessage(scip, NULL, " --------- -------- ---- ------ -----------\n");
1156  for( i = 0; i < nsepas; ++i )
1157  {
1158  SCIPdialogMessage(scip, NULL, " %-20s ", SCIPsepaGetName(sepas[i]));
1159  if( strlen(SCIPsepaGetName(sepas[i])) > 20 )
1160  SCIPdialogMessage(scip, NULL, "\n %20s ", "-->");
1161  SCIPdialogMessage(scip, NULL, "%8d%c ", SCIPsepaGetPriority(sepas[i]), SCIPsepaIsDelayed(sepas[i]) ? 'd' : ' ');
1162  SCIPdialogMessage(scip, NULL, "%4d ", SCIPsepaGetFreq(sepas[i]));
1163  SCIPdialogMessage(scip, NULL, "%6.2f ", SCIPsepaGetMaxbounddist(sepas[i]));
1164  SCIPdialogMessage(scip, NULL, "%s", SCIPsepaGetDesc(sepas[i]));
1165  SCIPdialogMessage(scip, NULL, "\n");
1166  }
1167  SCIPdialogMessage(scip, NULL, "\n");
1168 
1169  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1170 
1171  return SCIP_OKAY;
1172 }
1173 
1174 /** dialog execution method for the display solution command */
1175 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplaySolution)
1176 { /*lint --e{715}*/
1177  SCIP_VAR** fixedvars;
1178  SCIP_VAR* var;
1179  SCIP_Bool printzeros;
1180  int nfixedvars;
1181  int v;
1182 
1183  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1184  SCIP_CALL( SCIPgetBoolParam(scip, "write/printzeros", &printzeros) );
1185 
1186  SCIPdialogMessage(scip, NULL, "\n");
1187  SCIP_CALL( SCIPprintBestSol(scip, NULL, printzeros) );
1188  SCIPdialogMessage(scip, NULL, "\n");
1189 
1190  /* check if there are infinite fixings and print a reference to 'display finitesolution', if needed */
1191  fixedvars = SCIPgetFixedVars(scip);
1192  nfixedvars = SCIPgetNFixedVars(scip);
1193  assert(fixedvars != NULL || nfixedvars == 0);
1194 
1195  /* check whether there are variables fixed to an infinite value */
1196  for( v = 0; v < nfixedvars; ++v )
1197  {
1198  var = fixedvars[v]; /*lint !e613*/
1199 
1200  /* skip (multi-)aggregated variables */
1202  continue;
1203 
1205  {
1206  SCIPdialogMessage(scip, NULL, "The primal solution contains variables fixed to infinite values.\n\
1207 If you want SCIP to display an optimal solution without infinite values, use 'display finitesolution'.\n");
1208  SCIPdialogMessage(scip, NULL, "\n");
1209  break;
1210  }
1211  }
1212 
1213  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1214 
1215  return SCIP_OKAY;
1216 }
1217 
1218 /** dialog execution method for the display finitesolution command */
1219 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayFiniteSolution)
1220 { /*lint --e{715}*/
1221  SCIP_SOL* bestsol = SCIPgetBestSol(scip);
1222 
1223  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1224 
1225  SCIPdialogMessage(scip, NULL, "\n");
1226  if( bestsol != NULL )
1227  {
1228  SCIP_SOL* sol;
1229  SCIP_Bool success;
1230  SCIP_RETCODE retcode;
1231 
1232  /* create copy of solution with finite values */
1233  retcode = SCIPcreateFiniteSolCopy(scip, &sol, bestsol, &success);
1234 
1235  if( retcode == SCIP_OKAY && success )
1236  {
1237  SCIP_Bool printzeros;
1238 
1239  SCIP_CALL( SCIPgetBoolParam(scip, "write/printzeros", &printzeros) );
1240  retcode = SCIPprintSol(scip, sol, NULL, printzeros);
1241  SCIPdialogMessage(scip, NULL, "\n");
1242  }
1243  else
1244  {
1245  SCIPdialogMessage(scip, NULL, "error while creating finite solution\n");
1246  }
1247 
1248  /* free solution copy */
1249  if( retcode == SCIP_OKAY )
1250  {
1251  SCIP_CALL( SCIPfreeSol(scip, &sol) );
1252  }
1253  }
1254  else
1255  {
1256  SCIP_Bool printzeros;
1257 
1258  SCIP_CALL( SCIPgetBoolParam(scip, "write/printzeros", &printzeros) );
1259  SCIP_CALL( SCIPprintBestSol(scip, NULL, printzeros) );
1260  SCIPdialogMessage(scip, NULL, "\n");
1261  }
1262 
1263  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1264 
1265  return SCIP_OKAY;
1266 }
1267 
1268 /** dialog execution method for the display dual solution command */
1269 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayDualSolution)
1270 { /*lint --e{715}*/
1271  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1272 
1273  SCIPdialogMessage(scip, NULL, "\n");
1275  SCIPdialogMessage(scip, NULL, "\n");
1276 
1277  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1278 
1279  return SCIP_OKAY;
1280 }
1281 
1282 
1283 /** dialog execution method for the display of solutions in the pool command */
1284 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplaySolutionPool)
1285 { /*lint --e{715}*/
1286  char prompt[SCIP_MAXSTRLEN];
1287  SCIP_Bool endoffile;
1288  SCIP_SOL** sols;
1289  char* idxstr;
1290  char* endstr;
1291  int nsols;
1292  int idx;
1293 
1294  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1295  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1296  SCIPdialogMessage(scip, NULL, "\n");
1297 
1299  {
1300  SCIPdialogMessage(scip, NULL, "No solution available.\n\n");
1301  return SCIP_OKAY;
1302  }
1303 
1304  nsols = SCIPgetNSols(scip);
1305  if ( nsols == 0 )
1306  {
1307  SCIPdialogMessage(scip, NULL, "No solution available.\n\n");
1308  return SCIP_OKAY;
1309  }
1310 
1311  /* parse solution number */
1312  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN-1, "index of solution [0-%d]: ", nsols-1);
1313 
1314  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &idxstr, &endoffile) );
1315 
1316  if( endoffile )
1317  {
1318  *nextdialog = NULL;
1319  return SCIP_OKAY;
1320  }
1321 
1322  if ( SCIPstrToIntValue(idxstr, &idx, &endstr) )
1323  {
1324  SCIP_Bool printzeros;
1325 
1326  if ( idx < 0 || idx >= nsols )
1327  {
1328  SCIPdialogMessage(scip, NULL, "Solution index out of bounds [0-%d].\n", nsols-1);
1329  return SCIP_OKAY;
1330  }
1331 
1332  SCIP_CALL( SCIPgetBoolParam(scip, "write/printzeros", &printzeros) );
1333 
1334  sols = SCIPgetSols(scip);
1335  assert( sols[idx] != NULL );
1336  SCIP_CALL( SCIPprintSol(scip, sols[idx], NULL, FALSE) );
1337  }
1338  SCIPdialogMessage(scip, NULL, "\n");
1339 
1340  return SCIP_OKAY;
1341 }
1342 
1343 /** dialog execution method for the display statistics command */
1344 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayStatistics)
1345 { /*lint --e{715}*/
1346  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1347 
1348  SCIPdialogMessage(scip, NULL, "\n");
1350  SCIPdialogMessage(scip, NULL, "\n");
1351 
1352  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1353 
1354  return SCIP_OKAY;
1355 }
1356 
1357 /** dialog execution method for the display reoptstatistics command */
1358 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayReoptStatistics)
1359 { /*lint --e{715}*/
1360  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1361 
1362  SCIPdialogMessage(scip, NULL, "\n");
1364  SCIPdialogMessage(scip, NULL, "\n");
1365 
1366  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1367 
1368  return SCIP_OKAY;
1369 }
1370 
1371 /** dialog execution method for the display compression command */
1372 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayCompression)
1373 { /*lint --e{715}*/
1374  SCIP_COMPR** comprs;
1375  SCIP_COMPR** sorted;
1376  int ncomprs;
1377  int i;
1378 
1379  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1380 
1381  comprs = SCIPgetComprs(scip);
1382  ncomprs = SCIPgetNCompr(scip);
1383 
1384  /* copy compression array into temporary memory for sorting */
1385  SCIP_CALL( SCIPduplicateBufferArray(scip, &sorted, comprs, ncomprs) );
1386 
1387  /* sort the compression t */
1388  SCIPsortPtr((void**)sorted, SCIPcomprComp, ncomprs);
1389 
1390  /* display sorted list of branching rules */
1391  SCIPdialogMessage(scip, NULL, "\n");
1392  SCIPdialogMessage(scip, NULL, " compression method priority minnodes description\n");
1393  SCIPdialogMessage(scip, NULL, " ------------------ -------- -------- -----------\n");
1394  for( i = 0; i < ncomprs; ++i )
1395  {
1396  SCIPdialogMessage(scip, NULL, " %-24s ", SCIPcomprGetName(sorted[i]));
1397  if( strlen(SCIPcomprGetName(sorted[i])) > 24 )
1398  SCIPdialogMessage(scip, NULL, "\n %24s ", "-->");
1399  SCIPdialogMessage(scip, NULL, "%8d %8d ", SCIPcomprGetPriority(sorted[i]), SCIPcomprGetMinNodes(sorted[i]));
1400  SCIPdialogMessage(scip, NULL, "%s", SCIPcomprGetDesc(sorted[i]));
1401  SCIPdialogMessage(scip, NULL, "\n");
1402  }
1403  SCIPdialogMessage(scip, NULL, "\n");
1404 
1405  /* free temporary memory */
1406  SCIPfreeBufferArray(scip, &sorted);
1407 
1408  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1409 
1410  return SCIP_OKAY;
1411 }
1412 
1413 /** dialog execution method for the display transproblem command */
1414 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayTransproblem)
1415 { /*lint --e{715}*/
1416  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1417 
1418  SCIPdialogMessage(scip, NULL, "\n");
1420  {
1422  }
1423  else
1424  SCIPdialogMessage(scip, NULL, "no transformed problem available\n");
1425 
1426  SCIPdialogMessage(scip, NULL, "\n");
1427 
1428  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1429 
1430  return SCIP_OKAY;
1431 }
1432 
1433 /** dialog execution method for the display value command */
1434 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayValue)
1435 { /*lint --e{715}*/
1436  SCIP_SOL* sol;
1437  SCIP_VAR* var;
1438  char* varname;
1439  SCIP_Real solval;
1440  SCIP_Bool endoffile;
1441 
1442  SCIPdialogMessage(scip, NULL, "\n");
1443 
1445  sol = SCIPgetBestSol(scip);
1446  else
1447  sol = NULL;
1448 
1449  if( sol == NULL )
1450  {
1451  SCIPdialogMessage(scip, NULL, "no feasible solution available\n");
1452  SCIPdialoghdlrClearBuffer(dialoghdlr);
1453  }
1454  else
1455  {
1456  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter variable name: ", &varname, &endoffile) );
1457  if( endoffile )
1458  {
1459  *nextdialog = NULL;
1460  return SCIP_OKAY;
1461  }
1462 
1463  if( varname[0] != '\0' )
1464  {
1465  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, varname, TRUE) );
1466 
1467  var = SCIPfindVar(scip, varname);
1468  if( var == NULL )
1469  SCIPdialogMessage(scip, NULL, "variable <%s> not found\n", varname);
1470  else
1471  {
1472  solval = SCIPgetSolVal(scip, sol, var);
1473  SCIPdialogMessage(scip, NULL, "%-32s", SCIPvarGetName(var));
1474  if( SCIPisInfinity(scip, solval) )
1475  SCIPdialogMessage(scip, NULL, " +infinity");
1476  else if( SCIPisInfinity(scip, -solval) )
1477  SCIPdialogMessage(scip, NULL, " -infinity");
1478  else
1479  SCIPdialogMessage(scip, NULL, " %20.15g", solval);
1480  SCIPdialogMessage(scip, NULL, " \t(obj:%.15g)\n", SCIPvarGetObj(var));
1481  }
1482  }
1483  }
1484  SCIPdialogMessage(scip, NULL, "\n");
1485 
1486  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1487 
1488  return SCIP_OKAY;
1489 }
1490 
1491 /** dialog execution method for the display varbranchstatistics command */
1492 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayVarbranchstatistics)
1493 { /*lint --e{715}*/
1494  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1495 
1496  SCIPdialogMessage(scip, NULL, "\n");
1498  SCIPdialogMessage(scip, NULL, "\n");
1499 
1500  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1501 
1502  return SCIP_OKAY;
1503 }
1504 
1505 /** dialog execution method for the display LP solution quality command */
1506 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayLPSolutionQuality)
1507 { /*lint --e{715}*/
1508  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1509 
1510  SCIPdialogMessage(scip, NULL, "\n");
1512  SCIPdialogMessage(scip, NULL, "\n");
1513 
1514  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1515 
1516  return SCIP_OKAY;
1517 }
1518 
1519 /** dialog execution method for the help command */
1520 SCIP_DECL_DIALOGEXEC(SCIPdialogExecHelp)
1521 { /*lint --e{715}*/
1522  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1523 
1524  SCIPdialogMessage(scip, NULL, "\n");
1526  SCIPdialogMessage(scip, NULL, "\n");
1527 
1528  *nextdialog = SCIPdialogGetParent(dialog);
1529 
1530  return SCIP_OKAY;
1531 }
1532 
1533 /** dialog execution method for the display transsolution command */
1534 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayTranssolution)
1535 { /*lint --e{715}*/
1536  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1537 
1538  SCIPdialogMessage(scip, NULL, "\n");
1540  {
1542  {
1543  SCIPdialogMessage(scip, NULL, "best solution exists only in original problem space\n");
1544  }
1545  else
1546  {
1548  }
1549  }
1550  else
1551  SCIPdialogMessage(scip, NULL, "no solution available\n");
1552  SCIPdialogMessage(scip, NULL, "\n");
1553 
1554  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1555 
1556  return SCIP_OKAY;
1557 }
1558 
1559 /** dialog execution method for the free command */
1560 SCIP_DECL_DIALOGEXEC(SCIPdialogExecFree)
1561 { /*lint --e{715}*/
1562  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1563 
1565 
1566  *nextdialog = SCIPdialogGetParent(dialog);
1567 
1568  return SCIP_OKAY;
1569 }
1570 
1571 /** dialog execution method for the newstart command */
1572 SCIP_DECL_DIALOGEXEC(SCIPdialogExecNewstart)
1573 { /*lint --e{715}*/
1574  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1575 
1577 
1578  *nextdialog = SCIPdialogGetParent(dialog);
1579 
1580  return SCIP_OKAY;
1581 }
1582 
1583 /** dialog execution method for the transform command */
1584 SCIP_DECL_DIALOGEXEC(SCIPdialogExecTransform)
1585 { /*lint --e{715}*/
1586  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1587 
1588  SCIPdialogMessage(scip, NULL, "\n");
1589  switch( SCIPgetStage(scip) )
1590  {
1591  case SCIP_STAGE_INIT:
1592  SCIPdialogMessage(scip, NULL, "no problem exists\n");
1593  break;
1594 
1595  case SCIP_STAGE_PROBLEM:
1597  break;
1598 
1600  SCIPdialogMessage(scip, NULL, "problem is already transformed\n");
1601  break;
1602 
1605  case SCIP_STAGE_PRESOLVING:
1606  case SCIP_STAGE_PRESOLVED:
1608  case SCIP_STAGE_INITSOLVE:
1609  case SCIP_STAGE_SOLVING:
1610  case SCIP_STAGE_SOLVED:
1611  case SCIP_STAGE_EXITSOLVE:
1612  case SCIP_STAGE_FREETRANS:
1613  case SCIP_STAGE_FREE:
1614  default:
1615  SCIPerrorMessage("invalid SCIP stage\n");
1616  return SCIP_INVALIDCALL;
1617  }
1618  SCIPdialogMessage(scip, NULL, "\n");
1619 
1620  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1621 
1622  return SCIP_OKAY;
1623 }
1624 
1625 /** dialog execution method for the concurrentopt command */
1626 SCIP_DECL_DIALOGEXEC(SCIPdialogExecConcurrentOpt)
1627 { /*lint --e{715}*/
1628  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1629 
1630  SCIPdialogMessage(scip, NULL, "\n");
1631  switch( SCIPgetStage(scip) )
1632  {
1633  case SCIP_STAGE_INIT:
1634  SCIPdialogMessage(scip, NULL, "no problem exists\n");
1635  break;
1636 
1637  case SCIP_STAGE_PROBLEM:
1639  case SCIP_STAGE_PRESOLVING:
1640  case SCIP_STAGE_PRESOLVED:
1641  case SCIP_STAGE_SOLVING:
1643  break;
1644 
1645  case SCIP_STAGE_SOLVED:
1646  SCIPdialogMessage(scip, NULL, "problem is already solved\n");
1647  break;
1648 
1652  case SCIP_STAGE_INITSOLVE:
1653  case SCIP_STAGE_EXITSOLVE:
1654  case SCIP_STAGE_FREETRANS:
1655  case SCIP_STAGE_FREE:
1656  default:
1657  SCIPerrorMessage("invalid SCIP stage\n");
1658  return SCIP_INVALIDCALL;
1659  }
1660  SCIPdialogMessage(scip, NULL, "\n");
1661 
1662  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1663 
1664  return SCIP_OKAY;
1665 }
1666 
1667 /** dialog execution method for the optimize command */
1668 SCIP_DECL_DIALOGEXEC(SCIPdialogExecOptimize)
1669 { /*lint --e{715}*/
1670  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1671 
1672  SCIPdialogMessage(scip, NULL, "\n");
1673  switch( SCIPgetStage(scip) )
1674  {
1675  case SCIP_STAGE_INIT:
1676  SCIPdialogMessage(scip, NULL, "no problem exists\n");
1677  break;
1678 
1679  case SCIP_STAGE_PROBLEM:
1681  case SCIP_STAGE_PRESOLVING:
1682  case SCIP_STAGE_PRESOLVED:
1683  case SCIP_STAGE_SOLVING:
1684  SCIP_CALL( SCIPsolve(scip) );
1685  break;
1686 
1687  case SCIP_STAGE_SOLVED:
1688  SCIPdialogMessage(scip, NULL, "problem is already solved\n");
1689  break;
1690 
1694  case SCIP_STAGE_INITSOLVE:
1695  case SCIP_STAGE_EXITSOLVE:
1696  case SCIP_STAGE_FREETRANS:
1697  case SCIP_STAGE_FREE:
1698  default:
1699  SCIPerrorMessage("invalid SCIP stage\n");
1700  return SCIP_INVALIDCALL;
1701  }
1702  SCIPdialogMessage(scip, NULL, "\n");
1703 
1704  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1705 
1706  return SCIP_OKAY;
1707 }
1708 
1709 /** dialog execution method for the presolve command */
1710 SCIP_DECL_DIALOGEXEC(SCIPdialogExecPresolve)
1711 { /*lint --e{715}*/
1712  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1713 
1714  SCIPdialogMessage(scip, NULL, "\n");
1715  switch( SCIPgetStage(scip) )
1716  {
1717  case SCIP_STAGE_INIT:
1718  SCIPdialogMessage(scip, NULL, "no problem exists\n");
1719  break;
1720 
1721  case SCIP_STAGE_PROBLEM:
1723  case SCIP_STAGE_PRESOLVING:
1725  break;
1726 
1727  case SCIP_STAGE_PRESOLVED:
1728  case SCIP_STAGE_SOLVING:
1729  SCIPdialogMessage(scip, NULL, "problem is already presolved\n");
1730  break;
1731 
1732  case SCIP_STAGE_SOLVED:
1733  SCIPdialogMessage(scip, NULL, "problem is already solved\n");
1734  break;
1735 
1739  case SCIP_STAGE_INITSOLVE:
1740  case SCIP_STAGE_EXITSOLVE:
1741  case SCIP_STAGE_FREETRANS:
1742  case SCIP_STAGE_FREE:
1743  default:
1744  SCIPerrorMessage("invalid SCIP stage\n");
1745  return SCIP_INVALIDCALL;
1746  }
1747  SCIPdialogMessage(scip, NULL, "\n");
1748 
1749  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1750 
1751  return SCIP_OKAY;
1752 }
1753 
1754 /** dialog execution method for the quit command */
1755 SCIP_DECL_DIALOGEXEC(SCIPdialogExecQuit)
1756 { /*lint --e{715}*/
1757  SCIPdialogMessage(scip, NULL, "\n");
1758 
1759  *nextdialog = NULL;
1760 
1761  return SCIP_OKAY;
1762 }
1763 
1764 /** dialog execution method for the read command */
1765 SCIP_DECL_DIALOGEXEC(SCIPdialogExecRead)
1766 { /*lint --e{715}*/
1767  SCIP_RETCODE retcode;
1768  char* filename;
1769  SCIP_Bool endoffile;
1770 
1771  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
1772  if( endoffile )
1773  {
1774  *nextdialog = NULL;
1775  return SCIP_OKAY;
1776  }
1777 
1778  if( filename[0] != '\0' )
1779  {
1780  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
1781 
1782  if( SCIPfileExists(filename) )
1783  {
1784  char* tmpfilename;
1785  char* extension;
1786 
1787  /* copy filename */
1788  SCIP_CALL( SCIPduplicateBufferArray(scip, &tmpfilename, filename, (int)strlen(filename)+1) );
1789  extension = NULL;
1790 
1791  SCIPinfoMessage(scip, NULL, "\n");
1792  SCIPinfoMessage(scip, NULL, "read problem <%s>\n", filename);
1793  SCIPinfoMessage(scip, NULL, "============\n");
1794  SCIPinfoMessage(scip, NULL, "\n");
1795 
1796  do
1797  {
1798  retcode = SCIPreadProb(scip, tmpfilename, extension);
1799  if( retcode == SCIP_READERROR || retcode == SCIP_NOFILE )
1800  {
1801  if( extension == NULL )
1802  SCIPdialogMessage(scip, NULL, "error reading file <%s>\n", tmpfilename);
1803  else
1804  SCIPdialogMessage(scip, NULL, "error reading file <%s> using <%s> file format\n",
1805  tmpfilename, extension);
1806 
1808  break;
1809  }
1810  else if( retcode == SCIP_PLUGINNOTFOUND )
1811  {
1812  /* ask user once for a suitable reader */
1813  if( extension == NULL )
1814  {
1815  SCIPdialogMessage(scip, NULL, "no reader for input file <%s> available\n", tmpfilename);
1816 
1817  SCIPdialogMessage(scip, NULL, "following readers are avaliable for reading:\n");
1819 
1820  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
1821  "select a suitable reader by extension (or return): ", &extension, &endoffile) );
1822 
1823  if( extension[0] == '\0' )
1824  break;
1825  }
1826  else
1827  {
1828  SCIPdialogMessage(scip, NULL, "no reader for file extension <%s> available\n", extension);
1829  extension = NULL;
1830  }
1831  }
1832  else
1833  {
1834  /* check if an unexpected error occurred during the reading process */
1835  SCIP_CALL( retcode );
1836  break;
1837  }
1838  }
1839  while( extension != NULL );
1840 
1841  /* free buffer array */
1842  SCIPfreeBufferArray(scip, &tmpfilename);
1843  }
1844  else
1845  {
1846  SCIPdialogMessage(scip, NULL, "file <%s> not found\n", filename);
1847  SCIPdialoghdlrClearBuffer(dialoghdlr);
1848  }
1849  }
1850 
1851  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1852 
1853  return SCIP_OKAY;
1854 }
1855 
1856 /** dialog execution method for the set default command */
1857 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetDefault)
1858 { /*lint --e{715}*/
1859  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1860 
1862  SCIPdialogMessage(scip, NULL, "reset parameters to their default values\n");
1863 
1864  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1865 
1866  return SCIP_OKAY;
1867 }
1868 
1869 /** dialog execution method for the set load command */
1870 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetLoad)
1871 { /*lint --e{715}*/
1872  char* filename;
1873  SCIP_Bool endoffile;
1874 
1875  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
1876  if( endoffile )
1877  {
1878  *nextdialog = NULL;
1879  return SCIP_OKAY;
1880  }
1881 
1882  if( filename[0] != '\0' )
1883  {
1884  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
1885 
1886  if( SCIPfileExists(filename) )
1887  {
1888  SCIP_CALL( SCIPreadParams(scip, filename) );
1889  SCIPdialogMessage(scip, NULL, "loaded parameter file <%s>\n", filename);
1890  }
1891  else
1892  {
1893  SCIPdialogMessage(scip, NULL, "file <%s> not found\n", filename);
1894  SCIPdialoghdlrClearBuffer(dialoghdlr);
1895  }
1896  }
1897 
1898  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1899 
1900  return SCIP_OKAY;
1901 }
1902 
1903 /** dialog execution method for the set save command */
1904 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSave)
1905 { /*lint --e{715}*/
1906  char* filename;
1907  SCIP_Bool endoffile;
1908 
1909  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
1910  if( endoffile )
1911  {
1912  *nextdialog = NULL;
1913  return SCIP_OKAY;
1914  }
1915 
1916  if( filename[0] != '\0' )
1917  {
1918  SCIP_RETCODE retcode;
1919 
1920  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
1921 
1922  retcode = SCIPwriteParams(scip, filename, TRUE, FALSE);
1923 
1924  if( retcode == SCIP_FILECREATEERROR )
1925  {
1926  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
1927  }
1928  else
1929  {
1930  SCIP_CALL( retcode );
1931  SCIPdialogMessage(scip, NULL, "saved parameter file <%s>\n", filename);
1932  }
1933  }
1934 
1935  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1936 
1937  return SCIP_OKAY;
1938 }
1939 
1940 /** dialog execution method for the set diffsave command */
1941 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetDiffsave)
1942 { /*lint --e{715}*/
1943  char* filename;
1944  SCIP_Bool endoffile;
1945 
1946  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
1947  if( endoffile )
1948  {
1949  *nextdialog = NULL;
1950  return SCIP_OKAY;
1951  }
1952 
1953  if( filename[0] != '\0' )
1954  {
1955  SCIP_RETCODE retcode;
1956 
1957  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
1958 
1959  retcode = SCIPwriteParams(scip, filename, TRUE, TRUE);
1960 
1961  if( retcode == SCIP_FILECREATEERROR )
1962  {
1963  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
1964  }
1965  else
1966  {
1967  SCIP_CALL( retcode );
1968  SCIPdialogMessage(scip, NULL, "saved non-default parameter settings to file <%s>\n", filename);
1969  }
1970  }
1971 
1972  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1973 
1974  return SCIP_OKAY;
1975 }
1976 
1977 /** dialog execution method for the set parameter command */
1978 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetParam)
1979 { /*lint --e{715}*/
1980  SCIP_PARAM* param;
1981  char prompt[SCIP_MAXSTRLEN];
1982  char* valuestr;
1983  SCIP_Bool boolval;
1984  int intval;
1985  SCIP_Longint longintval;
1986  SCIP_Real realval;
1987  char charval;
1988  SCIP_Bool endoffile;
1989  SCIP_Bool error;
1990 
1991  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1992 
1993  /* get the parameter to set */
1994  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
1995 
1996  /* depending on the parameter type, request a user input */
1997  switch( SCIPparamGetType(param) )
1998  {
1999  case SCIP_PARAMTYPE_BOOL:
2000  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %s, new value (TRUE/FALSE): ",
2001  SCIPparamGetBool(param) ? "TRUE" : "FALSE");
2002  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2003  if( endoffile )
2004  {
2005  *nextdialog = NULL;
2006  return SCIP_OKAY;
2007  }
2008  if( valuestr[0] == '\0' )
2009  return SCIP_OKAY;
2010 
2011  boolval = parseBoolValue(scip, valuestr, &error);
2012 
2013  if( error )
2014  {
2015  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for bool parameter <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
2016  valuestr, SCIPparamGetName(param));
2017  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2018  }
2019  else
2020  {
2021  assert(SCIPisBoolParamValid(scip, param, boolval));
2022 
2023  SCIP_CALL( SCIPchgBoolParam(scip, param, boolval) );
2024  SCIPdialogMessage(scip, NULL, "%s = %s\n", SCIPparamGetName(param), boolval ? "TRUE" : "FALSE");
2025  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, boolval ? "TRUE" : "FALSE", TRUE) );
2026 
2027  }
2028 
2029  break;
2030 
2031  case SCIP_PARAMTYPE_INT:
2032  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %d, new value [%d,%d]: ",
2033  SCIPparamGetInt(param), SCIPparamGetIntMin(param), SCIPparamGetIntMax(param));
2034  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2035  if( endoffile )
2036  {
2037  *nextdialog = NULL;
2038  return SCIP_OKAY;
2039  }
2040  if( valuestr[0] == '\0' )
2041  return SCIP_OKAY;
2042 
2043  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2044 
2045  if( sscanf(valuestr, "%d", &intval) != 1 || !SCIPisIntParamValid(scip, param, intval) )
2046  {
2047  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for int parameter <%s>. Must be integral in range [%d,%d].\n\n",
2048  valuestr, SCIPparamGetName(param), SCIPparamGetIntMin(param), SCIPparamGetIntMax(param));
2049  }
2050  else
2051  {
2052  SCIP_CALL( SCIPchgIntParam(scip, param, intval) );
2053  SCIPdialogMessage(scip, NULL, "%s = %d\n", SCIPparamGetName(param), intval);
2054  }
2055 
2056  break;
2057 
2059  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %" SCIP_LONGINT_FORMAT ", new value [%" SCIP_LONGINT_FORMAT ",%" SCIP_LONGINT_FORMAT "]: ",
2061  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2062  if( endoffile )
2063  {
2064  *nextdialog = NULL;
2065  return SCIP_OKAY;
2066  }
2067  if( valuestr[0] == '\0' )
2068  return SCIP_OKAY;
2069 
2070  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2071 
2072  if( sscanf(valuestr, "%" SCIP_LONGINT_FORMAT, &longintval) != 1 || !SCIPisLongintParamValid(scip, param, longintval) )
2073  {
2074  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for longint parameter <%s>. Must be integral in range [%" SCIP_LONGINT_FORMAT ",%" SCIP_LONGINT_FORMAT "].\n\n",
2075  valuestr, SCIPparamGetName(param), SCIPparamGetLongintMin(param), SCIPparamGetLongintMax(param));
2076  }
2077  else
2078  {
2079  SCIP_CALL( SCIPchgLongintParam(scip, param, longintval) );
2080  SCIPdialogMessage(scip, NULL, "%s = %" SCIP_LONGINT_FORMAT "\n", SCIPparamGetName(param), longintval);
2081  }
2082  break;
2083 
2084  case SCIP_PARAMTYPE_REAL:
2085  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %.15g, new value [%.15g,%.15g]: ",
2087  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2088  if( endoffile )
2089  {
2090  *nextdialog = NULL;
2091  return SCIP_OKAY;
2092  }
2093  if( valuestr[0] == '\0' )
2094  return SCIP_OKAY;
2095 
2096  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2097 
2098  if( sscanf(valuestr, "%" SCIP_REAL_FORMAT, &realval) != 1 || !SCIPisRealParamValid(scip, param, realval) )
2099  {
2100  SCIPdialogMessage(scip, NULL, "\nInvalid real parameter value <%s> for parameter <%s>. Must be in range [%.15g,%.15g].\n\n",
2101  valuestr, SCIPparamGetName(param), SCIPparamGetRealMin(param), SCIPparamGetRealMax(param));
2102  }
2103  else
2104  {
2105  SCIP_CALL( SCIPchgRealParam(scip, param, realval) );
2106  SCIPdialogMessage(scip, NULL, "%s = %.15g\n", SCIPparamGetName(param), realval);
2107  }
2108  break;
2109 
2110  case SCIP_PARAMTYPE_CHAR:
2111  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: <%c>, new value: ", SCIPparamGetChar(param));
2112  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2113  if( endoffile )
2114  {
2115  *nextdialog = NULL;
2116  return SCIP_OKAY;
2117  }
2118  if( valuestr[0] == '\0' )
2119  return SCIP_OKAY;
2120 
2121  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2122 
2123  if( sscanf(valuestr, "%c", &charval) != 1 || !SCIPisCharParamValid(scip, param, charval) )
2124  {
2125  SCIPdialogMessage(scip, NULL, "\nInvalid char parameter value <%s>. Must be in set {%s}.\n\n",
2126  valuestr, SCIPparamGetCharAllowedValues(param));
2127  }
2128  else
2129  {
2130  SCIP_CALL( SCIPchgCharParam(scip, param, charval) );
2131  SCIPdialogMessage(scip, NULL, "%s = %c\n", SCIPparamGetName(param), charval);
2132  }
2133  break;
2134 
2135  case SCIP_PARAMTYPE_STRING:
2136  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: <%s>, new value: ", SCIPparamGetString(param));
2137  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2138  if( endoffile )
2139  {
2140  *nextdialog = NULL;
2141  return SCIP_OKAY;
2142  }
2143  if( valuestr[0] == '\0' )
2144  return SCIP_OKAY;
2145 
2146  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2147 
2148  if ( !SCIPisStringParamValid(scip, param, valuestr) )
2149  {
2150  SCIPdialogMessage(scip, NULL, "\nInvalid character in string parameter.\n\n");
2151  }
2152  else
2153  {
2154  SCIP_CALL( SCIPchgStringParam(scip, param, valuestr) );
2155  SCIPdialogMessage(scip, NULL, "%s = %s\n", SCIPparamGetName(param), valuestr);
2156  }
2157  break;
2158 
2159  default:
2160  SCIPerrorMessage("invalid parameter type\n");
2161  return SCIP_INVALIDDATA;
2162  }
2163 
2164  return SCIP_OKAY;
2165 }
2166 
2167 /** dialog description method for the set parameter command */
2168 SCIP_DECL_DIALOGDESC(SCIPdialogDescSetParam)
2169 { /*lint --e{715}*/
2170  SCIP_PARAM* param;
2171  char valuestr[SCIP_MAXSTRLEN];
2172 
2173  /* get the parameter to set */
2174  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
2175 
2176  /* retrieve parameter's current value */
2177  switch( SCIPparamGetType(param) )
2178  {
2179  case SCIP_PARAMTYPE_BOOL:
2180  if( SCIPparamGetBool(param) )
2181  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "TRUE");
2182  else
2183  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "FALSE");
2184  break;
2185 
2186  case SCIP_PARAMTYPE_INT:
2187  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%d", SCIPparamGetInt(param));
2188  break;
2189 
2191  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%" SCIP_LONGINT_FORMAT, SCIPparamGetLongint(param));
2192  break;
2193 
2194  case SCIP_PARAMTYPE_REAL:
2195  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%.15g", SCIPparamGetReal(param));
2196  if( strchr(valuestr, '.') == NULL && strchr(valuestr, 'e') == NULL )
2197  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%.1f", SCIPparamGetReal(param));
2198  break;
2199 
2200  case SCIP_PARAMTYPE_CHAR:
2201  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%c", SCIPparamGetChar(param));
2202  break;
2203 
2204  case SCIP_PARAMTYPE_STRING:
2205  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%s", SCIPparamGetString(param));
2206  break;
2207 
2208  default:
2209  SCIPerrorMessage("invalid parameter type\n");
2210  return SCIP_INVALIDDATA;
2211  }
2212  valuestr[SCIP_MAXSTRLEN-1] = '\0';
2213 
2214  /* display parameter's description */
2215  SCIPdialogMessage(scip, NULL, "%s", SCIPparamGetDesc(param));
2216 
2217  /* display parameter's current value */
2218  SCIPdialogMessage(scip, NULL, " [%s]", valuestr);
2219 
2220  return SCIP_OKAY;
2221 }
2222 
2223 /** dialog execution method for the fix parameter command */
2224 SCIP_DECL_DIALOGEXEC(SCIPdialogExecFixParam)
2225 { /*lint --e{715}*/
2226  SCIP_PARAM* param;
2227  char prompt[SCIP_MAXSTRLEN];
2228  char* valuestr;
2229  SCIP_Bool fix;
2230  SCIP_Bool endoffile;
2231  SCIP_Bool error;
2232 
2233  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2234 
2235  /* get the parameter to fix */
2236  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
2237 
2238  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current fixing status: %s, new value (TRUE/FALSE): ",
2239  SCIPparamIsFixed(param) ? "TRUE" : "FALSE");
2240  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2241  if( endoffile )
2242  {
2243  *nextdialog = NULL;
2244  return SCIP_OKAY;
2245  }
2246  if( valuestr[0] == '\0' )
2247  return SCIP_OKAY;
2248 
2249  fix = parseBoolValue(scip, valuestr, &error);
2250 
2251  if( !error )
2252  {
2253  SCIPparamSetFixed(param, fix);
2254  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, (fix ? "TRUE" : "FALSE"), TRUE) );
2255  SCIPdialogMessage(scip, NULL, "<%s> %s\n", SCIPparamGetName(param), (fix ? "fixed" : "unfixed"));
2256  }
2257  else
2258  {
2259  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2260  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for fixing status. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
2261  valuestr);
2262  }
2263 
2264  return SCIP_OKAY;
2265 }
2266 
2267 /** dialog description method for the fix parameter command */
2268 SCIP_DECL_DIALOGDESC(SCIPdialogDescFixParam)
2269 { /*lint --e{715}*/
2270  SCIP_PARAM* param;
2271 
2272  /* get the parameter to set */
2273  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
2274 
2275  /* display parameter's description */
2276  SCIPdialogMessage(scip, NULL, "%s", SCIPparamGetDesc(param));
2277 
2278  /* display parameter's current fixing status */
2279  if( SCIPparamIsFixed(param) )
2280  SCIPdialogMessage(scip, NULL, " [fixed]");
2281  else
2282  SCIPdialogMessage(scip, NULL, " [not fixed]");
2283 
2284  return SCIP_OKAY;
2285 }
2286 
2287 /** dialog execution method for the set branching direction command */
2288 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetBranchingDirection)
2289 { /*lint --e{715}*/
2290  SCIP_VAR* var;
2291  char prompt[SCIP_MAXSTRLEN];
2292  char* valuestr;
2293  int direction;
2294  SCIP_Bool endoffile;
2295 
2296  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2297 
2298  /* branching priorities cannot be set, if no problem was created */
2300  {
2301  SCIPdialogMessage(scip, NULL, "cannot set branching directions before problem was created\n");
2302  return SCIP_OKAY;
2303  }
2304 
2305  /* get variable name from user */
2306  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "variable name: ", &valuestr, &endoffile) );
2307  if( endoffile )
2308  {
2309  *nextdialog = NULL;
2310  return SCIP_OKAY;
2311  }
2312  if( valuestr[0] == '\0' )
2313  return SCIP_OKAY;
2314 
2315  /* find variable */
2316  var = SCIPfindVar(scip, valuestr);
2317  if( var == NULL )
2318  {
2319  SCIPdialogMessage(scip, NULL, "variable <%s> does not exist in problem\n", valuestr);
2320  return SCIP_OKAY;
2321  }
2322 
2323  /* get new branching direction from user */
2324  switch( SCIPvarGetBranchDirection(var) )
2325  {
2327  direction = -1;
2328  break;
2329  case SCIP_BRANCHDIR_AUTO:
2330  direction = 0;
2331  break;
2333  direction = +1;
2334  break;
2335  case SCIP_BRANCHDIR_FIXED:
2336  default:
2337  SCIPerrorMessage("invalid preferred branching direction <%d> of variable <%s>\n",
2339  return SCIP_INVALIDDATA;
2340  }
2341  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %d, new value: ", direction);
2342  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2343  if( endoffile )
2344  {
2345  *nextdialog = NULL;
2346  return SCIP_OKAY;
2347  }
2349  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "%s %s", prompt, valuestr);
2350  if( valuestr[0] == '\0' )
2351  return SCIP_OKAY;
2352 
2353  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, prompt, FALSE) );
2354 
2355  if( sscanf(valuestr, "%d", &direction) != 1 )
2356  {
2357  SCIPdialogMessage(scip, NULL, "\ninvalid input <%s>\n\n", valuestr);
2358  return SCIP_OKAY;
2359  }
2360  if( direction < -1 || direction > +1 )
2361  {
2362  SCIPdialogMessage(scip, NULL, "\ninvalid input <%d>: direction must be -1, 0, or +1\n\n", direction);
2363  return SCIP_OKAY;
2364  }
2365 
2366  /* set new branching direction */
2367  if( direction == -1 )
2369  else if( direction == 0 )
2371  else
2373 
2374  SCIPdialogMessage(scip, NULL, "branching direction of variable <%s> set to %d\n", SCIPvarGetName(var), direction);
2375 
2376  return SCIP_OKAY;
2377 }
2378 
2379 /** dialog execution method for the set branching priority command */
2380 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetBranchingPriority)
2381 { /*lint --e{715}*/
2382  SCIP_VAR* var;
2383  char prompt[SCIP_MAXSTRLEN];
2384  char* valuestr;
2385  int priority;
2386  SCIP_Bool endoffile;
2387 
2388  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2389 
2390  /* branching priorities cannot be set, if no problem was created */
2392  {
2393  SCIPdialogMessage(scip, NULL, "cannot set branching priorities before problem was created\n");
2394  return SCIP_OKAY;
2395  }
2396 
2397  /* get variable name from user */
2398  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "variable name: ", &valuestr, &endoffile) );
2399  if( endoffile )
2400  {
2401  *nextdialog = NULL;
2402  return SCIP_OKAY;
2403  }
2404  if( valuestr[0] == '\0' )
2405  return SCIP_OKAY;
2406 
2407  /* find variable */
2408  var = SCIPfindVar(scip, valuestr);
2409  if( var == NULL )
2410  {
2411  SCIPdialogMessage(scip, NULL, "variable <%s> does not exist in problem\n", valuestr);
2412  return SCIP_OKAY;
2413  }
2414 
2415  /* get new branching priority from user */
2416  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %d, new value: ", SCIPvarGetBranchPriority(var));
2417  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2418  if( endoffile )
2419  {
2420  *nextdialog = NULL;
2421  return SCIP_OKAY;
2422  }
2424  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "%s %s", prompt, valuestr);
2425  if( valuestr[0] == '\0' )
2426  return SCIP_OKAY;
2427 
2428  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, prompt, FALSE) );
2429 
2430  if( sscanf(valuestr, "%d", &priority) != 1 )
2431  {
2432  SCIPdialogMessage(scip, NULL, "\ninvalid input <%s>\n\n", valuestr);
2433  return SCIP_OKAY;
2434  }
2435 
2436  /* set new branching priority */
2437  SCIP_CALL( SCIPchgVarBranchPriority(scip, var, priority) );
2438  SCIPdialogMessage(scip, NULL, "branching priority of variable <%s> set to %d\n", SCIPvarGetName(var), SCIPvarGetBranchPriority(var));
2439 
2440  return SCIP_OKAY;
2441 }
2442 
2443 /** dialog execution method for the set heuristics aggressive command */
2444 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsAggressive)
2445 { /*lint --e{715}*/
2446  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2447 
2448  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2449 
2451 
2452  return SCIP_OKAY;
2453 }
2454 
2455 /** dialog execution method for the set heuristics default command */
2456 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsDefault)
2457 { /*lint --e{715}*/
2458  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2459 
2460  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2461 
2463 
2464  return SCIP_OKAY;
2465 }
2466 
2467 /** dialog execution method for the set heuristics fast command */
2468 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsFast)
2469 { /*lint --e{715}*/
2470  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2471 
2472  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2473 
2475 
2476  return SCIP_OKAY;
2477 }
2478 
2479 /** dialog execution method for the set heuristics off command */
2480 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsOff)
2481 { /*lint --e{715}*/
2482  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2483 
2484  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2485 
2487 
2488  return SCIP_OKAY;
2489 }
2490 
2491 /** dialog execution method for the set presolving aggressive command */
2492 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingAggressive)
2493 { /*lint --e{715}*/
2494  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2495 
2496  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2497 
2499 
2500  return SCIP_OKAY;
2501 }
2502 
2503 /** dialog execution method for the set presolving default command */
2504 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingDefault)
2505 { /*lint --e{715}*/
2506  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2507 
2508  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2509 
2511 
2512  return SCIP_OKAY;
2513 }
2514 
2515 /** dialog execution method for the set presolving fast command */
2516 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingFast)
2517 { /*lint --e{715}*/
2518  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2519 
2520  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2521 
2523 
2524  return SCIP_OKAY;
2525 }
2526 
2527 /** dialog execution method for the set presolving off command */
2528 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingOff)
2529 { /*lint --e{715}*/
2530  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2531 
2532  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2533 
2535 
2536  return SCIP_OKAY;
2537 }
2538 
2539 /** dialog execution method for the set separating aggressive command */
2540 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingAggressive)
2541 { /*lint --e{715}*/
2542  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2543 
2544  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2545 
2547 
2548  return SCIP_OKAY;
2549 }
2550 
2551 /** dialog execution method for the set separating default command */
2552 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingDefault)
2553 { /*lint --e{715}*/
2554  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2555 
2556  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2557 
2559 
2560  return SCIP_OKAY;
2561 }
2562 
2563 /** dialog execution method for the set separating fast command */
2564 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingFast)
2565 { /*lint --e{715}*/
2566  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2567 
2568  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2569 
2571 
2572  return SCIP_OKAY;
2573 }
2574 
2575 /** dialog execution method for the set separating off command */
2576 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingOff)
2577 { /*lint --e{715}*/
2578  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2579 
2580  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2581 
2583 
2584  return SCIP_OKAY;
2585 }
2586 
2587 /** dialog execution method for the set emphasis counter command */
2588 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisCounter)
2589 { /*lint --e{715}*/
2590  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2591 
2592  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2593 
2594  /* reset SCIP parameters */
2596 
2597  /* set parameters for counting problems */
2599 
2600  return SCIP_OKAY;
2601 }
2602 
2603 /** dialog execution method for the set emphasis cpsolver command */
2604 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisCpsolver)
2605 { /*lint --e{715}*/
2606  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2607 
2608  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2609 
2610  /* reset SCIP parameters */
2612 
2613  /* set parameters for CP like search problems */
2615 
2616  return SCIP_OKAY;
2617 }
2618 
2619 /** dialog execution method for the set emphasis easy CIP command */
2620 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisEasycip)
2621 { /*lint --e{715}*/
2622  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2623 
2624  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2625 
2626  /* reset SCIP parameters */
2628 
2629  /* set parameters for easy CIP problems */
2631 
2632  return SCIP_OKAY;
2633 }
2634 
2635 /** dialog execution method for the set emphasis feasibility command */
2636 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisFeasibility)
2637 { /*lint --e{715}*/
2638  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2639 
2640  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2641 
2642  /* reset SCIP parameters */
2644 
2645  /* set parameters for feasibility problems */
2647 
2648  return SCIP_OKAY;
2649 }
2650 
2651 /** dialog execution method for the set emphasis hard LP command */
2652 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisHardlp)
2653 { /*lint --e{715}*/
2654  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2655 
2656  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2657 
2658  /* reset SCIP parameters */
2660 
2661  /* set parameters for problems with hard LP */
2663 
2664  return SCIP_OKAY;
2665 }
2666 
2667 /** dialog execution method for the set emphasis optimality command */
2668 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisOptimality)
2669 { /*lint --e{715}*/
2670  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2671 
2672  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2673 
2674  /* reset SCIP parameters */
2676 
2677  /* set parameters for problems to prove optimality fast */
2679 
2680  return SCIP_OKAY;
2681 }
2682 
2683 /** dialog execution method for the set limits objective command */
2684 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetLimitsObjective)
2685 { /*lint --e{715}*/
2686  char prompt[SCIP_MAXSTRLEN];
2687  char* valuestr;
2688  SCIP_Real objlim;
2689  SCIP_Bool endoffile;
2690 
2691  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2692 
2693  /* objective limit cannot be set, if no problem was created */
2695  {
2696  SCIPdialogMessage(scip, NULL, "cannot set objective limit before problem was created\n");
2697  return SCIP_OKAY;
2698  }
2699 
2700  /* get new objective limit from user */
2701  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %.15g, new value: ", SCIPgetObjlimit(scip));
2702  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2703  if( endoffile )
2704  {
2705  *nextdialog = NULL;
2706  return SCIP_OKAY;
2707  }
2708  if( valuestr[0] == '\0' )
2709  return SCIP_OKAY;
2710 
2711  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2712 
2713  if( sscanf(valuestr, "%" SCIP_REAL_FORMAT, &objlim) != 1 )
2714  {
2715  SCIPdialogMessage(scip, NULL, "\ninvalid input <%s>\n\n", valuestr);
2716  return SCIP_OKAY;
2717  }
2718 
2719  /* check, if new objective limit is valid */
2722  {
2723  SCIPdialogMessage(scip, NULL, "\ncannot relax objective limit from %.15g to %.15g after problem was transformed\n\n",
2724  SCIPgetObjlimit(scip), objlim);
2725  return SCIP_OKAY;
2726  }
2727 
2728  /* set new objective limit */
2729  SCIP_CALL( SCIPsetObjlimit(scip, objlim) );
2730  SCIPdialogMessage(scip, NULL, "objective value limit set to %.15g\n", SCIPgetObjlimit(scip));
2731 
2732  return SCIP_OKAY;
2733 }
2734 
2735 /** dialog execution method for the write LP command */
2736 static
2737 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteLp)
2738 { /*lint --e{715}*/
2739  char* filename;
2740  SCIP_Bool endoffile;
2741 
2742  SCIPdialogMessage(scip, NULL, "\n");
2743 
2744  /* node relaxations only exist in solving & solved stage */
2746  {
2747  SCIPdialogMessage(scip, NULL, "There is no node LP relaxation before solving starts\n");
2748  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2749  return SCIP_OKAY;
2750  }
2752  {
2753  SCIPdialogMessage(scip, NULL, "There is no node LP relaxation after problem was solved\n");
2754  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2755  return SCIP_OKAY;
2756  }
2757 
2758  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
2759  if( endoffile )
2760  {
2761  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2762  return SCIP_OKAY;
2763  }
2764  if( filename[0] != '\0' )
2765  {
2766  SCIP_RETCODE retcode;
2767 
2768  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
2769  retcode = SCIPwriteLP(scip, filename);
2770 
2771  if( retcode == SCIP_FILECREATEERROR )
2772  {
2773  SCIPdialogMessage(scip, NULL, "error not creating file <%s>\n", filename);
2774  }
2775  else
2776  {
2777  SCIP_CALL( retcode );
2778 
2779  SCIPdialogMessage(scip, NULL, "written node LP relaxation to file <%s>\n", filename);
2780  }
2781  }
2782 
2783  SCIPdialogMessage(scip, NULL, "\n");
2784 
2785  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2786 
2787  return SCIP_OKAY;
2788 }
2789 
2790 /** dialog execution method for the write MIP command */
2791 static
2792 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteMip)
2793 { /*lint --e{715}*/
2794  char command[SCIP_MAXSTRLEN];
2795  char filename[SCIP_MAXSTRLEN];
2796  SCIP_Bool endoffile;
2797  char* valuestr;
2798  SCIP_Bool offset;
2799  SCIP_Bool generic;
2800  SCIP_Bool lazyconss;
2801  SCIP_Bool error;
2802 
2803  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2804 
2805  /* node relaxations only exist in solving & solved stage */
2807  {
2808  SCIPdialogMessage(scip, NULL, "There is no node MIP relaxation before solving starts\n");
2809  return SCIP_OKAY;
2810  }
2812  {
2813  SCIPdialogMessage(scip, NULL, "There is no node MIP relaxation after problem was solved\n");
2814  return SCIP_OKAY;
2815  }
2816 
2817  /* first get file name */
2818  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &valuestr, &endoffile) );
2819  if( endoffile )
2820  {
2821  *nextdialog = NULL;
2822  return SCIP_OKAY;
2823  }
2824  if( valuestr[0] == '\0' )
2825  return SCIP_OKAY;
2826 
2827  (void)strncpy(filename, valuestr, SCIP_MAXSTRLEN-1);
2828 
2829  /* second ask for generic variable and row names */
2830  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
2831  "using generic variable and row names (TRUE/FALSE): ",
2832  &valuestr, &endoffile) );
2833 
2834  if( endoffile )
2835  {
2836  *nextdialog = NULL;
2837  return SCIP_OKAY;
2838  }
2839  if( valuestr[0] == '\0' )
2840  return SCIP_OKAY;
2841 
2842  generic = parseBoolValue(scip, valuestr, &error);
2843 
2844  if( error )
2845  {
2846  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
2847  valuestr);
2848 
2849  return SCIP_OKAY;
2850  }
2851 
2852  /* adjust command and add to the history */
2853  SCIPescapeString(command, SCIP_MAXSTRLEN, filename);
2854  (void) SCIPsnprintf(command, SCIP_MAXSTRLEN, "%s %s", command, generic ? "TRUE" : "FALSE");
2855 
2856  /* third ask if for adjusting the objective offset */
2857  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
2858  "using original objective function (TRUE/FALSE): ",
2859  &valuestr, &endoffile) );
2860 
2861  if( endoffile )
2862  {
2863  *nextdialog = NULL;
2864  return SCIP_OKAY;
2865  }
2866  if( valuestr[0] == '\0' )
2867  return SCIP_OKAY;
2868 
2869  offset = parseBoolValue(scip, valuestr, &error);
2870 
2871  if( error )
2872  {
2873  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
2874  valuestr);
2875 
2876  return SCIP_OKAY;
2877  }
2878 
2879  (void) SCIPsnprintf(command, SCIP_MAXSTRLEN, "%s %s", command, offset ? "TRUE" : "FALSE");
2880  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, command, FALSE) );
2881 
2882  /* fourth ask for lazy constraints */
2883  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
2884  "output removable rows as lazy constraints (TRUE/FALSE): ",
2885  &valuestr, &endoffile) );
2886 
2887  if( endoffile )
2888  {
2889  *nextdialog = NULL;
2890  return SCIP_OKAY;
2891  }
2892  if( valuestr[0] == '\0' )
2893  return SCIP_OKAY;
2894 
2895  lazyconss = parseBoolValue(scip, valuestr, &error);
2896 
2897  if( error )
2898  {
2899  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
2900  valuestr);
2901 
2902  return SCIP_OKAY;
2903  }
2904 
2905  /* adjust command and add to the history */
2906  SCIPescapeString(command, SCIP_MAXSTRLEN, filename);
2907  (void) SCIPsnprintf(command, SCIP_MAXSTRLEN, "%s %s", command, lazyconss ? "TRUE" : "FALSE");
2908 
2909  /* execute command */
2910  SCIP_CALL( SCIPwriteMIP(scip, filename, generic, offset, lazyconss) );
2911  SCIPdialogMessage(scip, NULL, "written node MIP relaxation to file <%s>\n", filename);
2912 
2913  SCIPdialogMessage(scip, NULL, "\n");
2914 
2915  return SCIP_OKAY;
2916 }
2917 
2918 
2919 /** dialog execution method for the write NLP command */
2920 static
2921 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteNlp)
2922 { /*lint --e{715}*/
2923  char* filename;
2924  SCIP_Bool endoffile;
2925 
2926  SCIPdialogMessage(scip, NULL, "\n");
2927 
2928  /* node relaxations only exist in solving & solved stage */
2930  {
2931  SCIPdialogMessage(scip, NULL, "There is no node NLP relaxation before solving starts\n");
2932  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2933  return SCIP_OKAY;
2934  }
2936  {
2937  SCIPdialogMessage(scip, NULL, "There is no node NLP relaxation after problem was solved\n");
2938  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2939  return SCIP_OKAY;
2940  }
2941  if( !SCIPisNLPConstructed(scip) )
2942  {
2943  SCIPdialogMessage(scip, NULL, "There has been no node NLP relaxation constructed\n");
2944  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2945  return SCIP_OKAY;
2946  }
2947 
2948  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
2949  if( endoffile )
2950  {
2951  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2952  return SCIP_OKAY;
2953  }
2954  if( filename[0] != '\0' )
2955  {
2956  SCIP_RETCODE retcode;
2957 
2958  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
2959  retcode = SCIPwriteNLP(scip, filename);
2960 
2961  if( retcode == SCIP_FILECREATEERROR )
2962  {
2963  SCIPdialogMessage(scip, NULL, "error not creating file <%s>\n", filename);
2964  }
2965  else
2966  {
2967  SCIP_CALL( retcode );
2968 
2969  SCIPdialogMessage(scip, NULL, "written node NLP relaxation to file <%s>\n", filename);
2970  }
2971  }
2972 
2973  SCIPdialogMessage(scip, NULL, "\n");
2974 
2975  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2976 
2977  return SCIP_OKAY;
2978 }
2979 
2980 /** dialog execution method for the write problem command */
2981 static
2982 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteProblem)
2983 { /*lint --e{715}*/
2984  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2985 
2987  {
2988  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, FALSE, FALSE) );
2989  }
2990  else
2991  SCIPdialogMessage(scip, NULL, "no problem available\n");
2992 
2993  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2994 
2995  return SCIP_OKAY;
2996 }
2997 
2998 /** dialog execution method for the write generic problem command */
2999 static
3000 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteGenProblem)
3001 { /*lint --e{715}*/
3002  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3003 
3005  {
3006  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, FALSE, TRUE) );
3007  }
3008  else
3009  SCIPdialogMessage(scip, NULL, "no problem available\n");
3010 
3011  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3012 
3013  return SCIP_OKAY;
3014 }
3015 
3016 /** dialog execution method for the write solution command */
3017 static
3018 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteSolution)
3019 { /*lint --e{715}*/
3020  char* filename;
3021  SCIP_Bool endoffile;
3022 
3023  SCIPdialogMessage(scip, NULL, "\n");
3024 
3025  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3026  if( endoffile )
3027  {
3028  *nextdialog = NULL;
3029  return SCIP_OKAY;
3030  }
3031  if( filename[0] != '\0' )
3032  {
3033  FILE* file;
3034 
3035  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3036 
3037  file = fopen(filename, "w");
3038  if( file == NULL )
3039  {
3040  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3041  SCIPdialoghdlrClearBuffer(dialoghdlr);
3042  }
3043  else
3044  {
3045  SCIP_Bool printzeros;
3046 
3047  SCIPinfoMessage(scip, file, "solution status: ");
3048  SCIP_CALL_FINALLY( SCIPprintStatus(scip, file), fclose(file) );
3049 
3050  SCIP_CALL_FINALLY( SCIPgetBoolParam(scip, "write/printzeros", &printzeros), fclose(file) );
3051 
3052  SCIPinfoMessage(scip, file, "\n");
3053  SCIP_CALL_FINALLY( SCIPprintBestSol(scip, file, printzeros), fclose(file) );
3054 
3055  SCIPdialogMessage(scip, NULL, "written solution information to file <%s>\n", filename);
3056  fclose(file);
3057  }
3058  }
3059 
3060  SCIPdialogMessage(scip, NULL, "\n");
3061 
3062  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3063 
3064  return SCIP_OKAY;
3065 }
3066 
3067 /** dialog execution method for the write mipstart command */
3068 static
3069 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteMIPStart)
3070 { /*lint --e{715}*/
3071  char* filename;
3072  SCIP_Bool endoffile;
3073 
3074  SCIPdialogMessage(scip, NULL, "\n");
3075 
3076  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3077  if( endoffile )
3078  {
3079  *nextdialog = NULL;
3080  return SCIP_OKAY;
3081  }
3082  if( filename[0] != '\0' )
3083  {
3084  FILE* file;
3085 
3086  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3087 
3088  file = fopen(filename, "w");
3089  if( file == NULL )
3090  {
3091  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3092  SCIPdialoghdlrClearBuffer(dialoghdlr);
3093  }
3094  else
3095  {
3096  SCIP_SOL* sol;
3097 
3098  SCIPinfoMessage(scip, file, "\n");
3099 
3100  sol = SCIPgetBestSol(scip);
3101 
3102  if( sol == NULL )
3103  {
3104  SCIPdialogMessage(scip, NULL, "no mip start available\n");
3105  fclose(file);
3106  }
3107  else
3108  {
3109  SCIP_CALL_FINALLY( SCIPprintMIPStart(scip, sol, file), fclose(file) );
3110 
3111  SCIPdialogMessage(scip, NULL, "written mip start information to file <%s>\n", filename);
3112  fclose(file);
3113  }
3114  }
3115  }
3116 
3117  SCIPdialogMessage(scip, NULL, "\n");
3118 
3119  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3120 
3121  return SCIP_OKAY;
3122 }
3123 
3124 /** dialog execution method for writing command line history */
3125 static
3126 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteCommandHistory)
3127 { /*lint --e{715}*/
3128  char* filename;
3129  SCIP_Bool endoffile;
3130 
3131  SCIPdialogMessage(scip, NULL, "\n");
3132 
3133  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3134  if( endoffile )
3135  {
3136  *nextdialog = NULL;
3137  return SCIP_OKAY;
3138  }
3139  if( filename[0] != '\0' )
3140  {
3141  SCIP_RETCODE retcode;
3142 
3143  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3144 
3145  retcode = SCIPdialogWriteHistory(filename);
3146 
3147  if( retcode != SCIP_OKAY )
3148  {
3149  SCIPdialogMessage(scip, NULL, "error writing to file <%s>\n"
3150  "check that the directory exists and that you have correct permissions\n", filename);
3151  SCIPdialoghdlrClearBuffer(dialoghdlr);
3152  }
3153  else
3154  {
3155  SCIPdialogMessage(scip, NULL, "wrote available command line history to <%s>\n", filename);
3156  }
3157  }
3158 
3159  SCIPdialogMessage(scip, NULL, "\n");
3160 
3161  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3162 
3163  return SCIP_OKAY;
3164 }
3165 
3166 /** dialog execution method for the write finitesolution command */
3167 static
3168 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteFiniteSolution)
3169 { /*lint --e{715}*/
3170  char* filename;
3171  SCIP_Bool endoffile;
3172 
3173  SCIPdialogMessage(scip, NULL, "\n");
3174 
3175  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3176  if( endoffile )
3177  {
3178  *nextdialog = NULL;
3179  return SCIP_OKAY;
3180  }
3181  if( filename[0] != '\0' )
3182  {
3183  FILE* file;
3184 
3185  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3186 
3187  file = fopen(filename, "w");
3188  if( file == NULL )
3189  {
3190  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3191  SCIPdialoghdlrClearBuffer(dialoghdlr);
3192  }
3193  else
3194  {
3195  SCIP_SOL* bestsol = SCIPgetBestSol(scip);
3196  SCIP_Bool printzeros;
3197 
3198  SCIPinfoMessage(scip, file, "solution status: ");
3199 
3200  SCIP_CALL_FINALLY( SCIPprintStatus(scip, file), fclose(file) );
3201 
3202  SCIPinfoMessage(scip, file, "\n");
3203 
3204  if( bestsol != NULL )
3205  {
3206  SCIP_SOL* sol;
3207  SCIP_Bool success;
3208 
3209  SCIP_CALL_FINALLY( SCIPcreateFiniteSolCopy(scip, &sol, bestsol, &success), fclose(file) );
3210 
3211  SCIP_CALL_FINALLY( SCIPgetBoolParam(scip, "write/printzeros", &printzeros), fclose(file) );
3212 
3213  SCIP_CALL_FINALLY( SCIPprintSol(scip, sol, file, printzeros), fclose(file) );
3214 
3215  SCIPdialogMessage(scip, NULL, "written solution information to file <%s>\n", filename);
3216 
3217  SCIP_CALL_FINALLY( SCIPfreeSol(scip, &sol), fclose(file) );
3218  }
3219  else
3220  {
3221  SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, "no solution available\n");
3222  SCIPdialogMessage(scip, NULL, "no solution available\n", filename);
3223  }
3224 
3225  fclose(file);
3226  }
3227  }
3228 
3229  SCIPdialogMessage(scip, NULL, "\n");
3230 
3231  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3232 
3233  return SCIP_OKAY;
3234 }
3235 
3236 /** dialog execution method for the write statistics command */
3237 static
3238 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteStatistics)
3239 { /*lint --e{715}*/
3240  char* filename;
3241  SCIP_Bool endoffile;
3242 
3243  SCIPdialogMessage(scip, NULL, "\n");
3244 
3245  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3246  if( endoffile )
3247  {
3248  *nextdialog = NULL;
3249  return SCIP_OKAY;
3250  }
3251  if( filename[0] != '\0' )
3252  {
3253  FILE* file;
3254 
3255  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3256 
3257  file = fopen(filename, "w");
3258  if( file == NULL )
3259  {
3260  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3261  SCIPprintSysError(filename);
3262  SCIPdialoghdlrClearBuffer(dialoghdlr);
3263  }
3264  else
3265  {
3266  SCIP_CALL_FINALLY( SCIPprintStatistics(scip, file), fclose(file) );
3267 
3268  SCIPdialogMessage(scip, NULL, "written statistics to file <%s>\n", filename);
3269  fclose(file);
3270  }
3271  }
3272 
3273  SCIPdialogMessage(scip, NULL, "\n");
3274 
3275  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3276 
3277  return SCIP_OKAY;
3278 }
3279 
3280 /** dialog execution method for the write transproblem command */
3281 static
3282 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteTransproblem)
3283 { /*lint --e{715}*/
3284  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3285 
3287  {
3288  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, TRUE, FALSE) );
3289  }
3290  else
3291  SCIPdialogMessage(scip, NULL, "no transformed problem available\n");
3292 
3293  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3294 
3295  return SCIP_OKAY;
3296 }
3297 
3298 /** dialog execution method for the write generic transproblem command */
3299 static
3300 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteGenTransproblem)
3301 { /*lint --e{715}*/
3302  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3303 
3305  {
3306  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, TRUE, TRUE) );
3307  }
3308  else
3309  SCIPdialogMessage(scip, NULL, "no transformed problem available\n");
3310 
3311  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3312 
3313  return SCIP_OKAY;
3314 }
3315 
3316 /** creates a root dialog */
3318  SCIP* scip, /**< SCIP data structure */
3319  SCIP_DIALOG** root /**< pointer to store the root dialog */
3320  )
3321 {
3322  SCIP_CALL( SCIPincludeDialog(scip, root,
3323  dialogCopyDefault,
3324  SCIPdialogExecMenuLazy, NULL, NULL,
3325  "SCIP", "SCIP's main menu", TRUE, NULL) );
3326 
3327  SCIP_CALL( SCIPsetRootDialog(scip, *root) );
3328  SCIP_CALL( SCIPreleaseDialog(scip, root) );
3329  *root = SCIPgetRootDialog(scip);
3330 
3331  return SCIP_OKAY;
3332 }
3333 
3334 
3335 /** includes or updates the default dialog menus in SCIP */
3337  SCIP* scip /**< SCIP data structure */
3338  )
3339 {
3340  SCIP_DIALOG* root;
3341  SCIP_DIALOG* submenu;
3342  SCIP_DIALOG* dialog;
3343 
3344  /* root menu */
3345  root = SCIPgetRootDialog(scip);
3346  if( root == NULL )
3347  {
3348  SCIP_CALL( SCIPcreateRootDialog(scip, &root) );
3349  }
3350 
3351  /* change */
3352  if( !SCIPdialogHasEntry(root, "change") )
3353  {
3354  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
3355  NULL,
3356  SCIPdialogExecMenu, NULL, NULL,
3357  "change", "change the problem", TRUE, NULL) );
3358  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
3359  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
3360  }
3361  if( SCIPdialogFindEntry(root, "change", &submenu) != 1 )
3362  {
3363  SCIPerrorMessage("change sub menu not found\n");
3364  return SCIP_PLUGINNOTFOUND;
3365  }
3366 
3367  /* change add */
3368  if( !SCIPdialogHasEntry(submenu, "add") )
3369  {
3370  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3371  NULL,
3372  SCIPdialogExecChangeAddCons, NULL, NULL,
3373  "add", "add constraint", FALSE, NULL) );
3374  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3375  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3376  }
3377 
3378  /* change bounds */
3379  if( !SCIPdialogHasEntry(submenu, "bounds") )
3380  {
3381  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3382  NULL,
3383  SCIPdialogExecChangeBounds, NULL, NULL,
3384  "bounds", "change bounds of a variable", FALSE, NULL) );
3385  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3386  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3387  }
3388 
3389  /* free transformed problem */
3390  if( !SCIPdialogHasEntry(submenu, "freetransproblem") )
3391  {
3392  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3393  NULL,
3394  SCIPdialogExecChangeFreetransproblem, NULL, NULL,
3395  "freetransproblem", "free transformed problem", FALSE, NULL) );
3396  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3397  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3398  }
3399 
3400  /* change objective sense */
3401  if( !SCIPdialogHasEntry(submenu, "objsense") )
3402  {
3403  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3404  NULL,
3405  SCIPdialogExecChangeObjSense, NULL, NULL,
3406  "objsense", "change objective sense", FALSE, NULL) );
3407  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3408  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3409  }
3410 
3411  /* checksol */
3412  if( !SCIPdialogHasEntry(root, "checksol") )
3413  {
3414  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3415  NULL,
3416  SCIPdialogExecChecksol, NULL, NULL,
3417  "checksol", "double checks best solution w.r.t. original problem", FALSE, NULL) );
3418  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
3419  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3420  }
3421 
3422  /* display */
3423  if( !SCIPdialogHasEntry(root, "display") )
3424  {
3425  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
3426  NULL,
3427  SCIPdialogExecMenu, NULL, NULL,
3428  "display", "display information", TRUE, NULL) );
3429  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
3430  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
3431  }
3432  if( SCIPdialogFindEntry(root, "display", &submenu) != 1 )
3433  {
3434  SCIPerrorMessage("display sub menu not found\n");
3435  return SCIP_PLUGINNOTFOUND;
3436  }
3437 
3438  /* display branching */
3439  if( !SCIPdialogHasEntry(submenu, "branching") )
3440  {
3441  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3442  NULL,
3443  SCIPdialogExecDisplayBranching, NULL, NULL,
3444  "branching", "display branching rules", FALSE, NULL) );
3445  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3446  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3447  }
3448 
3449  /* display compressions */
3450  if( !SCIPdialogHasEntry(submenu, "compression") )
3451  {
3452  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3453  NULL,
3454  SCIPdialogExecDisplayCompression, NULL, NULL,
3455  "compression", "display compression techniques", FALSE, NULL) );
3456  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3457  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3458  }
3459 
3460  /* display conflict */
3461  if( !SCIPdialogHasEntry(submenu, "conflict") )
3462  {
3463  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3464  NULL,
3465  SCIPdialogExecDisplayConflict, NULL, NULL,
3466  "conflict", "display conflict handlers", FALSE, NULL) );
3467  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3468  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3469  }
3470 
3471  /* display conshdlrs */
3472  if( !SCIPdialogHasEntry(submenu, "conshdlrs") )
3473  {
3474  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3475  NULL,
3476  SCIPdialogExecDisplayConshdlrs, NULL, NULL,
3477  "conshdlrs", "display constraint handlers", FALSE, NULL) );
3478  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3479  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3480  }
3481 
3482  /* display displaycols */
3483  if( !SCIPdialogHasEntry(submenu, "displaycols") )
3484  {
3485  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3486  NULL,
3487  SCIPdialogExecDisplayDisplaycols, NULL, NULL,
3488  "displaycols", "display display columns", FALSE, NULL) );
3489  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3490  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3491  }
3492 
3493  /* display heuristics */
3494  if( !SCIPdialogHasEntry(submenu, "heuristics") )
3495  {
3496  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3497  NULL,
3498  SCIPdialogExecDisplayHeuristics, NULL, NULL,
3499  "heuristics", "display primal heuristics", FALSE, NULL) );
3500  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3501  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3502  }
3503 
3504  /* display memory */
3505  if( !SCIPdialogHasEntry(submenu, "memory") )
3506  {
3507  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3508  NULL,
3509  SCIPdialogExecDisplayMemory, NULL, NULL,
3510  "memory", "display memory diagnostics", FALSE, NULL) );
3511  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3512  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3513  }
3514 
3515  /* display nlpi */
3516  if( !SCIPdialogHasEntry(submenu, "nlpis") )
3517  {
3518  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3519  NULL,
3520  SCIPdialogExecDisplayNlpi, NULL, NULL,
3521  "nlpis", "display NLP solver interfaces", FALSE, NULL) );
3522  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3523  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3524  }
3525 
3526  /* display nodeselectors */
3527  if( !SCIPdialogHasEntry(submenu, "nodeselectors") )
3528  {
3529  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3530  NULL,
3531  SCIPdialogExecDisplayNodeselectors, NULL, NULL,
3532  "nodeselectors", "display node selectors", FALSE, NULL) );
3533  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3534  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3535  }
3536 
3537  /* display parameters */
3538  if( !SCIPdialogHasEntry(submenu, "parameters") )
3539  {
3540  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3541  NULL,
3542  SCIPdialogExecDisplayParameters, NULL, NULL,
3543  "parameters", "display non-default parameter settings", FALSE, NULL) );
3544  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3545  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3546  }
3547 
3548  /* display presolvers */
3549  if( !SCIPdialogHasEntry(submenu, "presolvers") )
3550  {
3551  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3552  NULL,
3553  SCIPdialogExecDisplayPresolvers, NULL, NULL,
3554  "presolvers", "display presolvers", FALSE, NULL) );
3555  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3556  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3557  }
3558 
3559  /* display pricers */
3560  if( !SCIPdialogHasEntry(submenu, "pricers") )
3561  {
3562  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3563  NULL,
3564  SCIPdialogExecDisplayPricers, NULL, NULL,
3565  "pricers", "display pricers", FALSE, NULL) );
3566  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3567  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3568  }
3569 
3570  /* display problem */
3571  if( !SCIPdialogHasEntry(submenu, "problem") )
3572  {
3573  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3574  NULL,
3575  SCIPdialogExecDisplayProblem, NULL, NULL,
3576  "problem", "display original problem", FALSE, NULL) );
3577  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3578  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3579  }
3580 
3581  /* display propagators */
3582  if( !SCIPdialogHasEntry(submenu, "propagators") )
3583  {
3584  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3585  NULL,
3586  SCIPdialogExecDisplayPropagators, NULL, NULL,
3587  "propagators", "display propagators", FALSE, NULL) );
3588  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3589  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3590  }
3591 
3592  /* display readers */
3593  if( !SCIPdialogHasEntry(submenu, "readers") )
3594  {
3595  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3596  NULL,
3597  SCIPdialogExecDisplayReaders, NULL, NULL,
3598  "readers", "display file readers", FALSE, NULL) );
3599  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3600  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3601  }
3602 
3603  /* display relaxing */
3604  if( !SCIPdialogHasEntry(submenu, "relaxators") )
3605  {
3606  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3607  NULL,
3608  SCIPdialogExecDisplayRelaxators, NULL, NULL,
3609  "relaxators", "display relaxators", FALSE, NULL) );
3610  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3611  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3612  }
3613 
3614  /* display separators */
3615  if( !SCIPdialogHasEntry(submenu, "separators") )
3616  {
3617  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3618  NULL,
3619  SCIPdialogExecDisplaySeparators, NULL, NULL,
3620  "separators", "display cut separators", FALSE, NULL) );
3621  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3622  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3623  }
3624 
3625  /* display solution */
3626  if( !SCIPdialogHasEntry(submenu, "solution") )
3627  {
3628  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3629  NULL,
3630  SCIPdialogExecDisplaySolution, NULL, NULL,
3631  "solution", "display best primal solution", FALSE, NULL) );
3632  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3633  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3634  }
3635 
3636  /* display finite solution */
3637  if( !SCIPdialogHasEntry(submenu, "finitesolution") )
3638  {
3639  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3640  NULL,
3641  SCIPdialogExecDisplayFiniteSolution, NULL, NULL,
3642  "finitesolution", "display best primal solution (try to make solution values finite, first)", FALSE, NULL) );
3643  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3644  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3645  }
3646 
3647  /* display solution */
3648  if( !SCIPdialogHasEntry(submenu, "dualsolution") )
3649  {
3650  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3651  NULL,
3652  SCIPdialogExecDisplayDualSolution, NULL, NULL,
3653  "dualsolution", "display dual solution vector (LP only, without presolving)", FALSE, NULL) );
3654  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3655  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3656  }
3657 
3658  /* display solution */
3659  if( !SCIPdialogHasEntry(submenu, "sols") )
3660  {
3661  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3662  NULL,
3663  SCIPdialogExecDisplaySolutionPool, NULL, NULL,
3664  "sols", "display solutions from pool", FALSE, NULL) );
3665  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3666  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3667  }
3668 
3669  /* display statistics */
3670  if( !SCIPdialogHasEntry(submenu, "statistics") )
3671  {
3672  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3673  NULL,
3674  SCIPdialogExecDisplayStatistics, NULL, NULL,
3675  "statistics", "display problem and optimization statistics", FALSE, NULL) );
3676  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3677  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3678  }
3679 
3680  /* display reoptimization statistics */
3681  if( !SCIPdialogHasEntry(submenu, "reoptstatistics") )
3682  {
3683  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3684  NULL,
3685  SCIPdialogExecDisplayReoptStatistics, NULL, NULL,
3686  "reoptstatistics", "display reoptimitazion statistics", FALSE, NULL) );
3687  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3688  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3689  }
3690 
3691  /* display transproblem */
3692  if( !SCIPdialogHasEntry(submenu, "transproblem") )
3693  {
3694  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3695  NULL,
3696  SCIPdialogExecDisplayTransproblem, NULL, NULL,
3697  "transproblem", "display current node transformed problem", FALSE, NULL) );
3698  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3699  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3700  }
3701 
3702  /* display value */
3703  if( !SCIPdialogHasEntry(submenu, "value") )
3704  {
3705  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3706  NULL,
3707  SCIPdialogExecDisplayValue, NULL, NULL,
3708  "value", "display value of single variable in best primal solution", FALSE, NULL) );
3709  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3710  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3711  }
3712 
3713  /* display varbranchstatistics */
3714  if( !SCIPdialogHasEntry(submenu, "varbranchstatistics") )
3715  {
3716  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3717  NULL,
3718  SCIPdialogExecDisplayVarbranchstatistics, NULL, NULL,
3719  "varbranchstatistics", "display statistics for branching on variables", FALSE, NULL) );
3720  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3721  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3722  }
3723 
3724  /* display varbranchstatistics */
3725  if( !SCIPdialogHasEntry(submenu, "lpsolquality") )
3726  {
3727  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3728  NULL,
3729  SCIPdialogExecDisplayLPSolutionQuality, NULL, NULL,
3730  "lpsolquality", "display quality of the current LP solution, if available", FALSE, NULL) );
3731  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3732  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3733  }
3734 
3735  /* display transsolution */
3736  if( !SCIPdialogHasEntry(submenu, "transsolution") )
3737  {
3738  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3739  NULL,
3740  SCIPdialogExecDisplayTranssolution, NULL, NULL,
3741  "transsolution", "display best primal solution in transformed variables", FALSE, NULL) );
3742  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3743  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3744  }
3745 
3746  /* free */
3747  if( !SCIPdialogHasEntry(root, "free") )
3748  {
3749  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3750  NULL,
3751  SCIPdialogExecFree, NULL, NULL,
3752  "free", "free current problem from memory", FALSE, NULL) );
3753  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
3754  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3755  }
3756 
3757  /* help */
3758  if( !SCIPdialogHasEntry(root, "help") )
3759  {
3760  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3761  NULL,
3762  SCIPdialogExecHelp, NULL, NULL,
3763  "help", "display this help", FALSE, NULL) );
3764  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
3765  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3766  }
3767 
3768  /* newstart */
3769  if( !SCIPdialogHasEntry(root, "newstart") )
3770  {
3771  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3772  NULL,
3773  SCIPdialogExecNewstart, NULL, NULL,
3774  "newstart", "reset branch and bound tree to start again from root", FALSE, NULL) );
3775  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
3776  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3777  }
3778 
3779 #ifndef NDEBUG
3780  /* transform problem (for debugging) */
3781  if( !SCIPdialogHasEntry(root, "transform") )
3782  {
3783  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3784  NULL,
3785  SCIPdialogExecTransform, NULL, NULL,
3786  "transform", "transforms problem from original state", FALSE, NULL) );
3787  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
3788  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3789  }
3790 #endif
3791 
3792  /* optimize */
3793  if( !SCIPdialogHasEntry(root, "optimize") )
3794  {
3795  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3796  NULL,
3797  SCIPdialogExecOptimize, NULL, NULL,
3798  "optimize", "solve the problem", FALSE, NULL) );
3799  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
3800  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3801  }
3802 
3803  /* optimize */
3804  if( !SCIPdialogHasEntry(root, "concurrentopt") )
3805  {
3806  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3807  NULL,
3808  SCIPdialogExecConcurrentOpt, NULL, NULL,
3809  "concurrentopt", "solve the problem using concurrent solvers", FALSE, NULL) );
3810  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
3811  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3812  }
3813 
3814  /* presolve */
3815  if( !SCIPdialogHasEntry(root, "presolve") )
3816  {
3817  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3818  NULL,
3819  SCIPdialogExecPresolve, NULL, NULL,
3820  "presolve", "solve the problem, but stop after presolving stage", FALSE, NULL) );
3821  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
3822  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3823  }
3824 
3825  /* quit */
3826  if( !SCIPdialogHasEntry(root, "quit") )
3827  {
3828  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3829  NULL,
3830  SCIPdialogExecQuit, NULL, NULL,
3831  "quit", "leave SCIP", FALSE, NULL) );
3832  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
3833  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3834  }
3835 
3836  /* read */
3837  if( !SCIPdialogHasEntry(root, "read") )
3838  {
3839  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3840  NULL,
3841  SCIPdialogExecRead, NULL, NULL,
3842  "read", "read a problem", FALSE, NULL) );
3843  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
3844  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3845  }
3846 
3847  /* set */
3849 
3850  /* fix */
3852 
3853  /* write */
3854  if( !SCIPdialogHasEntry(root, "write") )
3855  {
3856  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
3857  NULL,
3858  SCIPdialogExecMenu, NULL, NULL,
3859  "write", "write information to file", TRUE, NULL) );
3860  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
3861  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
3862  }
3863  if( SCIPdialogFindEntry(root, "write", &submenu) != 1 )
3864  {
3865  SCIPerrorMessage("write sub menu not found\n");
3866  return SCIP_PLUGINNOTFOUND;
3867  }
3868 
3869  /* write LP */
3870  if( !SCIPdialogHasEntry(submenu, "lp") )
3871  {
3872  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3873  NULL,
3874  SCIPdialogExecWriteLp, NULL, NULL,
3875  "lp", "write current node LP relaxation in LP format to file", FALSE, NULL) );
3876  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3877  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3878  }
3879 
3880  /* write MIP */
3881  if( !SCIPdialogHasEntry(submenu, "mip") )
3882  {
3883  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3884  NULL,
3885  SCIPdialogExecWriteMip, NULL, NULL,
3886  "mip", "write current node MIP relaxation in LP format to file", FALSE, NULL) );
3887  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3888  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3889  }
3890 
3891  /* write NLP */
3892  if( !SCIPdialogHasEntry(submenu, "nlp") )
3893  {
3894  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3895  NULL,
3896  SCIPdialogExecWriteNlp, NULL, NULL,
3897  "nlp", "write current node NLP relaxation to file", FALSE, NULL) );
3898  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3899  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3900  }
3901 
3902  /* write problem */
3903  if( !SCIPdialogHasEntry(submenu, "problem") )
3904  {
3905  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3906  NULL,
3907  SCIPdialogExecWriteProblem, NULL, NULL,
3908  "problem",
3909  "write original problem to file (format is given by file extension, e.g., orig.{lp,rlp,cip,mps})",
3910  FALSE, NULL) );
3911  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3912  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3913  }
3914 
3915  /* write generic problem */
3916  if( !SCIPdialogHasEntry(submenu, "genproblem") )
3917  {
3918  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3919  NULL,
3920  SCIPdialogExecWriteGenProblem, NULL, NULL,
3921  "genproblem",
3922  "write original problem with generic names to file (format is given by file extension, e.g., orig.{lp,rlp,cip,mps})",
3923  FALSE, NULL) );
3924  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3925  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3926  }
3927 
3928  /* write solution */
3929  if( !SCIPdialogHasEntry(submenu, "solution") )
3930  {
3931  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3932  NULL,
3933  SCIPdialogExecWriteSolution, NULL, NULL,
3934  "solution", "write best primal solution to file", FALSE, NULL) );
3935  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3936  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3937  }
3938 
3939  /* write finite solution */
3940  if( !SCIPdialogHasEntry(submenu, "finitesolution") )
3941  {
3942  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3943  NULL,
3944  SCIPdialogExecWriteFiniteSolution, NULL, NULL,
3945  "finitesolution", "write best primal solution to file (try to make solution values finite, first)", FALSE, NULL) );
3946  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3947  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3948  }
3949 
3950  /* write mip start */
3951  if( !SCIPdialogHasEntry(submenu, "mipstart") )
3952  {
3953  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3954  NULL,
3955  SCIPdialogExecWriteMIPStart, NULL, NULL,
3956  "mipstart", "write mip start to file", FALSE, NULL) );
3957  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3958  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3959  }
3960 
3961  /* write statistics */
3962  if( !SCIPdialogHasEntry(submenu, "statistics") )
3963  {
3964  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3965  NULL,
3966  SCIPdialogExecWriteStatistics, NULL, NULL,
3967  "statistics", "write statistics to file", FALSE, NULL) );
3968  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3969  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3970  }
3971 
3972  /* write transproblem */
3973  if( !SCIPdialogHasEntry(submenu, "transproblem") )
3974  {
3975  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3976  NULL,
3977  SCIPdialogExecWriteTransproblem, NULL, NULL,
3978  "transproblem",
3979  "write current node transformed problem to file (format is given by file extension, e.g., trans.{lp,rlp,cip,mps})",
3980  FALSE, NULL) );
3981  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3982  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3983  }
3984 
3985  /* write transproblem with generic names */
3986  if( !SCIPdialogHasEntry(submenu, "gentransproblem") )
3987  {
3988  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3989  NULL,
3990  SCIPdialogExecWriteGenTransproblem, NULL, NULL,
3991  "gentransproblem",
3992  "write current node transformed problem with generic names to file (format is given by file extension, e.g., trans.{lp,rlp,cip,mps})",
3993  FALSE, NULL) );
3994  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3995  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3996  }
3997 
3998  /* write cliquegraph */
3999  if( !SCIPdialogHasEntry(submenu, "cliquegraph") )
4000  {
4001  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4002  NULL,
4003  SCIPdialogExecCliquegraph, NULL, NULL,
4004  "cliquegraph",
4005  "write graph of cliques and implications of binary variables to GML file (better call after presolving)",
4006  FALSE, NULL) );
4007  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4008  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4009  }
4010 
4011  /* write command line history */
4012  if( !SCIPdialogHasEntry(submenu, "history") )
4013  {
4014  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4015  NULL,
4016  SCIPdialogExecWriteCommandHistory, NULL, NULL,
4017  "history",
4018  "writes command line history to a file (only works if SCIP was compiled with 'readline')",
4019  FALSE, NULL) );
4020  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4021  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4022  }
4023 
4024  return SCIP_OKAY;
4025 }
4026 
4027 /** if a '/' occurs in the parameter's name, adds a sub menu dialog to the given menu and inserts the parameter dialog
4028  * recursively in the sub menu; if no '/' occurs in the name, adds a parameter change dialog into the given dialog menu
4029  */
4030 static
4032  SCIP* scip, /**< SCIP data structure */
4033  SCIP_DIALOG* menu, /**< dialog menu to insert the parameter into */
4034  SCIP_PARAM* param, /**< parameter to add a dialog for */
4035  char* paramname /**< parameter name to parse */
4036  )
4037 {
4038  char* slash;
4039  char* dirname;
4040 
4041  assert(paramname != NULL);
4042 
4043  /* check for a '/' */
4044  slash = strchr(paramname, '/');
4045 
4046  if( slash == NULL )
4047  {
4048  /* check, if the corresponding dialog already exists */
4049  if( !SCIPdialogHasEntry(menu, paramname) )
4050  {
4051  SCIP_DIALOG* paramdialog;
4052 
4053  if( SCIPparamIsAdvanced(param) )
4054  {
4055  SCIP_DIALOG* advmenu;
4056 
4057  if( !SCIPdialogHasEntry(menu, "advanced") )
4058  {
4059  /* if not yet existing, create an advanced sub menu */
4060  char desc[SCIP_MAXSTRLEN];
4061 
4062  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "advanced parameters");
4063  SCIP_CALL( SCIPincludeDialog(scip, &advmenu,
4064  NULL,
4065  SCIPdialogExecMenu, NULL, NULL, "advanced", desc, TRUE, NULL) );
4066  SCIP_CALL( SCIPaddDialogEntry(scip, menu, advmenu) );
4067  SCIP_CALL( SCIPreleaseDialog(scip, &advmenu) );
4068  }
4069 
4070  /* find the corresponding sub menu */
4071  (void)SCIPdialogFindEntry(menu, "advanced", &advmenu);
4072  if( advmenu == NULL )
4073  {
4074  SCIPerrorMessage("dialog sub menu not found\n");
4075  return SCIP_PLUGINNOTFOUND;
4076  }
4077 
4078  if( !SCIPdialogHasEntry(advmenu, paramname) )
4079  {
4080  /* create a parameter change dialog */
4081  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4082  NULL,
4083  SCIPdialogExecSetParam, SCIPdialogDescSetParam, NULL,
4084  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4085  SCIP_CALL( SCIPaddDialogEntry(scip, advmenu, paramdialog) );
4086  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4087  }
4088  }
4089  else
4090  {
4091  /* create a parameter change dialog */
4092  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4093  NULL,
4094  SCIPdialogExecSetParam, SCIPdialogDescSetParam, NULL,
4095  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4096  SCIP_CALL( SCIPaddDialogEntry(scip, menu, paramdialog) );
4097  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4098  }
4099  }
4100  }
4101  else
4102  {
4103  SCIP_DIALOG* submenu;
4104 
4105  /* split the parameter name into dirname and parameter name */
4106  dirname = paramname;
4107  paramname = slash+1;
4108  *slash = '\0';
4109 
4110  /* if not yet existing, create a corresponding sub menu */
4111  if( !SCIPdialogHasEntry(menu, dirname) )
4112  {
4113  char desc[SCIP_MAXSTRLEN];
4114 
4115  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "parameters for <%s>", dirname);
4116  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4117  NULL,
4118  SCIPdialogExecMenu, NULL, NULL, dirname, desc, TRUE, NULL) );
4119  SCIP_CALL( SCIPaddDialogEntry(scip, menu, submenu) );
4120  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4121  }
4122 
4123  /* find the corresponding sub menu */
4124  (void)SCIPdialogFindEntry(menu, dirname, &submenu);
4125  if( submenu == NULL )
4126  {
4127  SCIPerrorMessage("dialog sub menu not found\n");
4128  return SCIP_PLUGINNOTFOUND;
4129  }
4130 
4131  /* recursively call add parameter method */
4132  SCIP_CALL( addSetParamDialog(scip, submenu, param, paramname) );
4133  }
4134 
4135  return SCIP_OKAY;
4136 }
4137 
4138 /** if a '/' occurs in the parameter's name, adds a sub menu dialog to the given menu and inserts the parameter dialog
4139  * recursively in the sub menu; if no '/' occurs in the name, adds a fix parameter dialog into the given dialog menu
4140  */
4141 static
4143  SCIP* scip, /**< SCIP data structure */
4144  SCIP_DIALOG* menu, /**< dialog menu to insert the parameter into */
4145  SCIP_PARAM* param, /**< parameter to add a dialog for */
4146  char* paramname /**< parameter name to parse */
4147  )
4148 {
4149  char* slash;
4150  char* dirname;
4151 
4152  assert(paramname != NULL);
4153 
4154  /* check for a '/' */
4155  slash = strchr(paramname, '/');
4156 
4157  if( slash == NULL )
4158  {
4159  /* check, if the corresponding dialog already exists */
4160  if( !SCIPdialogHasEntry(menu, paramname) )
4161  {
4162  SCIP_DIALOG* paramdialog;
4163 
4164  if( SCIPparamIsAdvanced(param) )
4165  {
4166  SCIP_DIALOG* advmenu;
4167 
4168  if( !SCIPdialogHasEntry(menu, "advanced") )
4169  {
4170  /* if not yet existing, create an advanced sub menu */
4171  char desc[SCIP_MAXSTRLEN];
4172 
4173  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "advanced parameters");
4174  SCIP_CALL( SCIPincludeDialog(scip, &advmenu,
4175  NULL,
4176  SCIPdialogExecMenu, NULL, NULL, "advanced", desc, TRUE, NULL) );
4177  SCIP_CALL( SCIPaddDialogEntry(scip, menu, advmenu) );
4178  SCIP_CALL( SCIPreleaseDialog(scip, &advmenu) );
4179  }
4180 
4181  /* find the corresponding sub menu */
4182  (void)SCIPdialogFindEntry(menu, "advanced", &advmenu);
4183  if( advmenu == NULL )
4184  {
4185  SCIPerrorMessage("dialog sub menu not found\n");
4186  return SCIP_PLUGINNOTFOUND;
4187  }
4188 
4189  if( !SCIPdialogHasEntry(advmenu, paramname) )
4190  {
4191  /* create a fix parameter dialog */
4192  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4193  NULL,
4194  SCIPdialogExecFixParam, SCIPdialogDescFixParam, NULL,
4195  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4196  SCIP_CALL( SCIPaddDialogEntry(scip, advmenu, paramdialog) );
4197  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4198  }
4199  }
4200  else
4201  {
4202  /* create a fix parameter dialog */
4203  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4204  NULL,
4205  SCIPdialogExecFixParam, SCIPdialogDescFixParam, NULL,
4206  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4207  SCIP_CALL( SCIPaddDialogEntry(scip, menu, paramdialog) );
4208  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4209  }
4210  }
4211  }
4212  else
4213  {
4214  SCIP_DIALOG* submenu;
4215 
4216  /* split the parameter name into dirname and parameter name */
4217  dirname = paramname;
4218  paramname = slash+1;
4219  *slash = '\0';
4220 
4221  /* if not yet existing, create a corresponding sub menu */
4222  if( !SCIPdialogHasEntry(menu, dirname) )
4223  {
4224  char desc[SCIP_MAXSTRLEN];
4225 
4226  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "parameters for <%s>", dirname);
4227  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4228  NULL,
4229  SCIPdialogExecMenu, NULL, NULL, dirname, desc, TRUE, NULL) );
4230  SCIP_CALL( SCIPaddDialogEntry(scip, menu, submenu) );
4231  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4232  }
4233 
4234  /* find the corresponding sub menu */
4235  (void)SCIPdialogFindEntry(menu, dirname, &submenu);
4236  if( submenu == NULL )
4237  {
4238  SCIPerrorMessage("dialog sub menu not found\n");
4239  return SCIP_PLUGINNOTFOUND;
4240  }
4241 
4242  /* recursively call add parameter method */
4243  SCIP_CALL( addFixParamDialog(scip, submenu, param, paramname) );
4244  }
4245 
4246  return SCIP_OKAY;
4247 }
4248 
4249 /** create a "emphasis" sub menu */
4250 static
4252  SCIP* scip, /**< SCIP data structure */
4253  SCIP_DIALOG* root, /**< the menu to add the empty sub menu */
4254  SCIP_DIALOG** submenu /**< pointer to store the created emphasis sub menu */
4255  )
4256 {
4257  if( !SCIPdialogHasEntry(root, "emphasis") )
4258  {
4259  SCIP_CALL( SCIPincludeDialog(scip, submenu,
4260  NULL, SCIPdialogExecMenu, NULL, NULL,
4261  "emphasis", "predefined parameter settings", TRUE, NULL) );
4262  SCIP_CALL( SCIPaddDialogEntry(scip, root, *submenu) );
4263  SCIP_CALL( SCIPreleaseDialog(scip, submenu) );
4264  }
4265  else if( SCIPdialogFindEntry(root, "emphasis", submenu) != 1 )
4266  {
4267  SCIPerrorMessage("emphasis sub menu not found\n");
4268  return SCIP_PLUGINNOTFOUND;
4269  }
4270 
4271  assert(*submenu != NULL);
4272 
4273  return SCIP_OKAY;
4274 }
4275 
4276 
4277 /** includes or updates the "set" menu for each available parameter setting */
4279  SCIP* scip /**< SCIP data structure */
4280  )
4281 {
4282  SCIP_DIALOG* root;
4283  SCIP_DIALOG* setmenu;
4284  SCIP_DIALOG* emphasismenu;
4285  SCIP_DIALOG* submenu;
4286  SCIP_DIALOG* dialog;
4287  SCIP_PARAM** params;
4288  char* paramname;
4289  int nparams;
4290  int i;
4291 
4292  SCIP_BRANCHRULE** branchrules;
4293  SCIP_CONFLICTHDLR** conflicthdlrs;
4294  SCIP_CONSHDLR** conshdlrs;
4295  SCIP_DISP** disps;
4296  SCIP_HEUR** heurs;
4297  SCIP_NLPI** nlpis;
4298  SCIP_NODESEL** nodesels;
4299  SCIP_PRESOL** presols;
4300  SCIP_PRICER** pricers;
4301  SCIP_READER** readers;
4302  SCIP_SEPA** sepas;
4303  int nbranchrules;
4304  int nconflicthdlrs;
4305  int nconshdlrs;
4306  int ndisps;
4307  int nheurs;
4308  int nnlpis;
4309  int nnodesels;
4310  int npresols;
4311  int npricers;
4312  int nreaders;
4313  int nsepas;
4314 
4315  /* get root dialog */
4316  root = SCIPgetRootDialog(scip);
4317  if( root == NULL )
4318  {
4319  SCIPerrorMessage("root dialog not found\n");
4320  return SCIP_PLUGINNOTFOUND;
4321  }
4322 
4323  /* find (or create) the "set" menu of the root dialog */
4324  if( !SCIPdialogHasEntry(root, "set") )
4325  {
4326  SCIP_CALL( SCIPincludeDialog(scip, &setmenu,
4327  NULL, SCIPdialogExecMenu, NULL, NULL,
4328  "set", "load/save/change parameters", TRUE, NULL) );
4329  SCIP_CALL( SCIPaddDialogEntry(scip, root, setmenu) );
4330  SCIP_CALL( SCIPreleaseDialog(scip, &setmenu) );
4331  }
4332  if( SCIPdialogFindEntry(root, "set", &setmenu) != 1 )
4333  {
4334  SCIPerrorMessage("set sub menu not found\n");
4335  return SCIP_PLUGINNOTFOUND;
4336  }
4337 
4338  /* set default */
4339  if( !SCIPdialogHasEntry(setmenu, "default") )
4340  {
4341  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4342  NULL,
4343  SCIPdialogExecSetDefault, NULL, NULL,
4344  "default", "reset parameter settings to their default values", FALSE, NULL) );
4345  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, dialog) );
4346  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4347  }
4348 
4349  /* set load */
4350  if( !SCIPdialogHasEntry(setmenu, "load") )
4351  {
4352  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4353  NULL,
4354  SCIPdialogExecSetLoad, NULL, NULL,
4355  "load", "load parameter settings from a file", FALSE, NULL) );
4356  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, dialog) );
4357  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4358  }
4359 
4360  /* set save */
4361  if( !SCIPdialogHasEntry(setmenu, "save") )
4362  {
4363  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4364  NULL,
4365  SCIPdialogExecSetSave, NULL, NULL,
4366  "save", "save parameter settings to a file", FALSE, NULL) );
4367  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, dialog) );
4368  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4369  }
4370 
4371  /* set diffsave */
4372  if( !SCIPdialogHasEntry(setmenu, "diffsave") )
4373  {
4374  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4375  NULL,
4376  SCIPdialogExecSetDiffsave, NULL, NULL,
4377  "diffsave", "save non-default parameter settings to a file", FALSE, NULL) );
4378  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, dialog) );
4379  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4380  }
4381 
4382  /* set branching */
4383  if( !SCIPdialogHasEntry(setmenu, "branching") )
4384  {
4385  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4386  NULL,
4387  SCIPdialogExecMenu, NULL, NULL,
4388  "branching", "change parameters for branching rules", TRUE, NULL) );
4389  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4390  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4391  }
4392  if( SCIPdialogFindEntry(setmenu, "branching", &submenu) != 1 )
4393  {
4394  SCIPerrorMessage("branching sub menu not found\n");
4395  return SCIP_PLUGINNOTFOUND;
4396  }
4397 
4398  nbranchrules = SCIPgetNBranchrules(scip);
4399  branchrules = SCIPgetBranchrules(scip);
4400 
4401  for( i = 0; i < nbranchrules; ++i )
4402  {
4403  if( !SCIPdialogHasEntry(submenu, SCIPbranchruleGetName(branchrules[i])) )
4404  {
4405  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4406  NULL,
4407  SCIPdialogExecMenu, NULL, NULL,
4408  SCIPbranchruleGetName(branchrules[i]), SCIPbranchruleGetDesc(branchrules[i]), TRUE, NULL) );
4409  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4410  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4411  }
4412  }
4413 
4414  /* set branching priority */
4415  if( !SCIPdialogHasEntry(submenu, "priority") )
4416  {
4417  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4418  NULL,
4419  SCIPdialogExecSetBranchingPriority, NULL, NULL,
4420  "priority", "change branching priority of a single variable", FALSE, NULL) );
4421  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4422  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4423  }
4424 
4425  /* set branching direction */
4426  if( !SCIPdialogHasEntry(submenu, "direction") )
4427  {
4428  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4429  NULL,
4430  SCIPdialogExecSetBranchingDirection, NULL, NULL,
4431  "direction", "change preferred branching direction of a single variable (-1:down, 0:auto, +1:up)",
4432  FALSE, NULL) );
4433  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4434  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4435  }
4436 
4437  /* set conflict */
4438  if( !SCIPdialogHasEntry(setmenu, "conflict") )
4439  {
4440  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4441  NULL,
4442  SCIPdialogExecMenu, NULL, NULL,
4443  "conflict", "change parameters for conflict handlers", TRUE, NULL) );
4444  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4445  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4446  }
4447  if( SCIPdialogFindEntry(setmenu, "conflict", &submenu) != 1 )
4448  {
4449  SCIPerrorMessage("conflict sub menu not found\n");
4450  return SCIP_PLUGINNOTFOUND;
4451  }
4452 
4453  nconflicthdlrs = SCIPgetNConflicthdlrs(scip);
4454  conflicthdlrs = SCIPgetConflicthdlrs(scip);
4455 
4456  for( i = 0; i < nconflicthdlrs; ++i )
4457  {
4458  if( !SCIPdialogHasEntry(submenu, SCIPconflicthdlrGetName(conflicthdlrs[i])) )
4459  {
4460  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4461  NULL,
4462  SCIPdialogExecMenu, NULL, NULL,
4463  SCIPconflicthdlrGetName(conflicthdlrs[i]), SCIPconflicthdlrGetDesc(conflicthdlrs[i]), TRUE, NULL) );
4464  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4465  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4466  }
4467  }
4468 
4469  /* set constraints */
4470  if( !SCIPdialogHasEntry(setmenu, "constraints") )
4471  {
4472  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4473  NULL,
4474  SCIPdialogExecMenu, NULL, NULL,
4475  "constraints", "change parameters for constraint handlers", TRUE, NULL) );
4476  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4477  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4478  }
4479  if( SCIPdialogFindEntry(setmenu, "constraints", &submenu) != 1 )
4480  {
4481  SCIPerrorMessage("constraints sub menu not found\n");
4482  return SCIP_PLUGINNOTFOUND;
4483  }
4484 
4485  nconshdlrs = SCIPgetNConshdlrs(scip);
4486  conshdlrs = SCIPgetConshdlrs(scip);
4487 
4488  for( i = 0; i < nconshdlrs; ++i )
4489  {
4490  if( !SCIPdialogHasEntry(submenu, SCIPconshdlrGetName(conshdlrs[i])) )
4491  {
4492  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4493  NULL,
4494  SCIPdialogExecMenu, NULL, NULL,
4495  SCIPconshdlrGetName(conshdlrs[i]), SCIPconshdlrGetDesc(conshdlrs[i]), TRUE, NULL) );
4496  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4497  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4498  }
4499  }
4500 
4501  /* set display */
4502  if( !SCIPdialogHasEntry(setmenu, "display") )
4503  {
4504  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4505  NULL,
4506  SCIPdialogExecMenu, NULL, NULL,
4507  "display", "change parameters for display columns", TRUE, NULL) );
4508  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4509  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4510  }
4511  if( SCIPdialogFindEntry(setmenu, "display", &submenu) != 1 )
4512  {
4513  SCIPerrorMessage("display sub menu not found\n");
4514  return SCIP_PLUGINNOTFOUND;
4515  }
4516 
4517  ndisps = SCIPgetNDisps(scip);
4518  disps = SCIPgetDisps(scip);
4519 
4520  for( i = 0; i < ndisps; ++i )
4521  {
4522  if( !SCIPdialogHasEntry(submenu, SCIPdispGetName(disps[i])) )
4523  {
4524  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4525  NULL,
4526  SCIPdialogExecMenu, NULL, NULL,
4527  SCIPdispGetName(disps[i]), SCIPdispGetDesc(disps[i]), TRUE, NULL) );
4528  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4529  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4530  }
4531  }
4532 
4533  /* set heuristics */
4534  if( !SCIPdialogHasEntry(setmenu, "heuristics") )
4535  {
4536  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4537  NULL,
4538  SCIPdialogExecMenu, NULL, NULL,
4539  "heuristics", "change parameters for primal heuristics", TRUE, NULL) );
4540  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4541  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4542  }
4543  if( SCIPdialogFindEntry(setmenu, "heuristics", &submenu) != 1 )
4544  {
4545  SCIPerrorMessage("heuristics sub menu not found\n");
4546  return SCIP_PLUGINNOTFOUND;
4547  }
4548 
4549  nheurs = SCIPgetNHeurs(scip);
4550  heurs = SCIPgetHeurs(scip);
4551 
4552  for( i = 0; i < nheurs; ++i )
4553  {
4554  if( !SCIPdialogHasEntry(submenu, SCIPheurGetName(heurs[i])) )
4555  {
4556  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4557  NULL,
4558  SCIPdialogExecMenu, NULL, NULL,
4559  SCIPheurGetName(heurs[i]), SCIPheurGetDesc(heurs[i]), TRUE, NULL) );
4560  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4561  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4562  }
4563  }
4564 
4565  /* create set heuristics emphasis */
4566  SCIP_CALL( createEmphasisSubmenu(scip, submenu, &emphasismenu) );
4567  assert(emphasismenu != NULL);
4568 
4569  /* set heuristics emphasis aggressive */
4570  if( !SCIPdialogHasEntry(emphasismenu, "aggressive") )
4571  {
4572  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4573  NULL, SCIPdialogExecSetHeuristicsAggressive, NULL, NULL,
4574  "aggressive", "sets heuristics <aggressive>", FALSE, NULL) );
4575  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
4576  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4577  }
4578 
4579  /* set heuristics emphasis default */
4580  if( !SCIPdialogHasEntry(emphasismenu, "default") )
4581  {
4582  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4583  NULL, SCIPdialogExecSetHeuristicsDefault, NULL, NULL,
4584  "default", "sets heuristics settings to <default> ", FALSE, NULL) );
4585  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
4586  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4587  }
4588 
4589  /* set heuristics emphasis fast */
4590  if( !SCIPdialogHasEntry(emphasismenu, "fast") )
4591  {
4592  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4593  NULL, SCIPdialogExecSetHeuristicsFast, NULL, NULL,
4594  "fast", "sets heuristics <fast>", FALSE, NULL) );
4595  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
4596  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4597  }
4598 
4599  /* set heuristics emphasis off */
4600  if( !SCIPdialogHasEntry(emphasismenu, "off") )
4601  {
4602  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4603  NULL, SCIPdialogExecSetHeuristicsOff, NULL, NULL,
4604  "off", "turns <off> all heuristics", FALSE, NULL) );
4605  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
4606  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4607  }
4608 
4609  /* set limits */
4610  if( !SCIPdialogHasEntry(setmenu, "limits") )
4611  {
4612  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4613  NULL,
4614  SCIPdialogExecMenu, NULL, NULL,
4615  "limits", "change parameters for time, memory, objective value, and other limits", TRUE, NULL) );
4616  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4617 
4618  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4619  NULL,
4620  SCIPdialogExecSetLimitsObjective, NULL, NULL,
4621  "objective", "set limit on objective function, such that only solutions better than this limit are accepted", FALSE, NULL) );
4622  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4623  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4624 
4625  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4626  }
4627 
4628  /* set LP */
4629  if( !SCIPdialogHasEntry(setmenu, "lp") )
4630  {
4631  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4632  NULL,
4633  SCIPdialogExecMenu, NULL, NULL,
4634  "lp", "change parameters for linear programming relaxations", TRUE, NULL) );
4635  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4636  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4637  }
4638 
4639  /* set NLP */
4640  if( !SCIPdialogHasEntry(setmenu, "nlp") )
4641  {
4642  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4643  NULL,
4644  SCIPdialogExecMenu, NULL, NULL,
4645  "nlp", "change parameters for nonlinear programming relaxations", TRUE, NULL) );
4646  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4647  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4648  }
4649 
4650  /* set memory */
4651  if( !SCIPdialogHasEntry(setmenu, "memory") )
4652  {
4653  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4654  NULL,
4655  SCIPdialogExecMenu, NULL, NULL,
4656  "memory", "change parameters for memory management", TRUE, NULL) );
4657  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4658  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4659  }
4660 
4661  /* set misc */
4662  if( !SCIPdialogHasEntry(setmenu, "misc") )
4663  {
4664  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4665  NULL,
4666  SCIPdialogExecMenu, NULL, NULL,
4667  "misc", "change parameters for miscellaneous stuff", TRUE, NULL) );
4668  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4669  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4670  }
4671 
4672  /* set nlpi */
4673  if( !SCIPdialogHasEntry(setmenu, "nlpi") )
4674  {
4675  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4676  NULL,
4677  SCIPdialogExecMenu, NULL, NULL,
4678  "nlpi", "change parameters for NLP solver interfaces", TRUE, NULL) );
4679  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4680  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4681  }
4682  if( SCIPdialogFindEntry(setmenu, "nlpi", &submenu) != 1 )
4683  {
4684  SCIPerrorMessage("nlpi sub menu not found\n");
4685  return SCIP_PLUGINNOTFOUND;
4686  }
4687 
4688  nnlpis = SCIPgetNNlpis(scip);
4689  nlpis = SCIPgetNlpis(scip);
4690 
4691  for( i = 0; i < nnlpis; ++i )
4692  {
4693  if( !SCIPdialogHasEntry(submenu, SCIPnlpiGetName(nlpis[i])) )
4694  {
4695  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4696  NULL,
4697  SCIPdialogExecMenu, NULL, NULL,
4698  SCIPnlpiGetName(nlpis[i]), SCIPnlpiGetDesc(nlpis[i]), TRUE, NULL) );
4699  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4700  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4701  }
4702  }
4703 
4704  /* set nodeselection */
4705  if( !SCIPdialogHasEntry(setmenu, "nodeselection") )
4706  {
4707  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4708  NULL,
4709  SCIPdialogExecMenu, NULL, NULL,
4710  "nodeselection", "change parameters for node selectors", TRUE, NULL) );
4711  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4712  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4713  }
4714  if( SCIPdialogFindEntry(setmenu, "nodeselection", &submenu) != 1 )
4715  {
4716  SCIPerrorMessage("nodeselection sub menu not found\n");
4717  return SCIP_PLUGINNOTFOUND;
4718  }
4719 
4720  nnodesels = SCIPgetNNodesels(scip);
4721  nodesels = SCIPgetNodesels(scip);
4722 
4723  for( i = 0; i < nnodesels; ++i )
4724  {
4725  if( !SCIPdialogHasEntry(submenu, SCIPnodeselGetName(nodesels[i])) )
4726  {
4727  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4728  NULL,
4729  SCIPdialogExecMenu, NULL, NULL,
4730  SCIPnodeselGetName(nodesels[i]), SCIPnodeselGetDesc(nodesels[i]), TRUE, NULL) );
4731  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4732  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4733  }
4734  }
4735 
4736  /* set numerics */
4737  if( !SCIPdialogHasEntry(setmenu, "numerics") )
4738  {
4739  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4740  NULL,
4741  SCIPdialogExecMenu, NULL, NULL,
4742  "numerics", "change parameters for numerical values", TRUE, NULL) );
4743  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4744  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4745  }
4746 
4747  /* set parallel */
4748  if( !SCIPdialogHasEntry(setmenu, "parallel") )
4749  {
4750  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4751  NULL,
4752  SCIPdialogExecMenu, NULL, NULL,
4753  "parallel", "change parameters for parallel implementation", TRUE, NULL) );
4754  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4755  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4756  }
4757 
4758  /* set presolving */
4759  if( !SCIPdialogHasEntry(setmenu, "presolving") )
4760  {
4761  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4762  NULL,
4763  SCIPdialogExecMenu, NULL, NULL,
4764  "presolving", "change parameters for presolving", TRUE, NULL) );
4765  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4766  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4767  }
4768  if( SCIPdialogFindEntry(setmenu, "presolving", &submenu) != 1 )
4769  {
4770  SCIPerrorMessage("presolving sub menu not found\n");
4771  return SCIP_PLUGINNOTFOUND;
4772  }
4773 
4774  npresols = SCIPgetNPresols(scip);
4775  presols = SCIPgetPresols(scip);
4776 
4777  for( i = 0; i < npresols; ++i )
4778  {
4779  if( !SCIPdialogHasEntry(submenu, SCIPpresolGetName(presols[i])) )
4780  {
4781  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4782  NULL, SCIPdialogExecMenu, NULL, NULL,
4783  SCIPpresolGetName(presols[i]), SCIPpresolGetDesc(presols[i]), TRUE, NULL) );
4784  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4785  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4786  }
4787  }
4788 
4789  /* create set presolving emphasis */
4790  SCIP_CALL( createEmphasisSubmenu(scip, submenu, &emphasismenu) );
4791  assert(emphasismenu != NULL);
4792 
4793  /* set presolving emphasis aggressive */
4794  if( !SCIPdialogHasEntry(emphasismenu, "aggressive") )
4795  {
4796  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4797  NULL, SCIPdialogExecSetPresolvingAggressive, NULL, NULL,
4798  "aggressive", "sets presolving <aggressive>", FALSE, NULL) );
4799  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
4800  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4801  }
4802 
4803  /* set presolving emphasis default */
4804  if( !SCIPdialogHasEntry(emphasismenu, "default") )
4805  {
4806  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4807  NULL, SCIPdialogExecSetPresolvingDefault, NULL, NULL,
4808  "default", "sets presolving settings to <default>", FALSE, NULL) );
4809  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
4810  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4811  }
4812 
4813  /* set presolving emphasis fast */
4814  if( !SCIPdialogHasEntry(emphasismenu, "fast") )
4815  {
4816  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4817  NULL, SCIPdialogExecSetPresolvingFast, NULL, NULL,
4818  "fast", "sets presolving <fast>", FALSE, NULL) );
4819  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
4820  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4821  }
4822 
4823  /* set presolving emphasis off */
4824  if( !SCIPdialogHasEntry(emphasismenu, "off") )
4825  {
4826  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4827  NULL, SCIPdialogExecSetPresolvingOff, NULL, NULL,
4828  "off", "turns <off> all presolving", FALSE, NULL) );
4829  SCIP_CALL( SCIPaddDialogEntry(scip, emphasismenu, dialog) );
4830  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4831  }
4832 
4833  /* set pricing */
4834  if( !SCIPdialogHasEntry(setmenu, "pricing") )
4835  {
4836  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4837  NULL,
4838  SCIPdialogExecMenu, NULL, NULL,
4839  "pricing", "change parameters for pricing variables", TRUE, NULL) );
4840  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4841  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4842  }
4843  if( SCIPdialogFindEntry(setmenu, "pricing", &submenu) != 1 )
4844  {
4845  SCIPerrorMessage("pricing sub menu not found\n");
4846  return SCIP_PLUGINNOTFOUND;
4847  }
4848 
4849  npricers = SCIPgetNPricers(scip);
4850  pricers = SCIPgetPricers(scip);
4851 
4852  for( i = 0; i < npricers; ++i )
4853  {
4854  if( !SCIPdialogHasEntry(submenu, SCIPpricerGetName(pricers[i])) )
4855  {
4856  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4857  NULL,
4858  SCIPdialogExecMenu, NULL, NULL,
4859  SCIPpricerGetName(pricers[i]), SCIPpricerGetDesc(pricers[i]), TRUE, NULL) );
4860  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4861  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4862  }
4863  }
4864 
4865  /* set propagation */
4866  if( !SCIPdialogHasEntry(setmenu, "propagating") )
4867  {
4868  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4869  NULL,
4870  SCIPdialogExecMenu, NULL, NULL,
4871  "propagating", "change parameters for constraint propagation", TRUE, NULL) );
4872  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4873  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4874  }
4875 
4876  /* set reading */
4877  if( !SCIPdialogHasEntry(setmenu, "reading") )
4878  {
4879  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4880  NULL,
4881  SCIPdialogExecMenu, NULL, NULL,
4882  "reading", "change parameters for problem file readers", TRUE, NULL) );
4883  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4884  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4885  }
4886  if( SCIPdialogFindEntry(setmenu, "reading", &submenu) != 1 )
4887  {
4888  SCIPerrorMessage("reading sub menu not found\n");
4889  return SCIP_PLUGINNOTFOUND;
4890  }
4891 
4892  nreaders = SCIPgetNReaders(scip);
4893  readers = SCIPgetReaders(scip);
4894 
4895  for( i = 0; i < nreaders; ++i )
4896  {
4897  if( !SCIPdialogHasEntry(submenu, SCIPreaderGetName(readers[i])) )
4898  {
4899  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4900  NULL,
4901  SCIPdialogExecMenu, NULL, NULL,
4902  SCIPreaderGetName(readers[i]), SCIPreaderGetDesc(readers[i]), TRUE, NULL) );
4903  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4904  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4905  }
4906  }
4907 
4908  /* set separating */
4909  if( !SCIPdialogHasEntry(setmenu, "separating") )
4910  {
4911  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4912  NULL, SCIPdialogExecMenu, NULL, NULL,
4913  "separating", "change parameters for cut separators", TRUE, NULL) );
4914  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4915  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4916  }
4917  if( SCIPdialogFindEntry(setmenu, "separating", &submenu) != 1 )
4918  {
4919  SCIPerrorMessage("separating sub menu not found\n");
4920  return SCIP_PLUGINNOTFOUND;
4921  }
4922 
4923  nsepas = SCIPgetNSepas<