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