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