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