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