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-2021 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  SCIP_RETCODE retcode;
2412 
2413  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2414 
2415  /* get the parameter to set */
2416  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
2417 
2418  /* depending on the parameter type, request a user input */
2419  switch( SCIPparamGetType(param) )
2420  {
2421  case SCIP_PARAMTYPE_BOOL:
2422  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %s, new value (TRUE/FALSE): ",
2423  SCIPparamGetBool(param) ? "TRUE" : "FALSE");
2424  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2425  if( endoffile )
2426  {
2427  *nextdialog = NULL;
2428  return SCIP_OKAY;
2429  }
2430  if( valuestr[0] == '\0' )
2431  return SCIP_OKAY;
2432 
2433  boolval = parseBoolValue(scip, valuestr, &error);
2434 
2435  if( error )
2436  {
2437  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for bool parameter <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
2438  valuestr, SCIPparamGetName(param));
2439  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2440  }
2441  else
2442  {
2443  assert(SCIPisBoolParamValid(scip, param, boolval));
2444 
2445  retcode = SCIPchgBoolParam(scip, param, boolval);
2446  if( retcode == SCIP_PARAMETERWRONGVAL )
2447  {
2448  SCIPdialogMessage(scip, NULL, "\nWrong value <%s> for bool parameter <%s>.\n\n",
2449  valuestr, SCIPparamGetName(param));
2450  }
2451  else
2452  {
2453  SCIP_CALL( retcode );
2454  }
2455 
2456  SCIPdialogMessage(scip, NULL, "%s = %s\n", SCIPparamGetName(param), SCIPparamGetBool(param) ? "TRUE" : "FALSE");
2457  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, boolval ? "TRUE" : "FALSE", TRUE) );
2458  }
2459 
2460  break;
2461 
2462  case SCIP_PARAMTYPE_INT:
2463  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %d, new value [%d,%d]: ",
2464  SCIPparamGetInt(param), SCIPparamGetIntMin(param), SCIPparamGetIntMax(param));
2465  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2466  if( endoffile )
2467  {
2468  *nextdialog = NULL;
2469  return SCIP_OKAY;
2470  }
2471  if( valuestr[0] == '\0' )
2472  return SCIP_OKAY;
2473 
2474  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2475 
2476  if( sscanf(valuestr, "%d", &intval) != 1 || !SCIPisIntParamValid(scip, param, intval) )
2477  {
2478  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for int parameter <%s>. Must be integral in range [%d,%d].\n\n",
2479  valuestr, SCIPparamGetName(param), SCIPparamGetIntMin(param), SCIPparamGetIntMax(param));
2480  }
2481  else
2482  {
2483  retcode = SCIPchgIntParam(scip, param, intval);
2484 
2485  if( retcode == SCIP_PARAMETERWRONGVAL )
2486  {
2487  SCIPdialogMessage(scip, NULL, "\nWrong value <%s> for int parameter <%s>.\n\n",
2488  valuestr, SCIPparamGetName(param));
2489  }
2490  else
2491  {
2492  SCIP_CALL( retcode );
2493  }
2494 
2495  SCIPdialogMessage(scip, NULL, "%s = %d\n", SCIPparamGetName(param), SCIPparamGetInt(param));
2496  }
2497 
2498  break;
2499 
2501  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %" SCIP_LONGINT_FORMAT ", new value [%" SCIP_LONGINT_FORMAT ",%" SCIP_LONGINT_FORMAT "]: ",
2503  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2504  if( endoffile )
2505  {
2506  *nextdialog = NULL;
2507  return SCIP_OKAY;
2508  }
2509  if( valuestr[0] == '\0' )
2510  return SCIP_OKAY;
2511 
2512  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2513 
2514  if( sscanf(valuestr, "%" SCIP_LONGINT_FORMAT, &longintval) != 1 || !SCIPisLongintParamValid(scip, param, longintval) )
2515  {
2516  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for longint parameter <%s>. Must be integral in range [%" SCIP_LONGINT_FORMAT ",%" SCIP_LONGINT_FORMAT "].\n\n",
2517  valuestr, SCIPparamGetName(param), SCIPparamGetLongintMin(param), SCIPparamGetLongintMax(param));
2518  }
2519  else
2520  {
2521  retcode = SCIPchgLongintParam(scip, param, longintval);
2522  if( retcode == SCIP_PARAMETERWRONGVAL )
2523  {
2524  SCIPdialogMessage(scip, NULL, "\nWrong value <%s> for longint parameter <%s>.\n\n",
2525  valuestr, SCIPparamGetName(param));
2526  }
2527  else
2528  {
2529  SCIP_CALL( retcode );
2530  }
2531 
2532  SCIPdialogMessage(scip, NULL, "%s = %" SCIP_LONGINT_FORMAT "\n", SCIPparamGetName(param),
2533  SCIPparamGetLongint(param));
2534  }
2535  break;
2536 
2537  case SCIP_PARAMTYPE_REAL:
2538  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %.15g, new value [%.15g,%.15g]: ",
2540  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2541  if( endoffile )
2542  {
2543  *nextdialog = NULL;
2544  return SCIP_OKAY;
2545  }
2546  if( valuestr[0] == '\0' )
2547  return SCIP_OKAY;
2548 
2549  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2550 
2551  if( sscanf(valuestr, "%" SCIP_REAL_FORMAT, &realval) != 1 || !SCIPisRealParamValid(scip, param, realval) )
2552  {
2553  SCIPdialogMessage(scip, NULL, "\nInvalid real parameter value <%s> for parameter <%s>. Must be in range [%.15g,%.15g].\n\n",
2554  valuestr, SCIPparamGetName(param), SCIPparamGetRealMin(param), SCIPparamGetRealMax(param));
2555  }
2556  else
2557  {
2558  retcode = SCIPchgRealParam(scip, param, realval);
2559  if( retcode == SCIP_PARAMETERWRONGVAL )
2560  {
2561  SCIPdialogMessage(scip, NULL, "\nWrong value <%s> for real parameter <%s>.\n\n",
2562  valuestr, SCIPparamGetName(param));
2563  }
2564  else
2565  {
2566  SCIP_CALL( retcode );
2567  }
2568 
2569  SCIPdialogMessage(scip, NULL, "%s = %.15g\n", SCIPparamGetName(param), SCIPparamGetReal(param));
2570  }
2571  break;
2572 
2573  case SCIP_PARAMTYPE_CHAR:
2574  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: <%c>, new value: ", SCIPparamGetChar(param));
2575  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2576  if( endoffile )
2577  {
2578  *nextdialog = NULL;
2579  return SCIP_OKAY;
2580  }
2581  if( valuestr[0] == '\0' )
2582  return SCIP_OKAY;
2583 
2584  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2585 
2586  /* coverity[secure_coding] */
2587  if( sscanf(valuestr, "%c", &charval) != 1 || !SCIPisCharParamValid(scip, param, charval) )
2588  {
2589  SCIPdialogMessage(scip, NULL, "\nInvalid char parameter value <%s>. Must be in set {%s}.\n\n",
2590  valuestr, SCIPparamGetCharAllowedValues(param));
2591  }
2592  else
2593  {
2594  retcode = SCIPchgCharParam(scip, param, charval);
2595  if( retcode == SCIP_PARAMETERWRONGVAL )
2596  {
2597  SCIPdialogMessage(scip, NULL, "\nWrong value <%s> for char parameter <%s>.\n\n",
2598  valuestr, SCIPparamGetName(param));
2599  }
2600  else
2601  {
2602  SCIP_CALL( retcode );
2603  }
2604 
2605  SCIPdialogMessage(scip, NULL, "%s = %c\n", SCIPparamGetName(param), SCIPparamGetChar(param));
2606  }
2607  break;
2608 
2609  case SCIP_PARAMTYPE_STRING:
2610  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: <%s>, new value: ", SCIPparamGetString(param));
2611  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2612  if( endoffile )
2613  {
2614  *nextdialog = NULL;
2615  return SCIP_OKAY;
2616  }
2617  if( valuestr[0] == '\0' )
2618  return SCIP_OKAY;
2619 
2620  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2621 
2622  if( !SCIPisStringParamValid(scip, param, valuestr) )
2623  {
2624  SCIPdialogMessage(scip, NULL, "\nInvalid character in string parameter.\n\n");
2625  }
2626  else
2627  {
2628  retcode = SCIPchgStringParam(scip, param, valuestr);
2629  if( retcode == SCIP_PARAMETERWRONGVAL )
2630  {
2631  SCIPdialogMessage(scip, NULL, "\nWrong value <%s> for string parameter <%s>.\n\n",
2632  valuestr, SCIPparamGetName(param));
2633  }
2634  else
2635  {
2636  SCIP_CALL( retcode );
2637  }
2638 
2639  SCIPdialogMessage(scip, NULL, "%s = %s\n", SCIPparamGetName(param), SCIPparamGetString(param));
2640  }
2641  break;
2642 
2643  default:
2644  SCIPerrorMessage("invalid parameter type\n");
2645  return SCIP_INVALIDDATA;
2646  }
2647 
2648  return SCIP_OKAY;
2649 }
2650 
2651 /** dialog description method for the set parameter command */
2652 SCIP_DECL_DIALOGDESC(SCIPdialogDescSetParam)
2653 { /*lint --e{715}*/
2654  SCIP_PARAM* param;
2655  char valuestr[SCIP_MAXSTRLEN];
2656 
2657  /* get the parameter to set */
2658  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
2659 
2660  /* retrieve parameter's current value */
2661  switch( SCIPparamGetType(param) )
2662  {
2663  case SCIP_PARAMTYPE_BOOL:
2664  if( SCIPparamGetBool(param) )
2665  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "TRUE");
2666  else
2667  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "FALSE");
2668  break;
2669 
2670  case SCIP_PARAMTYPE_INT:
2671  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%d", SCIPparamGetInt(param));
2672  break;
2673 
2675  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%" SCIP_LONGINT_FORMAT, SCIPparamGetLongint(param));
2676  break;
2677 
2678  case SCIP_PARAMTYPE_REAL:
2679  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%.15g", SCIPparamGetReal(param));
2680  if( strchr(valuestr, '.') == NULL && strchr(valuestr, 'e') == NULL )
2681  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%.1f", SCIPparamGetReal(param));
2682  break;
2683 
2684  case SCIP_PARAMTYPE_CHAR:
2685  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%c", SCIPparamGetChar(param));
2686  break;
2687 
2688  case SCIP_PARAMTYPE_STRING:
2689  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%s", SCIPparamGetString(param));
2690  break;
2691 
2692  default:
2693  SCIPerrorMessage("invalid parameter type\n");
2694  return SCIP_INVALIDDATA;
2695  }
2696  valuestr[SCIP_MAXSTRLEN-1] = '\0';
2697 
2698  /* display parameter's description */
2699  SCIPdialogMessage(scip, NULL, "%s", SCIPparamGetDesc(param));
2700 
2701  /* display parameter's current value */
2702  SCIPdialogMessage(scip, NULL, " [%s]", valuestr);
2703 
2704  return SCIP_OKAY;
2705 }
2706 
2707 /** dialog execution method for the fix parameter command */
2708 SCIP_DECL_DIALOGEXEC(SCIPdialogExecFixParam)
2709 { /*lint --e{715}*/
2710  SCIP_PARAM* param;
2711  char prompt[SCIP_MAXSTRLEN];
2712  char* valuestr;
2713  SCIP_Bool fix;
2714  SCIP_Bool endoffile;
2715  SCIP_Bool error;
2716 
2717  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2718 
2719  /* get the parameter to fix */
2720  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
2721 
2722  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current fixing status: %s, new value (TRUE/FALSE): ",
2723  SCIPparamIsFixed(param) ? "TRUE" : "FALSE");
2724  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2725  if( endoffile )
2726  {
2727  *nextdialog = NULL;
2728  return SCIP_OKAY;
2729  }
2730  if( valuestr[0] == '\0' )
2731  return SCIP_OKAY;
2732 
2733  fix = parseBoolValue(scip, valuestr, &error);
2734 
2735  if( !error )
2736  {
2737  SCIPparamSetFixed(param, fix);
2738  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, (fix ? "TRUE" : "FALSE"), TRUE) );
2739  SCIPdialogMessage(scip, NULL, "<%s> %s\n", SCIPparamGetName(param), (fix ? "fixed" : "unfixed"));
2740  }
2741  else
2742  {
2743  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2744  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for fixing status. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
2745  valuestr);
2746  }
2747 
2748  return SCIP_OKAY;
2749 }
2750 
2751 /** dialog description method for the fix parameter command */
2752 SCIP_DECL_DIALOGDESC(SCIPdialogDescFixParam)
2753 { /*lint --e{715}*/
2754  SCIP_PARAM* param;
2755 
2756  /* get the parameter to set */
2757  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
2758 
2759  /* display parameter's description */
2760  SCIPdialogMessage(scip, NULL, "%s", SCIPparamGetDesc(param));
2761 
2762  /* display parameter's current fixing status */
2763  if( SCIPparamIsFixed(param) )
2764  SCIPdialogMessage(scip, NULL, " [fixed]");
2765  else
2766  SCIPdialogMessage(scip, NULL, " [not fixed]");
2767 
2768  return SCIP_OKAY;
2769 }
2770 
2771 /** dialog execution method for the set branching direction command */
2772 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetBranchingDirection)
2773 { /*lint --e{715}*/
2774  SCIP_VAR* var;
2775  char prompt[SCIP_MAXSTRLEN];
2776  char* valuestr;
2777  int direction;
2778  SCIP_Bool endoffile;
2779 
2780  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2781 
2782  /* branching priorities cannot be set, if no problem was created */
2784  {
2785  SCIPdialogMessage(scip, NULL, "cannot set branching directions before problem was created\n");
2786  return SCIP_OKAY;
2787  }
2788 
2789  /* get variable name from user */
2790  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "variable name: ", &valuestr, &endoffile) );
2791  if( endoffile )
2792  {
2793  *nextdialog = NULL;
2794  return SCIP_OKAY;
2795  }
2796  if( valuestr[0] == '\0' )
2797  return SCIP_OKAY;
2798 
2799  /* find variable */
2800  var = SCIPfindVar(scip, valuestr);
2801  if( var == NULL )
2802  {
2803  SCIPdialogMessage(scip, NULL, "variable <%s> does not exist in problem\n", valuestr);
2804  return SCIP_OKAY;
2805  }
2806 
2807  /* get new branching direction from user */
2808  switch( SCIPvarGetBranchDirection(var) )
2809  {
2811  direction = -1;
2812  break;
2813  case SCIP_BRANCHDIR_AUTO:
2814  direction = 0;
2815  break;
2817  direction = +1;
2818  break;
2819  case SCIP_BRANCHDIR_FIXED:
2820  default:
2821  SCIPerrorMessage("invalid preferred branching direction <%d> of variable <%s>\n",
2823  return SCIP_INVALIDDATA;
2824  }
2825  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %d, new value: ", direction);
2826  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2827  if( endoffile )
2828  {
2829  *nextdialog = NULL;
2830  return SCIP_OKAY;
2831  }
2833  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "%s %s", prompt, valuestr);
2834  if( valuestr[0] == '\0' )
2835  return SCIP_OKAY;
2836 
2837  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, prompt, FALSE) );
2838 
2839  /* coverity[secure_coding] */
2840  if( sscanf(valuestr, "%d", &direction) != 1 )
2841  {
2842  SCIPdialogMessage(scip, NULL, "\ninvalid input <%s>\n\n", valuestr);
2843  return SCIP_OKAY;
2844  }
2845  if( direction < -1 || direction > +1 )
2846  {
2847  SCIPdialogMessage(scip, NULL, "\ninvalid input <%d>: direction must be -1, 0, or +1\n\n", direction);
2848  return SCIP_OKAY;
2849  }
2850 
2851  /* set new branching direction */
2852  if( direction == -1 )
2854  else if( direction == 0 )
2856  else
2858 
2859  SCIPdialogMessage(scip, NULL, "branching direction of variable <%s> set to %d\n", SCIPvarGetName(var), direction);
2860 
2861  return SCIP_OKAY;
2862 }
2863 
2864 /** dialog execution method for the set branching priority command */
2865 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetBranchingPriority)
2866 { /*lint --e{715}*/
2867  SCIP_VAR* var;
2868  char prompt[SCIP_MAXSTRLEN];
2869  char* valuestr;
2870  int priority;
2871  SCIP_Bool endoffile;
2872 
2873  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2874 
2875  /* branching priorities cannot be set, if no problem was created */
2877  {
2878  SCIPdialogMessage(scip, NULL, "cannot set branching priorities before problem was created\n");
2879  return SCIP_OKAY;
2880  }
2881 
2882  /* get variable name from user */
2883  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "variable name: ", &valuestr, &endoffile) );
2884  if( endoffile )
2885  {
2886  *nextdialog = NULL;
2887  return SCIP_OKAY;
2888  }
2889  if( valuestr[0] == '\0' )
2890  return SCIP_OKAY;
2891 
2892  /* find variable */
2893  var = SCIPfindVar(scip, valuestr);
2894  if( var == NULL )
2895  {
2896  SCIPdialogMessage(scip, NULL, "variable <%s> does not exist in problem\n", valuestr);
2897  return SCIP_OKAY;
2898  }
2899 
2900  /* get new branching priority from user */
2901  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %d, new value: ", SCIPvarGetBranchPriority(var));
2902  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2903  if( endoffile )
2904  {
2905  *nextdialog = NULL;
2906  return SCIP_OKAY;
2907  }
2909  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "%s %s", prompt, valuestr);
2910  if( valuestr[0] == '\0' )
2911  return SCIP_OKAY;
2912 
2913  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, prompt, FALSE) );
2914 
2915  /* coverity[secure_coding] */
2916  if( sscanf(valuestr, "%d", &priority) != 1 )
2917  {
2918  SCIPdialogMessage(scip, NULL, "\ninvalid input <%s>\n\n", valuestr);
2919  return SCIP_OKAY;
2920  }
2921 
2922  /* set new branching priority */
2923  SCIP_CALL( SCIPchgVarBranchPriority(scip, var, priority) );
2924  SCIPdialogMessage(scip, NULL, "branching priority of variable <%s> set to %d\n", SCIPvarGetName(var), SCIPvarGetBranchPriority(var));
2925 
2926  return SCIP_OKAY;
2927 }
2928 
2929 /** dialog execution method for the set heuristics aggressive command */
2930 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsAggressive)
2931 { /*lint --e{715}*/
2932  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2933 
2934  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2935 
2937 
2938  return SCIP_OKAY;
2939 }
2940 
2941 /** dialog execution method for the set heuristics default command */
2942 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsDefault)
2943 { /*lint --e{715}*/
2944  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2945 
2946  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2947 
2949 
2950  return SCIP_OKAY;
2951 }
2952 
2953 /** dialog execution method for the set heuristics fast command */
2954 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsFast)
2955 { /*lint --e{715}*/
2956  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2957 
2958  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2959 
2961 
2962  return SCIP_OKAY;
2963 }
2964 
2965 /** dialog execution method for the set heuristics off command */
2966 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsOff)
2967 { /*lint --e{715}*/
2968  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2969 
2970  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2971 
2973 
2974  return SCIP_OKAY;
2975 }
2976 
2977 /** dialog execution method for the set presolving aggressive command */
2978 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingAggressive)
2979 { /*lint --e{715}*/
2980  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2981 
2982  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2983 
2985 
2986  return SCIP_OKAY;
2987 }
2988 
2989 /** dialog execution method for the set presolving default command */
2990 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingDefault)
2991 { /*lint --e{715}*/
2992  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2993 
2994  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2995 
2997 
2998  return SCIP_OKAY;
2999 }
3000 
3001 /** dialog execution method for the set presolving fast command */
3002 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingFast)
3003 { /*lint --e{715}*/
3004  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3005 
3006  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3007 
3009 
3010  return SCIP_OKAY;
3011 }
3012 
3013 /** dialog execution method for the set presolving off command */
3014 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingOff)
3015 { /*lint --e{715}*/
3016  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3017 
3018  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3019 
3021 
3022  return SCIP_OKAY;
3023 }
3024 
3025 /** dialog execution method for the set separating aggressive command */
3026 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingAggressive)
3027 { /*lint --e{715}*/
3028  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3029 
3030  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3031 
3033 
3034  return SCIP_OKAY;
3035 }
3036 
3037 /** dialog execution method for the set separating default command */
3038 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingDefault)
3039 { /*lint --e{715}*/
3040  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3041 
3042  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3043 
3045 
3046  return SCIP_OKAY;
3047 }
3048 
3049 /** dialog execution method for the set separating fast command */
3050 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingFast)
3051 { /*lint --e{715}*/
3052  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3053 
3054  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3055 
3057 
3058  return SCIP_OKAY;
3059 }
3060 
3061 /** dialog execution method for the set separating off command */
3062 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingOff)
3063 { /*lint --e{715}*/
3064  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3065 
3066  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3067 
3069 
3070  return SCIP_OKAY;
3071 }
3072 
3073 /** dialog execution method for the set emphasis counter command */
3074 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisCounter)
3075 { /*lint --e{715}*/
3076  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3077 
3078  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3079 
3080  /* reset SCIP parameters */
3082 
3083  /* set parameters for counting problems */
3085 
3086  return SCIP_OKAY;
3087 }
3088 
3089 /** dialog execution method for the set emphasis cpsolver command */
3090 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisCpsolver)
3091 { /*lint --e{715}*/
3092  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3093 
3094  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3095 
3096  /* reset SCIP parameters */
3098 
3099  /* set parameters for CP like search problems */
3101 
3102  return SCIP_OKAY;
3103 }
3104 
3105 /** dialog execution method for the set emphasis easy CIP command */
3106 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisEasycip)
3107 { /*lint --e{715}*/
3108  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3109 
3110  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3111 
3112  /* reset SCIP parameters */
3114 
3115  /* set parameters for easy CIP problems */
3117 
3118  return SCIP_OKAY;
3119 }
3120 
3121 /** dialog execution method for the set emphasis feasibility command */
3122 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisFeasibility)
3123 { /*lint --e{715}*/
3124  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3125 
3126  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3127 
3128  /* reset SCIP parameters */
3130 
3131  /* set parameters for feasibility problems */
3133 
3134  return SCIP_OKAY;
3135 }
3136 
3137 /** dialog execution method for the set emphasis hard LP command */
3138 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisHardlp)
3139 { /*lint --e{715}*/
3140  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3141 
3142  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3143 
3144  /* reset SCIP parameters */
3146 
3147  /* set parameters for problems with hard LP */
3149 
3150  return SCIP_OKAY;
3151 }
3152 
3153 /** dialog execution method for the set emphasis optimality command */
3154 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisOptimality)
3155 { /*lint --e{715}*/
3156  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3157 
3158  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3159 
3160  /* reset SCIP parameters */
3162 
3163  /* set parameters for problems to prove optimality fast */
3165 
3166  return SCIP_OKAY;
3167 }
3168 
3169 /** dialog execution method for the set emphasis numerics command */
3170 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisNumerics)
3171 { /*lint --e{715}*/
3172  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3173 
3174  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3175 
3176  /* reset SCIP parameters */
3178 
3179  /* set parameters for problems to prove optimality fast */
3181 
3182  return SCIP_OKAY;
3183 }
3184 
3185 /** dialog execution method for the set limits objective command */
3186 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetLimitsObjective)
3187 { /*lint --e{715}*/
3188  char prompt[SCIP_MAXSTRLEN];
3189  char* valuestr;
3190  SCIP_Real objlim;
3191  SCIP_Bool endoffile;
3192 
3193  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3194 
3195  /* objective limit cannot be set, if no problem was created */
3197  {
3198  SCIPdialogMessage(scip, NULL, "cannot set objective limit before problem was created\n");
3199  return SCIP_OKAY;
3200  }
3201 
3202  /* get new objective limit from user */
3203  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %.15g, new value: ", SCIPgetObjlimit(scip));
3204  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
3205  if( endoffile )
3206  {
3207  *nextdialog = NULL;
3208  return SCIP_OKAY;
3209  }
3210  if( valuestr[0] == '\0' )
3211  return SCIP_OKAY;
3212 
3213  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
3214 
3215  /* coverity[secure_coding] */
3216  if( sscanf(valuestr, "%" SCIP_REAL_FORMAT, &objlim) != 1 )
3217  {
3218  SCIPdialogMessage(scip, NULL, "\ninvalid input <%s>\n\n", valuestr);
3219  return SCIP_OKAY;
3220  }
3221 
3222  /* check, if new objective limit is valid */
3225  {
3226  SCIPdialogMessage(scip, NULL, "\ncannot relax objective limit from %.15g to %.15g after problem was transformed\n\n",
3227  SCIPgetObjlimit(scip), objlim);
3228  return SCIP_OKAY;
3229  }
3230 
3231  /* set new objective limit */
3232  SCIP_CALL( SCIPsetObjlimit(scip, objlim) );
3233  SCIPdialogMessage(scip, NULL, "objective value limit set to %.15g\n", SCIPgetObjlimit(scip));
3234 
3235  return SCIP_OKAY;
3236 }
3237 
3238 /** dialog execution method for the write LP command */
3239 static
3240 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteLp)
3241 { /*lint --e{715}*/
3242  char* filename;
3243  SCIP_Bool endoffile;
3244 
3245  SCIPdialogMessage(scip, NULL, "\n");
3246 
3247  /* node relaxations only exist in solving & solved stage */
3249  {
3250  SCIPdialogMessage(scip, NULL, "There is no node LP relaxation before solving starts\n");
3251  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3252  return SCIP_OKAY;
3253  }
3255  {
3256  SCIPdialogMessage(scip, NULL, "There is no node LP relaxation after problem was solved\n");
3257  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3258  return SCIP_OKAY;
3259  }
3260 
3261  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3262  if( endoffile )
3263  {
3264  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3265  return SCIP_OKAY;
3266  }
3267  if( filename[0] != '\0' )
3268  {
3269  SCIP_RETCODE retcode;
3270 
3271  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3272  retcode = SCIPwriteLP(scip, filename);
3273 
3274  if( retcode == SCIP_FILECREATEERROR )
3275  {
3276  SCIPdialogMessage(scip, NULL, "error not creating file <%s>\n", filename);
3277  }
3278  else
3279  {
3280  SCIP_CALL( retcode );
3281 
3282  SCIPdialogMessage(scip, NULL, "written node LP relaxation to file <%s>\n", filename);
3283  }
3284  }
3285 
3286  SCIPdialogMessage(scip, NULL, "\n");
3287 
3288  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3289 
3290  return SCIP_OKAY;
3291 }
3292 
3293 /** dialog execution method for the write MIP command */
3294 static
3295 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteMip)
3296 { /*lint --e{715}*/
3297  char command[SCIP_MAXSTRLEN];
3298  char filename[SCIP_MAXSTRLEN];
3299  SCIP_Bool endoffile;
3300  char* valuestr;
3301  SCIP_Bool offset;
3302  SCIP_Bool generic;
3303  SCIP_Bool lazyconss;
3304  SCIP_Bool error;
3305 
3306  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3307 
3308  /* node relaxations only exist in solving & solved stage */
3310  {
3311  SCIPdialogMessage(scip, NULL, "There is no node MIP relaxation before solving starts\n");
3312  return SCIP_OKAY;
3313  }
3315  {
3316  SCIPdialogMessage(scip, NULL, "There is no node MIP relaxation after problem was solved\n");
3317  return SCIP_OKAY;
3318  }
3319 
3320  /* first get file name */
3321  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &valuestr, &endoffile) );
3322  if( endoffile )
3323  {
3324  *nextdialog = NULL;
3325  return SCIP_OKAY;
3326  }
3327  if( valuestr[0] == '\0' )
3328  return SCIP_OKAY;
3329 
3330  (void)SCIPstrncpy(filename, valuestr, SCIP_MAXSTRLEN);
3331 
3332  /* second ask for generic variable and row names */
3333  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
3334  "using generic variable and row names (TRUE/FALSE): ",
3335  &valuestr, &endoffile) );
3336 
3337  if( endoffile )
3338  {
3339  *nextdialog = NULL;
3340  return SCIP_OKAY;
3341  }
3342  if( valuestr[0] == '\0' )
3343  return SCIP_OKAY;
3344 
3345  generic = parseBoolValue(scip, valuestr, &error);
3346 
3347  if( error )
3348  {
3349  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
3350  valuestr);
3351 
3352  return SCIP_OKAY;
3353  }
3354 
3355  /* adjust command and add to the history */
3356  SCIPescapeString(command, SCIP_MAXSTRLEN, filename);
3357  (void) SCIPsnprintf(command, SCIP_MAXSTRLEN, "%s %s", command, generic ? "TRUE" : "FALSE");
3358 
3359  /* third ask if for adjusting the objective offset */
3360  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
3361  "using original objective function (TRUE/FALSE): ",
3362  &valuestr, &endoffile) );
3363 
3364  if( endoffile )
3365  {
3366  *nextdialog = NULL;
3367  return SCIP_OKAY;
3368  }
3369  if( valuestr[0] == '\0' )
3370  return SCIP_OKAY;
3371 
3372  offset = parseBoolValue(scip, valuestr, &error);
3373 
3374  if( error )
3375  {
3376  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
3377  valuestr);
3378 
3379  return SCIP_OKAY;
3380  }
3381 
3382  (void) SCIPsnprintf(command, SCIP_MAXSTRLEN, "%s %s", command, offset ? "TRUE" : "FALSE");
3383  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, command, FALSE) );
3384 
3385  /* fourth ask for lazy constraints */
3386  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
3387  "output removable rows as lazy constraints (TRUE/FALSE): ",
3388  &valuestr, &endoffile) );
3389 
3390  if( endoffile )
3391  {
3392  *nextdialog = NULL;
3393  return SCIP_OKAY;
3394  }
3395  if( valuestr[0] == '\0' )
3396  return SCIP_OKAY;
3397 
3398  lazyconss = parseBoolValue(scip, valuestr, &error);
3399 
3400  if( error )
3401  {
3402  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
3403  valuestr);
3404 
3405  return SCIP_OKAY;
3406  }
3407 
3408  /* adjust command and add to the history */
3409  SCIPescapeString(command, SCIP_MAXSTRLEN, filename);
3410  (void) SCIPsnprintf(command, SCIP_MAXSTRLEN, "%s %s", command, lazyconss ? "TRUE" : "FALSE");
3411 
3412  /* execute command */
3413  SCIP_CALL( SCIPwriteMIP(scip, filename, generic, offset, lazyconss) );
3414  SCIPdialogMessage(scip, NULL, "written node MIP relaxation to file <%s>\n", filename);
3415 
3416  SCIPdialogMessage(scip, NULL, "\n");
3417 
3418  return SCIP_OKAY;
3419 }
3420 
3421 
3422 /** dialog execution method for the write NLP command */
3423 static
3424 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteNlp)
3425 { /*lint --e{715}*/
3426  char* filename;
3427  SCIP_Bool endoffile;
3428 
3429  SCIPdialogMessage(scip, NULL, "\n");
3430 
3431  /* node relaxations only exist in solving & solved stage */
3433  {
3434  SCIPdialogMessage(scip, NULL, "There is no node NLP relaxation before solving starts\n");
3435  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3436  return SCIP_OKAY;
3437  }
3439  {
3440  SCIPdialogMessage(scip, NULL, "There is no node NLP relaxation after problem was solved\n");
3441  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3442  return SCIP_OKAY;
3443  }
3444  if( !SCIPisNLPConstructed(scip) )
3445  {
3446  SCIPdialogMessage(scip, NULL, "There has been no node NLP relaxation constructed\n");
3447  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3448  return SCIP_OKAY;
3449  }
3450 
3451  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3452  if( endoffile )
3453  {
3454  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3455  return SCIP_OKAY;
3456  }
3457  if( filename[0] != '\0' )
3458  {
3459  SCIP_RETCODE retcode;
3460 
3461  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3462  retcode = SCIPwriteNLP(scip, filename);
3463 
3464  if( retcode == SCIP_FILECREATEERROR )
3465  {
3466  SCIPdialogMessage(scip, NULL, "error not creating file <%s>\n", filename);
3467  }
3468  else
3469  {
3470  SCIP_CALL( retcode );
3471 
3472  SCIPdialogMessage(scip, NULL, "written node NLP relaxation to file <%s>\n", filename);
3473  }
3474  }
3475 
3476  SCIPdialogMessage(scip, NULL, "\n");
3477 
3478  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3479 
3480  return SCIP_OKAY;
3481 }
3482 
3483 /** dialog execution method for the write problem command */
3484 static
3485 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteProblem)
3486 { /*lint --e{715}*/
3487  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3488 
3490  {
3491  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, FALSE, FALSE) );
3492  }
3493  else
3494  SCIPdialogMessage(scip, NULL, "no problem available\n");
3495 
3496  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3497 
3498  return SCIP_OKAY;
3499 }
3500 
3501 /** dialog execution method for the write generic problem command */
3502 static
3503 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteGenProblem)
3504 { /*lint --e{715}*/
3505  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3506 
3508  {
3509  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, FALSE, TRUE) );
3510  }
3511  else
3512  SCIPdialogMessage(scip, NULL, "no problem available\n");
3513 
3514  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3515 
3516  return SCIP_OKAY;
3517 }
3518 
3519 /** dialog execution method for the write solution command */
3520 static
3521 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteSolution)
3522 { /*lint --e{715}*/
3523  char* filename;
3524  SCIP_Bool endoffile;
3525 
3526  SCIPdialogMessage(scip, NULL, "\n");
3527 
3528  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3529  if( endoffile )
3530  {
3531  *nextdialog = NULL;
3532  return SCIP_OKAY;
3533  }
3534  if( filename[0] != '\0' )
3535  {
3536  FILE* file;
3537 
3538  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3539 
3540  file = fopen(filename, "w");
3541  if( file == NULL )
3542  {
3543  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3544  SCIPdialoghdlrClearBuffer(dialoghdlr);
3545  }
3546  else
3547  {
3548  SCIP_Bool printzeros;
3549 
3550  SCIPinfoMessage(scip, file, "solution status: ");
3551  SCIP_CALL_FINALLY( SCIPprintStatus(scip, file), fclose(file) );
3552 
3553  SCIP_CALL_FINALLY( SCIPgetBoolParam(scip, "write/printzeros", &printzeros), fclose(file) );
3554 
3555  SCIPinfoMessage(scip, file, "\n");
3556  SCIP_CALL_FINALLY( SCIPprintBestSol(scip, file, printzeros), fclose(file) );
3557 
3558  SCIPdialogMessage(scip, NULL, "written solution information to file <%s>\n", filename);
3559  fclose(file);
3560  }
3561  } /*lint !e593*/
3562 
3563  SCIPdialogMessage(scip, NULL, "\n");
3564 
3565  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3566 
3567  return SCIP_OKAY;
3568 }
3569 
3570 /** dialog execution method for the write mipstart command */
3571 static
3572 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteMIPStart)
3573 { /*lint --e{715}*/
3574  char* filename;
3575  SCIP_Bool endoffile;
3576 
3577  SCIPdialogMessage(scip, NULL, "\n");
3578 
3579  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3580  if( endoffile )
3581  {
3582  *nextdialog = NULL;
3583  return SCIP_OKAY;
3584  }
3585  if( filename[0] != '\0' )
3586  {
3587  FILE* file;
3588 
3589  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3590 
3591  file = fopen(filename, "w");
3592  if( file == NULL )
3593  {
3594  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3595  SCIPdialoghdlrClearBuffer(dialoghdlr);
3596  }
3597  else
3598  {
3599  SCIP_SOL* sol;
3600 
3601  SCIPinfoMessage(scip, file, "\n");
3602 
3603  sol = SCIPgetBestSol(scip);
3604 
3605  if( sol == NULL )
3606  {
3607  SCIPdialogMessage(scip, NULL, "no mip start available\n");
3608  }
3609  else
3610  {
3611  SCIP_CALL_FINALLY( SCIPprintMIPStart(scip, sol, file), fclose(file) );
3612 
3613  SCIPdialogMessage(scip, NULL, "written mip start information to file <%s>\n", filename);
3614  }
3615  fclose(file);
3616  }
3617  } /*lint !e593*/
3618 
3619  SCIPdialogMessage(scip, NULL, "\n");
3620 
3621  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3622 
3623  return SCIP_OKAY;
3624 }
3625 
3626 /** dialog execution method for writing command line history */
3627 static
3628 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteCommandHistory)
3629 { /*lint --e{715}*/
3630  char* filename;
3631  SCIP_Bool endoffile;
3632 
3633  SCIPdialogMessage(scip, NULL, "\n");
3634 
3635  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3636  if( endoffile )
3637  {
3638  *nextdialog = NULL;
3639  return SCIP_OKAY;
3640  }
3641  if( filename[0] != '\0' )
3642  {
3643  SCIP_RETCODE retcode;
3644 
3645  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3646 
3647  retcode = SCIPdialogWriteHistory(filename);
3648 
3649  if( retcode != SCIP_OKAY )
3650  {
3651  SCIPdialogMessage(scip, NULL, "error writing to file <%s>\n"
3652  "check that the directory exists and that you have correct permissions\n", filename);
3653  SCIPdialoghdlrClearBuffer(dialoghdlr);
3654  }
3655  else
3656  {
3657  SCIPdialogMessage(scip, NULL, "wrote available command line history to <%s>\n", filename);
3658  }
3659  }
3660 
3661  SCIPdialogMessage(scip, NULL, "\n");
3662 
3663  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3664 
3665  return SCIP_OKAY;
3666 }
3667 
3668 /** dialog execution method for the write finitesolution command */
3669 static
3670 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteFiniteSolution)
3671 { /*lint --e{715}*/
3672  char* filename;
3673  SCIP_Bool endoffile;
3674 
3675  SCIPdialogMessage(scip, NULL, "\n");
3676 
3677  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3678  if( endoffile )
3679  {
3680  *nextdialog = NULL;
3681  return SCIP_OKAY;
3682  }
3683  if( filename[0] != '\0' )
3684  {
3685  FILE* file;
3686 
3687  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3688 
3689  file = fopen(filename, "w");
3690  if( file == NULL )
3691  {
3692  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3693  SCIPdialoghdlrClearBuffer(dialoghdlr);
3694  }
3695  else
3696  {
3697  SCIP_SOL* bestsol = SCIPgetBestSol(scip);
3698  SCIP_Bool printzeros;
3699 
3700  SCIPinfoMessage(scip, file, "solution status: ");
3701 
3702  SCIP_CALL_FINALLY( SCIPprintStatus(scip, file), fclose(file) );
3703 
3704  SCIPinfoMessage(scip, file, "\n");
3705 
3706  if( bestsol != NULL )
3707  {
3708  SCIP_SOL* sol;
3709  SCIP_Bool success;
3710 
3711  SCIP_CALL_FINALLY( SCIPcreateFiniteSolCopy(scip, &sol, bestsol, &success), fclose(file) );
3712 
3713  SCIP_CALL_FINALLY( SCIPgetBoolParam(scip, "write/printzeros", &printzeros), fclose(file) );
3714 
3715  if( sol != NULL )
3716  {
3717  SCIP_CALL_FINALLY( SCIPprintSol(scip, sol, file, printzeros), fclose(file) );
3718 
3719  SCIPdialogMessage(scip, NULL, "written solution information to file <%s>\n", filename);
3720 
3721  SCIP_CALL_FINALLY( SCIPfreeSol(scip, &sol), fclose(file) );
3722  }
3723  else
3724  {
3725  SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, "finite solution could not be created\n");
3726  SCIPdialogMessage(scip, NULL, "finite solution could not be created\n");
3727  }
3728  }
3729  else
3730  {
3731  SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, "no solution available\n");
3732  SCIPdialogMessage(scip, NULL, "no solution available\n");
3733  }
3734 
3735  fclose(file);
3736  }
3737  } /*lint !e593*/
3738 
3739  SCIPdialogMessage(scip, NULL, "\n");
3740 
3741  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3742 
3743  return SCIP_OKAY;
3744 }
3745 
3746 /** dialog execution method for the write statistics command */
3747 static
3748 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteStatistics)
3749 { /*lint --e{715}*/
3750  char* filename;
3751  SCIP_Bool endoffile;
3752 
3753  SCIPdialogMessage(scip, NULL, "\n");
3754 
3755  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3756  if( endoffile )
3757  {
3758  *nextdialog = NULL;
3759  return SCIP_OKAY;
3760  }
3761  if( filename[0] != '\0' )
3762  {
3763  FILE* file;
3764 
3765  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3766 
3767  file = fopen(filename, "w");
3768  if( file == NULL )
3769  {
3770  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3771  SCIPprintSysError(filename);
3772  SCIPdialoghdlrClearBuffer(dialoghdlr);
3773  }
3774  else
3775  {
3776  SCIP_CALL_FINALLY( SCIPprintStatistics(scip, file), fclose(file) );
3777 
3778  SCIPdialogMessage(scip, NULL, "written statistics to file <%s>\n", filename);
3779  fclose(file);
3780  }
3781  } /*lint !e593*/
3782 
3783  SCIPdialogMessage(scip, NULL, "\n");
3784 
3785  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3786 
3787  return SCIP_OKAY;
3788 }
3789 
3790 /** dialog execution method for the write transproblem command */
3791 static
3792 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteTransproblem)
3793 { /*lint --e{715}*/
3794  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3795 
3797  {
3798  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, TRUE, FALSE) );
3799  }
3800  else
3801  SCIPdialogMessage(scip, NULL, "no transformed problem available\n");
3802 
3803  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3804 
3805  return SCIP_OKAY;
3806 }
3807 
3808 /** dialog execution method for the write generic transproblem command */
3809 static
3810 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteGenTransproblem)
3811 { /*lint --e{715}*/
3812  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3813 
3815  {
3816  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, TRUE, TRUE) );
3817  }
3818  else
3819  SCIPdialogMessage(scip, NULL, "no transformed problem available\n");
3820 
3821  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3822 
3823  return SCIP_OKAY;
3824 }
3825 
3826 /** dialog execution method for solution validation */
3827 static
3828 SCIP_DECL_DIALOGEXEC(SCIPdialogExecValidateSolve)
3829 { /*lint --e{715}*/
3830  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3831 
3833  {
3834  SCIPdialogMessage(scip, NULL, "\nNo problem available for validation\n");
3835  }
3836  else
3837  {
3838  char *refstrs[2];
3839  SCIP_Real refvals[2] = {SCIP_INVALID, SCIP_INVALID};
3840  const char* primaldual[] = {"primal", "dual"};
3841  char prompt[SCIP_MAXSTRLEN];
3842  int i;
3843 
3844  /* read in primal and dual reference values */
3845  for( i = 0; i < 2; ++i )
3846  {
3847  char * endptr;
3848  SCIP_Bool endoffile;
3849 
3850  (void)SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "Please enter %s validation reference bound (or use +/-infinity) :", primaldual[i]);
3851  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &(refstrs[i]), &endoffile) );
3852 
3853  /* treat no input as SCIP_UNKNOWN */
3854  if( endoffile || strncmp(refstrs[i], "\0", 1) == 0 ) /*lint !e840*/
3855  {
3856  refvals[i] = SCIP_UNKNOWN;
3857  }
3858  else if( strncmp(refstrs[i], "q", 1) == 0 )
3859  break;
3860  else if( ! SCIPparseReal(scip, refstrs[i], &refvals[i], &endptr) )
3861  {
3862  SCIPdialogMessage(scip, NULL, "Could not parse value '%s', please try again or type 'q' to quit\n", refstrs[i]);
3863  --i; /*lint !e850*/
3864  }
3865  }
3866 
3867  /* check if the loop finished by checking the value of 'i'. Do not validate if user input is missing */
3868  if( i == 2 ) /*lint !e850*/
3869  {
3870  assert(refvals[0] != SCIP_INVALID); /*lint !e777*/
3871  assert(refvals[1] != SCIP_INVALID); /*lint !e777*/
3872  SCIP_CALL( SCIPvalidateSolve(scip, refvals[0], refvals[1], SCIPfeastol(scip), FALSE, NULL, NULL, NULL) );
3873  }
3874  }
3875 
3876  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3877 
3878  return SCIP_OKAY;
3879 }
3880 
3881 /** dialog execution method for linear constraint type classification */
3882 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayLinearConsClassification)
3883 { /*lint --e{715}*/
3884  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3885 
3887  SCIPdialogMessage(scip, NULL, "\nNo problem available for classification\n");
3888  else
3889  {
3890  SCIP_LINCONSSTATS* linconsstats;
3891 
3892  SCIP_CALL( SCIPlinConsStatsCreate(scip, &linconsstats) );
3893 
3894  /* call linear constraint classification and print the statistics to standard out */
3896 
3897  SCIPprintLinConsStats(scip, NULL, linconsstats);
3898 
3899  SCIPlinConsStatsFree(scip, &linconsstats);
3900  }
3901 
3902  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3903 
3904  return SCIP_OKAY;
3905 }
3906 
3907 /** creates a root dialog */
3909  SCIP* scip, /**< SCIP data structure */
3910  SCIP_DIALOG** root /**< pointer to store the root dialog */
3911  )
3912 {
3913  SCIP_CALL( SCIPincludeDialog(scip, root,
3914  dialogCopyDefault,
3915  SCIPdialogExecMenuLazy, NULL, NULL,
3916  "SCIP", "SCIP's main menu", TRUE, NULL) );
3917 
3918  SCIP_CALL( SCIPsetRootDialog(scip, *root) );
3919  SCIP_CALL( SCIPreleaseDialog(scip, root) );
3920  *root = SCIPgetRootDialog(scip);
3921 
3922  return SCIP_OKAY;
3923 }
3924 
3925 
3926 /** includes or updates the default dialog menus in SCIP */
3928  SCIP* scip /**< SCIP data structure */
3929  )
3930 {
3931  SCIP_DIALOG* root;
3932  SCIP_DIALOG* submenu;
3933  SCIP_DIALOG* dialog;
3934 
3935  /* root menu */
3936  root = SCIPgetRootDialog(scip);
3937  if( root == NULL )
3938  {
3939  SCIP_CALL( SCIPcreateRootDialog(scip, &root) );
3940  }
3941 
3942  /* change */
3943  if( !SCIPdialogHasEntry(root, "change") )
3944  {
3945  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
3946  NULL,
3947  SCIPdialogExecMenu, NULL, NULL,
3948  "change", "change the problem", TRUE, NULL) );
3949  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
3950  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
3951  }
3952  if( SCIPdialogFindEntry(root, "change", &submenu) != 1 )
3953  {
3954  SCIPerrorMessage("change sub menu not found\n");
3955  return SCIP_PLUGINNOTFOUND;
3956  }
3957 
3958  /* change add */
3959  if( !SCIPdialogHasEntry(submenu, "add") )
3960  {
3961  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3962  NULL,
3963  SCIPdialogExecChangeAddCons, NULL, NULL,
3964  "add", "add constraint", FALSE, NULL) );
3965  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3966  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3967  }
3968 
3969  /* change bounds */
3970  if( !SCIPdialogHasEntry(submenu, "bounds") )
3971  {
3972  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3973  NULL,
3974  SCIPdialogExecChangeBounds, NULL, NULL,
3975  "bounds", "change bounds of a variable", FALSE, NULL) );
3976  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3977  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3978  }
3979 
3980  /* free transformed problem */
3981  if( !SCIPdialogHasEntry(submenu, "freetransproblem") )
3982  {
3983  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3984  NULL,
3985  SCIPdialogExecChangeFreetransproblem, NULL, NULL,
3986  "freetransproblem", "free transformed problem", FALSE, NULL) );
3987  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3988  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3989  }
3990 
3991  /* change objective sense */
3992  if( !SCIPdialogHasEntry(submenu, "objsense") )
3993  {
3994  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3995  NULL,
3996  SCIPdialogExecChangeObjSense, NULL, NULL,
3997  "objsense", "change objective sense", FALSE, NULL) );
3998  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3999  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4000  }
4001 
4002  /* checksol */
4003  if( !SCIPdialogHasEntry(root, "checksol") )
4004  {
4005  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4006  NULL,
4007  SCIPdialogExecChecksol, NULL, NULL,
4008  "checksol", "double checks best solution w.r.t. original problem", FALSE, NULL) );
4009  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4010  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4011  }
4012 
4013  /* display */
4014  if( !SCIPdialogHasEntry(root, "display") )
4015  {
4016  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4017  NULL,
4018  SCIPdialogExecMenu, NULL, NULL,
4019  "display", "display information", TRUE, NULL) );
4020  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
4021  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4022  }
4023  if( SCIPdialogFindEntry(root, "display", &submenu) != 1 )
4024  {
4025  SCIPerrorMessage("display sub menu not found\n");
4026  return SCIP_PLUGINNOTFOUND;
4027  }
4028 
4029  /* display benders */
4030  if( !SCIPdialogHasEntry(submenu, "benders") )
4031  {
4032  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4033  NULL,
4034  SCIPdialogExecDisplayBenders, NULL, NULL,
4035  "benders", "display Benders' decomposition", FALSE, NULL) );
4036  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4037  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4038  }
4039 
4040  /* display branching */
4041  if( !SCIPdialogHasEntry(submenu, "branching") )
4042  {
4043  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4044  NULL,
4045  SCIPdialogExecDisplayBranching, NULL, NULL,
4046  "branching", "display branching rules", FALSE, NULL) );
4047  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4048  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4049  }
4050 
4051  /* display compressions */
4052  if( !SCIPdialogHasEntry(submenu, "compression") )
4053  {
4054  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4055  NULL,
4056  SCIPdialogExecDisplayCompression, NULL, NULL,
4057  "compression", "display compression techniques", FALSE, NULL) );
4058  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4059  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4060  }
4061 
4062  /* display conflict */
4063  if( !SCIPdialogHasEntry(submenu, "conflict") )
4064  {
4065  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4066  NULL,
4067  SCIPdialogExecDisplayConflict, NULL, NULL,
4068  "conflict", "display conflict handlers", FALSE, NULL) );
4069  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4070  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4071  }
4072 
4073  /* display conshdlrs */
4074  if( !SCIPdialogHasEntry(submenu, "conshdlrs") )
4075  {
4076  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4077  NULL,
4078  SCIPdialogExecDisplayConshdlrs, NULL, NULL,
4079  "conshdlrs", "display constraint handlers", FALSE, NULL) );
4080  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4081  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4082  }
4083 
4084  /* display displaycols */
4085  if( !SCIPdialogHasEntry(submenu, "displaycols") )
4086  {
4087  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4088  NULL,
4089  SCIPdialogExecDisplayDisplaycols, NULL, NULL,
4090  "displaycols", "display display columns", FALSE, NULL) );
4091  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4092  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4093  }
4094 
4095  /* display heuristics */
4096  if( !SCIPdialogHasEntry(submenu, "heuristics") )
4097  {
4098  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4099  NULL,
4100  SCIPdialogExecDisplayHeuristics, NULL, NULL,
4101  "heuristics", "display primal heuristics", FALSE, NULL) );
4102  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4103  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4104  }
4105 
4106  /* display memory */
4107  if( !SCIPdialogHasEntry(submenu, "memory") )
4108  {
4109  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4110  NULL,
4111  SCIPdialogExecDisplayMemory, NULL, NULL,
4112  "memory", "display memory diagnostics", FALSE, NULL) );
4113  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4114  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4115  }
4116 
4117  /* display nlpi */
4118  if( !SCIPdialogHasEntry(submenu, "nlpis") )
4119  {
4120  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4121  NULL,
4122  SCIPdialogExecDisplayNlpi, NULL, NULL,
4123  "nlpis", "display NLP solver interfaces", FALSE, NULL) );
4124  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4125  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4126  }
4127 
4128  /* display nodeselectors */
4129  if( !SCIPdialogHasEntry(submenu, "nodeselectors") )
4130  {
4131  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4132  NULL,
4133  SCIPdialogExecDisplayNodeselectors, NULL, NULL,
4134  "nodeselectors", "display node selectors", FALSE, NULL) );
4135  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4136  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4137  }
4138 
4139  /* display parameters */
4140  if( !SCIPdialogHasEntry(submenu, "parameters") )
4141  {
4142  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4143  NULL,
4144  SCIPdialogExecDisplayParameters, NULL, NULL,
4145  "parameters", "display non-default parameter settings", FALSE, NULL) );
4146  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4147  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4148  }
4149 
4150  /* display presolvers */
4151  if( !SCIPdialogHasEntry(submenu, "presolvers") )
4152  {
4153  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4154  NULL,
4155  SCIPdialogExecDisplayPresolvers, NULL, NULL,
4156  "presolvers", "display presolvers", FALSE, NULL) );
4157  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4158  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4159  }
4160 
4161  /* display pricers */
4162  if( !SCIPdialogHasEntry(submenu, "pricers") )
4163  {
4164  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4165  NULL,
4166  SCIPdialogExecDisplayPricers, NULL, NULL,
4167  "pricers", "display pricers", FALSE, NULL) );
4168  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4169  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4170  }
4171 
4172  /* display problem */
4173  if( !SCIPdialogHasEntry(submenu, "problem") )
4174  {
4175  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4176  NULL,
4177  SCIPdialogExecDisplayProblem, NULL, NULL,
4178  "problem", "display original problem", FALSE, NULL) );
4179  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4180  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4181  }
4182 
4183  /* display propagators */
4184  if( !SCIPdialogHasEntry(submenu, "propagators") )
4185  {
4186  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4187  NULL,
4188  SCIPdialogExecDisplayPropagators, NULL, NULL,
4189  "propagators", "display propagators", FALSE, NULL) );
4190  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4191  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4192  }
4193 
4194  /* display readers */
4195  if( !SCIPdialogHasEntry(submenu, "readers") )
4196  {
4197  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4198  NULL,
4199  SCIPdialogExecDisplayReaders, NULL, NULL,
4200  "readers", "display file readers", FALSE, NULL) );
4201  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4202  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4203  }
4204 
4205  /* display relaxing */
4206  if( !SCIPdialogHasEntry(submenu, "relaxators") )
4207  {
4208  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4209  NULL,
4210  SCIPdialogExecDisplayRelaxators, NULL, NULL,
4211  "relaxators", "display relaxators", FALSE, NULL) );
4212  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4213  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4214  }
4215 
4216  /* display separators */
4217  if( !SCIPdialogHasEntry(submenu, "separators") )
4218  {
4219  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4220  NULL,
4221  SCIPdialogExecDisplaySeparators, NULL, NULL,
4222  "separators", "display cut separators", FALSE, NULL) );
4223  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4224  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4225  }
4226 
4227  /* display solution */
4228  if( !SCIPdialogHasEntry(submenu, "solution") )
4229  {
4230  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4231  NULL,
4232  SCIPdialogExecDisplaySolution, NULL, NULL,
4233  "solution", "display best primal solution", FALSE, NULL) );
4234  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4235  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4236  }
4237 
4238  /* display finite solution */
4239  if( !SCIPdialogHasEntry(submenu, "finitesolution") )
4240  {
4241  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4242  NULL,
4243  SCIPdialogExecDisplayFiniteSolution, NULL, NULL,
4244  "finitesolution", "display best primal solution (try to make solution values finite, first)", FALSE, NULL) );
4245  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4246  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4247  }
4248 
4249  /* display solution */
4250  if( !SCIPdialogHasEntry(submenu, "dualsolution") )
4251  {
4252  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4253  NULL,
4254  SCIPdialogExecDisplayDualSolution, NULL, NULL,
4255  "dualsolution", "display dual solution vector (LP only, without presolving)", FALSE, NULL) );
4256  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4257  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4258  }
4259 
4260  /* display solution */
4261  if( !SCIPdialogHasEntry(submenu, "sols") )
4262  {
4263  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4264  NULL,
4265  SCIPdialogExecDisplaySolutionPool, NULL, NULL,
4266  "sols", "display solutions from pool", FALSE, NULL) );
4267  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4268  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4269  }
4270 
4271  /* display benders decomposition subproblem */
4272  if( !SCIPdialogHasEntry(submenu, "subproblem") )
4273  {
4274  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4275  NULL,
4276  SCIPdialogExecDisplaySubproblem, NULL, NULL,
4277  "subproblem", "display subproblem of a Benders' decomposition", FALSE, NULL) );
4278  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4279  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4280  }
4281 
4282  /* display the best solution to the benders decomposition subproblem */
4283  if( !SCIPdialogHasEntry(submenu, "subsolution") )
4284  {
4285  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4286  NULL,
4287  SCIPdialogExecDisplaySubSolution, NULL, NULL,
4288  "subsolution", "display solution to the Benders' decomposition subproblems given the best master problem solution", FALSE, NULL) );
4289  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4290  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4291  }
4292 
4293  /* display statistics */
4294  if( !SCIPdialogHasEntry(submenu, "statistics") )
4295  {
4296  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4297  NULL,
4298  SCIPdialogExecDisplayStatistics, NULL, NULL,
4299  "statistics", "display problem and optimization statistics", FALSE, NULL) );
4300  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4301  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4302  }
4303 
4304  /* display reoptimization statistics */
4305  if( !SCIPdialogHasEntry(submenu, "reoptstatistics") )
4306  {
4307  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4308  NULL,
4309  SCIPdialogExecDisplayReoptStatistics, NULL, NULL,
4310  "reoptstatistics", "display reoptimization statistics", FALSE, NULL) );
4311  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4312  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4313  }
4314 
4315  /* display transproblem */
4316  if( !SCIPdialogHasEntry(submenu, "transproblem") )
4317  {
4318  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4319  NULL,
4320  SCIPdialogExecDisplayTransproblem, NULL, NULL,
4321  "transproblem", "display current node transformed problem", FALSE, NULL) );
4322  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4323  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4324  }
4325 
4326  /* display value */
4327  if( !SCIPdialogHasEntry(submenu, "value") )
4328  {
4329  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4330  NULL,
4331  SCIPdialogExecDisplayValue, NULL, NULL,
4332  "value", "display value of single variable in best primal solution", FALSE, NULL) );
4333  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4334  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4335  }
4336 
4337  /* display varbranchstatistics */
4338  if( !SCIPdialogHasEntry(submenu, "varbranchstatistics") )
4339  {
4340  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4341  NULL,
4342  SCIPdialogExecDisplayVarbranchstatistics, NULL, NULL,
4343  "varbranchstatistics", "display statistics for branching on variables", FALSE, NULL) );
4344  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4345  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4346  }
4347 
4348  /* display varbranchstatistics */
4349  if( !SCIPdialogHasEntry(submenu, "lpsolquality") )
4350  {
4351  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4352  NULL,
4353  SCIPdialogExecDisplayLPSolutionQuality, NULL, NULL,
4354  "lpsolquality", "display quality of the current LP solution, if available", FALSE, NULL) );
4355  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4356  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4357  }
4358 
4359  /* display transsolution */
4360  if( !SCIPdialogHasEntry(submenu, "transsolution") )
4361  {
4362  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4363  NULL,
4364  SCIPdialogExecDisplayTranssolution, NULL, NULL,
4365  "transsolution", "display best primal solution in transformed variables", FALSE, NULL) );
4366  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4367  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4368  }
4369 
4370  /* display linear constraint type classification */
4371  if( !SCIPdialogHasEntry(submenu, "linclass") )
4372  {
4373  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4374  NULL,
4375  SCIPdialogExecDisplayLinearConsClassification, NULL, NULL,
4376  "linclass", "linear constraint classification as used for MIPLIB", FALSE, NULL) );
4377  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4378  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4379  }
4380 
4381  /* free */
4382  if( !SCIPdialogHasEntry(root, "free") )
4383  {
4384  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4385  NULL,
4386  SCIPdialogExecFree, NULL, NULL,
4387  "free", "free current problem from memory", FALSE, NULL) );
4388  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4389  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4390  }
4391 
4392  /* help */
4393  if( !SCIPdialogHasEntry(root, "help") )
4394  {
4395  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4396  NULL,
4397  SCIPdialogExecHelp, NULL, NULL,
4398  "help", "display this help", FALSE, NULL) );
4399  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4400  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4401  }
4402 
4403  /* newstart */
4404  if( !SCIPdialogHasEntry(root, "newstart") )
4405  {
4406  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4407  NULL,
4408  SCIPdialogExecNewstart, NULL, NULL,
4409  "newstart", "reset branch and bound tree to start again from root", FALSE, NULL) );
4410  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4411  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4412  }
4413 
4414 #ifndef NDEBUG
4415  /* transform problem (for debugging) */
4416  if( !SCIPdialogHasEntry(root, "transform") )
4417  {
4418  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4419  NULL,
4420  SCIPdialogExecTransform, NULL, NULL,
4421  "transform", "transforms problem from original state", FALSE, NULL) );
4422  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4423  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4424  }
4425 #endif
4426 
4427  /* optimize */
4428  if( !SCIPdialogHasEntry(root, "optimize") )
4429  {
4430  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4431  NULL,
4432  SCIPdialogExecOptimize, NULL, NULL,
4433  "optimize", "solve the problem", FALSE, NULL) );
4434  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4435  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4436  }
4437 
4438  /* optimize */
4439  if( !SCIPdialogHasEntry(root, "concurrentopt") )
4440  {
4441  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4442  NULL,
4443  SCIPdialogExecConcurrentOpt, NULL, NULL,
4444  "concurrentopt", "solve the problem using concurrent solvers", FALSE, NULL) );
4445  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4446  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4447  }
4448 
4449  /* presolve */
4450  if( !SCIPdialogHasEntry(root, "presolve") )
4451  {
4452  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4453  NULL,
4454  SCIPdialogExecPresolve, NULL, NULL,
4455  "presolve", "solve the problem, but stop after presolving stage", FALSE, NULL) );
4456  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4457  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4458  }
4459 
4460  /* quit */
4461  if( !SCIPdialogHasEntry(root, "quit") )
4462  {
4463  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4464  NULL,
4465  SCIPdialogExecQuit, NULL, NULL,
4466  "quit", "leave SCIP", FALSE, NULL) );
4467  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4468  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4469  }
4470 
4471  /* read */
4472  if( !SCIPdialogHasEntry(root, "read") )
4473  {
4474  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4475  NULL,
4476  SCIPdialogExecRead, NULL, NULL,
4477  "read", "read a problem", FALSE, NULL) );
4478  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4479  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4480  }
4481 
4482  /* set */
4484 
4485  /* fix */
4487 
4488  /* write */
4489  if( !SCIPdialogHasEntry(root, "write") )
4490  {
4491  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4492  NULL,
4493  SCIPdialogExecMenu, NULL, NULL,
4494  "write", "write information to file", TRUE, NULL) );
4495  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
4496  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4497  }
4498  if( SCIPdialogFindEntry(root, "write", &submenu) != 1 )
4499  {
4500  SCIPerrorMessage("write sub menu not found\n");
4501  return SCIP_PLUGINNOTFOUND;
4502  }
4503 
4504  /* write LP */
4505  if( !SCIPdialogHasEntry(submenu, "lp") )
4506  {
4507  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4508  NULL,
4509  SCIPdialogExecWriteLp, NULL, NULL,
4510  "lp", "write current node LP relaxation in LP format to file", FALSE, NULL) );
4511  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4512  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4513  }
4514 
4515  /* write MIP */
4516  if( !SCIPdialogHasEntry(submenu, "mip") )
4517  {
4518  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4519  NULL,
4520  SCIPdialogExecWriteMip, NULL, NULL,
4521  "mip", "write current node MIP relaxation in LP format to file", FALSE, NULL) );
4522  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4523  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4524  }
4525 
4526  /* write NLP */
4527  if( !SCIPdialogHasEntry(submenu, "nlp") )
4528  {
4529  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4530  NULL,
4531  SCIPdialogExecWriteNlp, NULL, NULL,
4532  "nlp", "write current node NLP relaxation to file", FALSE, NULL) );
4533  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4534  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4535  }
4536 
4537  /* write problem */
4538  if( !SCIPdialogHasEntry(submenu, "problem") )
4539  {
4540  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4541  NULL,
4542  SCIPdialogExecWriteProblem, NULL, NULL,
4543  "problem",
4544  "write original problem to file (format is given by file extension, e.g., orig.{lp,rlp,cip,mps})",
4545  FALSE, NULL) );
4546  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4547  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4548  }
4549 
4550  /* write generic problem */
4551  if( !SCIPdialogHasEntry(submenu, "genproblem") )
4552  {
4553  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4554  NULL,
4555  SCIPdialogExecWriteGenProblem, NULL, NULL,
4556  "genproblem",
4557  "write original problem with generic names to file (format is given by file extension, e.g., orig.{lp,rlp,cip,mps})",
4558  FALSE, NULL) );
4559  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4560  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4561  }
4562 
4563  /* write solution */
4564  if( !SCIPdialogHasEntry(submenu, "solution") )
4565  {
4566  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4567  NULL,
4568  SCIPdialogExecWriteSolution, NULL, NULL,
4569  "solution", "write best primal solution to file", FALSE, NULL) );
4570  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4571  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4572  }
4573 
4574  /* write finite solution */
4575  if( !SCIPdialogHasEntry(submenu, "finitesolution") )
4576  {
4577  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4578  NULL,
4579  SCIPdialogExecWriteFiniteSolution, NULL, NULL,
4580  "finitesolution", "write best primal solution to file (try to make solution values finite, first)", FALSE, NULL) );
4581  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4582  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4583  }
4584 
4585  /* write mip start */
4586  if( !SCIPdialogHasEntry(submenu, "mipstart") )
4587  {
4588  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4589  NULL,
4590  SCIPdialogExecWriteMIPStart, NULL, NULL,
4591  "mipstart", "write mip start to file", FALSE, NULL) );
4592  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4593  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4594  }
4595 
4596  /* write statistics */
4597  if( !SCIPdialogHasEntry(submenu, "statistics") )
4598  {
4599  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4600  NULL,
4601  SCIPdialogExecWriteStatistics, NULL, NULL,
4602  "statistics", "write statistics to file", FALSE, NULL) );
4603  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4604  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4605  }
4606 
4607  /* write transproblem */
4608  if( !SCIPdialogHasEntry(submenu, "transproblem") )
4609  {
4610  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4611  NULL,
4612  SCIPdialogExecWriteTransproblem, NULL, NULL,
4613  "transproblem",
4614  "write current node transformed problem to file (format is given by file extension, e.g., trans.{lp,rlp,cip,mps})",
4615  FALSE, NULL) );
4616  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4617  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4618  }
4619 
4620  /* write transproblem with generic names */
4621  if( !SCIPdialogHasEntry(submenu, "gentransproblem") )
4622  {
4623  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4624  NULL,
4625  SCIPdialogExecWriteGenTransproblem, NULL, NULL,
4626  "gentransproblem",
4627  "write current node transformed problem with generic names to file (format is given by file extension, e.g., trans.{lp,rlp,cip,mps})",
4628  FALSE, NULL) );
4629  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4630  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4631  }
4632 
4633  /* write cliquegraph */
4634  if( !SCIPdialogHasEntry(submenu, "cliquegraph") )
4635  {
4636  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4637  NULL,
4638  SCIPdialogExecCliquegraph, NULL, NULL,
4639  "cliquegraph",
4640  "write graph of cliques and implications of binary variables to GML file (better call after presolving)",
4641  FALSE, NULL) );
4642  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4643  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4644  }
4645 
4646  /* write command line history */
4647  if( !SCIPdialogHasEntry(submenu, "history") )
4648  {
4649  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4650  NULL,
4651  SCIPdialogExecWriteCommandHistory, NULL, NULL,
4652  "history",
4653  "write command line history to a file (only works if SCIP was compiled with 'readline')",
4654  FALSE, NULL) );
4655  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4656  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4657  }
4658 
4659  /* validate solve */
4660  if( !SCIPdialogHasEntry(root, "validatesolve") )
4661  {
4662  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, SCIPdialogExecValidateSolve, NULL, NULL,
4663  "validatesolve",
4664  "validate the solution against external objective reference interval",
4665  FALSE, NULL) );
4666  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4667  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4668  }
4669 
4670  return SCIP_OKAY;
4671 }
4672 
4673 /** if a '/' occurs in the parameter's name, adds a sub menu dialog to the given menu and inserts the parameter dialog
4674  * recursively in the sub menu; if no '/' occurs in the name, adds a parameter change dialog into the given dialog menu
4675  */
4676 static
4678  SCIP* scip, /**< SCIP data structure */
4679  SCIP_DIALOG* menu, /**< dialog menu to insert the parameter into */
4680  SCIP_PARAM* param, /**< parameter to add a dialog for */
4681  char* paramname /**< parameter name to parse */
4682  )
4683 {
4684  char* slash;
4685  char* dirname;
4686 
4687  assert(paramname != NULL);
4688 
4689  /* check for a '/' */
4690  slash = strchr(paramname, '/');
4691 
4692  if( slash == NULL )
4693  {
4694  /* check, if the corresponding dialog already exists */
4695  if( !SCIPdialogHasEntry(menu, paramname) )
4696  {
4697  SCIP_DIALOG* paramdialog;
4698 
4699  if( SCIPparamIsAdvanced(param) )
4700  {
4701  SCIP_DIALOG* advmenu;
4702 
4703  if( !SCIPdialogHasEntry(menu, "advanced") )
4704  {
4705  /* if not yet existing, create an advanced sub menu */
4706  char desc[SCIP_MAXSTRLEN];
4707 
4708  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "advanced parameters");
4709  SCIP_CALL( SCIPincludeDialog(scip, &advmenu,
4710  NULL,
4711  SCIPdialogExecMenu, NULL, NULL, "advanced", desc, TRUE, NULL) );
4712  SCIP_CALL( SCIPaddDialogEntry(scip, menu, advmenu) );
4713  SCIP_CALL( SCIPreleaseDialog(scip, &advmenu) );
4714  }
4715 
4716  /* find the corresponding sub menu */
4717  (void)SCIPdialogFindEntry(menu, "advanced", &advmenu);
4718  if( advmenu == NULL )
4719  {
4720  SCIPerrorMessage("dialog sub menu not found\n");
4721  return SCIP_PLUGINNOTFOUND;
4722  }
4723 
4724  if( !SCIPdialogHasEntry(advmenu, paramname) )
4725  {
4726  /* create a parameter change dialog */
4727  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4728  NULL,
4729  SCIPdialogExecSetParam, SCIPdialogDescSetParam, NULL,
4730  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4731  SCIP_CALL( SCIPaddDialogEntry(scip, advmenu, paramdialog) );
4732  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4733  }
4734  }
4735  else
4736  {
4737  /* create a parameter change dialog */
4738  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4739  NULL,
4740  SCIPdialogExecSetParam, SCIPdialogDescSetParam, NULL,
4741  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4742  SCIP_CALL( SCIPaddDialogEntry(scip, menu, paramdialog) );
4743  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4744  }
4745  }
4746  }
4747  else
4748  {
4749  SCIP_DIALOG* submenu;
4750 
4751  /* split the parameter name into dirname and parameter name */
4752  dirname = paramname;
4753  paramname = slash+1;
4754  *slash = '\0';
4755 
4756  /* if not yet existing, create a corresponding sub menu */
4757  if( !SCIPdialogHasEntry(menu, dirname) )
4758  {
4759  char desc[SCIP_MAXSTRLEN];
4760 
4761  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "parameters for <%s>", dirname);
4762  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4763  NULL,
4764  SCIPdialogExecMenu, NULL, NULL, dirname, desc, TRUE, NULL) );
4765  SCIP_CALL( SCIPaddDialogEntry(scip, menu, submenu) );
4766  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4767  }
4768 
4769  /* find the corresponding sub menu */
4770  (void)SCIPdialogFindEntry(menu, dirname, &submenu);
4771  if( submenu == NULL )
4772  {
4773  SCIPerrorMessage("dialog sub menu not found\n");
4774  return SCIP_PLUGINNOTFOUND;
4775  }
4776 
4777  /* recursively call add parameter method */
4778  SCIP_CALL( addSetParamDialog(scip, submenu, param, paramname) );
4779  }
4780 
4781  return SCIP_OKAY;
4782 }
4783 
4784 /** if a '/' occurs in the parameter's name, adds a sub menu dialog to the given menu and inserts the parameter dialog
4785  * recursively in the sub menu; if no '/' occurs in the name, adds a fix parameter dialog into the given dialog menu
4786  */
4787 static
4789  SCIP* scip, /**< SCIP data structure */
4790  SCIP_DIALOG* menu, /**< dialog menu to insert the parameter into */
4791  SCIP_PARAM* param, /**< parameter to add a dialog for */
4792  char* paramname /**< parameter name to parse */
4793  )
4794 {
4795  char* slash;
4796  char* dirname;
4797 
4798  assert(paramname != NULL);
4799 
4800  /* check for a '/' */
4801  slash = strchr(paramname, '/');
4802 
4803  if( slash == NULL )
4804  {
4805  /* check, if the corresponding dialog already exists */
4806  if( !SCIPdialogHasEntry(menu, paramname) )
4807  {
4808  SCIP_DIALOG* paramdialog;
4809 
4810  if( SCIPparamIsAdvanced(param) )
4811  {
4812  SCIP_DIALOG* advmenu;
4813 
4814  if( !SCIPdialogHasEntry(menu, "advanced") )
4815  {
4816  /* if not yet existing, create an advanced sub menu */
4817  char desc[SCIP_MAXSTRLEN];
4818 
4819  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "advanced parameters");
4820  SCIP_CALL( SCIPincludeDialog(scip, &advmenu,
4821  NULL,
4822  SCIPdialogExecMenu, NULL, NULL, "advanced", desc, TRUE, NULL) );
4823  SCIP_CALL( SCIPaddDialogEntry(scip, menu, advmenu) );
4824  SCIP_CALL( SCIPreleaseDialog(scip, &advmenu) );
4825  }
4826 
4827  /* find the corresponding sub menu */
4828  (void)SCIPdialogFindEntry(menu, "advanced", &advmenu);
4829  if( advmenu == NULL )
4830  {
4831  SCIPerrorMessage("dialog sub menu not found\n");
4832  return SCIP_PLUGINNOTFOUND;
4833  }
4834 
4835  if( !SCIPdialogHasEntry(advmenu, paramname) )
4836  {
4837  /* create a fix parameter dialog */
4838  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4839  NULL,
4840  SCIPdialogExecFixParam, SCIPdialogDescFixParam, NULL,
4841  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4842  SCIP_CALL( SCIPaddDialogEntry(scip, advmenu, paramdialog) );
4843  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4844  }
4845  }
4846  else
4847  {
4848  /* create a fix parameter dialog */
4849  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4850  NULL,
4851  SCIPdialogExecFixParam, SCIPdialogDescFixParam, NULL,
4852  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4853  SCIP_CALL( SCIPaddDialogEntry(scip, menu, paramdialog) );
4854  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4855  }
4856  }
4857  }
4858  else
4859  {
4860  SCIP_DIALOG* submenu;
4861 
4862  /* split the parameter name into dirname and parameter name */
4863  dirname = paramname;
4864  paramname = slash+1;
4865  *slash = '\0';
4866 
4867  /* if not yet existing, create a corresponding sub menu */
4868  if( !SCIPdialogHasEntry(menu, dirname) )
4869  {
4870  char desc[SCIP_MAXSTRLEN];
4871 
4872  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "parameters for <%s>", dirname);
4873  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4874  NULL,
4875  SCIPdialogExecMenu, NULL, NULL, dirname, desc, TRUE, NULL) );
4876  SCIP_CALL( SCIPaddDialogEntry(scip, menu, submenu) );
4877  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4878  }
4879 
4880  /* find the corresponding sub menu */
4881  (void)SCIPdialogFindEntry(menu, dirname, &submenu);
4882  if( submenu == NULL )
4883  {
4884  SCIPerrorMessage("dialog sub menu not found\n");
4885  return SCIP_PLUGINNOTFOUND;
4886  }
4887 
4888  /* recursively call add parameter method */
4889  SCIP_CALL( addFixParamDialog(scip, submenu, param, paramname) );
4890  }
4891 
4892  return SCIP_OKAY;
4893 }
4894 
4895 /** create a "emphasis" sub menu */
4896 static
4898  SCIP* scip, /**< SCIP data structure */
4899  SCIP_DIALOG* root, /**< the menu to add the empty sub menu */
4900  SCIP_DIALOG** submenu /**< pointer to store the created emphasis sub menu */
4901  )
4902 {
4903  if( !SCIPdialogHasEntry(root, "emphasis") )
4904  {
4905  SCIP_CALL( SCIPincludeDialog(scip, submenu,
4906  NULL, SCIPdialogExecMenu, NULL, NULL,
4907  "emphasis", "predefined parameter settings", TRUE, NULL) );
4908  SCIP_CALL( SCIPaddDialogEntry(scip, root, *submenu) );
4909  SCIP_CALL( SCIPreleaseDialog(scip, submenu) );
4910  }
4911  else if( SCIPdialogFindEntry(root, "emphasis", submenu) != 1 )
4912  {
4913  SCIPerrorMessage("emphasis sub menu not found\n");
4914  return SCIP_PLUGINNOTFOUND;
4915  }
4916 
4917  assert(*submenu != NULL);
4918 
4919  return SCIP_OKAY;
4920 }
4921 
4922 
4923 /** includes or updates the "set" menu for each available parameter setting */
4925  SCIP* scip /**< SCIP data structure */
4926  )
4927 {
4928  SCIP_DIALOG* root;
4929  SCIP_DIALOG* setmenu;
4930  SCIP_DIALOG* emphasismenu;
4931  SCIP_DIALOG* submenu;
4932  SCIP_DIALOG* dialog;
4933  SCIP_PARAM** params;
4934  char* paramname;
4935  int nparams;
4936  int i;
4937 
4938  SCIP_BRANCHRULE** branchrules;
4939  SCIP_CONFLICTHDLR** conflicthdlrs;
4940  SCIP_CONSHDLR** conshdlrs;
4941  SCIP_DISP** disps;
4942  SCIP_HEUR** heurs;
4943  SCIP_NLPI** nlpis;
4944  SCIP_NODESEL** nodesels;
4945  SCIP_PRESOL** presols;
4946  SCIP_PRICER** pricers;
4947  SCIP_READER** readers;
4948  SCIP_SEPA** sepas;
4949  int nbranchrules;
4950  int nconflicthdlrs;
4951  int nconshdlrs;
4952  int ndisps;
4953  int nheurs;
4954  int nnlpis;
4955  int nnodesels;
4956  int npresols;
4957  int npricers;
4958  int nreaders;
4959  int nsepas;
4960 
4961  /* get root dialog */
4962  root = SCIPgetRootDialog(scip);
4963  if( root == NULL )
4964  {
4965  SCIPerrorMessage("root dialog not found\n");
4966  return SCIP_PLUGINNOTFOUND;
4967  }
4968 
4969  /* find (or create) the "set" menu of the root dialog */
4970  if( !SCIPdialogHasEntry(root, "set") )
4971  {
4972  SCIP_CALL( SCIPincludeDialog(scip, &setmenu,
4973  NULL, SCIPdialogExecMenu, NULL, NULL,
4974  "set", "load/save/change parameters", TRUE, NULL) );
4975  SCIP_CALL( SCIPaddDialogEntry(scip, root, setmenu) );
4976  SCIP_CALL( SCIPreleaseDialog(scip, &setmenu) );
4977  }
4978  if( SCIPdialogFindEntry(root, "set", &setmenu) != 1 )
4979  {
4980  SCIPerrorMessage("set sub menu not found\n");
4981  return SCIP_PLUGINNOTFOUND;
4982  }
4983 
4984  /* set default */
4985  if( !SCIPdialogHasEntry(setmenu,