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-2018 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  if ( nactivebenders == 1 || SCIPstrToIntValue(idxstr, &idx, &endstr) )
1510  {
1511  int nsubproblems;
1512 
1513  if ( idx < 0 || idx >= nactivebenders)
1514  {
1515  SCIPdialogMessage(scip, NULL, "Decomposition index out of bounds [0-%d].\n", nactivebenders-1);
1516  return SCIP_OKAY;
1517  }
1518 
1519  nsubproblems = SCIPbendersGetNSubproblems(benders[idx]);
1520 
1521  /* if there is only one subproblem, then there is no need to ask for a prompt */
1522  if( nsubproblems > 1 )
1523  {
1524  /* parse subproblem number */
1525  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN-1, "index of subproblem [0-%d] or -1 for all: ", nsubproblems-1);
1526 
1527  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &idxstr, &endoffile) );
1528 
1529  if( endoffile )
1530  {
1531  *nextdialog = NULL;
1532  return SCIP_OKAY;
1533  }
1534  }
1535  else
1536  subidx = 0;
1537 
1538  if ( nsubproblems == 1 || SCIPstrToIntValue(idxstr, &subidx, &endstr) )
1539  {
1540  SCIP* subproblem;
1541  int nsubdisplay;
1542 
1543  if ( subidx < -1 || subidx >= nsubproblems)
1544  {
1545  SCIPdialogMessage(scip, NULL, "Subproblem index out of bounds [0-%d] or -1.\n", nsubproblems-1);
1546  return SCIP_OKAY;
1547  }
1548 
1549  if( subidx == -1 )
1550  nsubdisplay = nsubproblems;
1551  else
1552  nsubdisplay = 1;
1553 
1554  for( i = 0; i < nsubdisplay; i++ )
1555  {
1556  if( nsubdisplay > 1 )
1557  subidx = i;
1558 
1559  subproblem = SCIPbendersSubproblem(benders[idx], subidx);
1560  assert(subproblem != NULL);
1561 
1562  if( SCIPgetStage(subproblem) >= SCIP_STAGE_PROBLEM )
1563  {
1564  SCIPdialogMessage(scip, NULL, "\n");
1565  SCIPdialogMessage(scip, NULL, "Subproblem %d\n", subidx);
1566  SCIP_CALL( SCIPprintOrigProblem(subproblem, NULL, "cip", FALSE) );
1567  SCIPdialogMessage(scip, NULL, "\n");
1568  }
1569  else
1570  SCIPdialogMessage(scip, NULL, "no problem available\n");
1571  }
1572  }
1573  }
1574 
1575  SCIPdialogMessage(scip, NULL, "\n");
1576 
1577  return SCIP_OKAY;
1578 }
1579 
1580 /** dialog execution method for the display subsolution command */
1581 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplaySubSolution)
1582 { /*lint --e{715}*/
1583  SCIP_BENDERS** benders;
1584  char prompt[SCIP_MAXSTRLEN];
1585  int nactivebenders;
1586  int nbenders;
1587  SCIP_Bool endoffile;
1588  SCIP_Bool printzeros;
1589  char* idxstr;
1590  char* endstr;
1591  int count;
1592  int idx;
1593  int subidx;
1594  int i;
1595 
1596  idxstr = NULL;
1597  idx = 0;
1598  subidx = 0;
1599 
1600  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1601 
1602  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1603 
1604  SCIPdialogMessage(scip, NULL, "\n");
1605 
1607  {
1608  SCIPdialogMessage(scip, NULL, "problem must be transformed to display subproblems\n\n");
1609  return SCIP_OKAY;
1610  }
1611 
1612  /* if there are no active Benders' decompositions, then there are no subproblem */
1613  nactivebenders = SCIPgetNActiveBenders(scip);
1614  if( nactivebenders == 0 )
1615  {
1616  SCIPdialogMessage(scip, NULL, "no active Benders' decomposition\n\n");
1617  return SCIP_OKAY;
1618  }
1619 
1620  nbenders = SCIPgetNBenders(scip);
1621  benders = SCIPgetBenders(scip);
1622 
1623  /* if there is only one active Benders decomposition, then there is no need to display the list of Benders */
1624  if( nactivebenders > 1 )
1625  {
1626  SCIPdialogMessage(scip, NULL, "Active Benders' decomposition:\n");
1627  count = 0;
1628  for( i = 0; i < nbenders; i++ )
1629  {
1630  if( SCIPbendersIsActive(benders[i]) )
1631  {
1632  assert(i >= count);
1633  benders[count] = benders[i];
1634  SCIPdialogMessage(scip, NULL, " %d: %s\n", count, SCIPbendersGetName(benders[count]));
1635  count++;
1636  }
1637  }
1638 
1639  /* parse decomposition number */
1640  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN-1, "index of decomposition [0-%d]: ", nactivebenders-1);
1641 
1642  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &idxstr, &endoffile) );
1643 
1644  if( endoffile )
1645  {
1646  *nextdialog = NULL;
1647  return SCIP_OKAY;
1648  }
1649  }
1650  else
1651  idx = 0;
1652 
1653  if ( nactivebenders == 1 || SCIPstrToIntValue(idxstr, &idx, &endstr) )
1654  {
1655  int nsubproblems;
1656 
1657  SCIP_CALL( SCIPgetBoolParam(scip, "write/printzeros", &printzeros) );
1658 
1659  if ( idx < 0 || idx >= nactivebenders)
1660  {
1661  SCIPdialogMessage(scip, NULL, "Decomposition index out of bounds [0-%d].\n", nactivebenders-1);
1662  return SCIP_OKAY;
1663  }
1664 
1665  nsubproblems = SCIPbendersGetNSubproblems(benders[idx]);
1666 
1667  /* if there is only one subproblem, then there is no need to ask for a prompt */
1668  if( nsubproblems > 1 )
1669  {
1670  /* parse subproblem number */
1671  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN-1, "index of subproblem [0-%d] or -1 for all: ", nsubproblems-1);
1672 
1673  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &idxstr, &endoffile) );
1674 
1675  if( endoffile )
1676  {
1677  *nextdialog = NULL;
1678  return SCIP_OKAY;
1679  }
1680  }
1681  else
1682  subidx = 0;
1683 
1684  if ( nsubproblems == 1 || SCIPstrToIntValue(idxstr, &subidx, &endstr) )
1685  {
1686  SCIP* subproblem;
1687  SCIP_SOL* bestsol;
1688  int nsubdisplay;
1689  SCIP_Bool infeasible;
1690 
1691  if ( subidx < -1 || subidx >= nsubproblems)
1692  {
1693  SCIPdialogMessage(scip, NULL, "Subproblem index out of bounds [0-%d] or -1.\n", nsubproblems-1);
1694  return SCIP_OKAY;
1695  }
1696 
1697  bestsol = SCIPgetBestSol(scip);
1698 
1699  if( subidx == -1 )
1700  nsubdisplay = nsubproblems;
1701  else
1702  nsubdisplay = 1;
1703 
1704  for( i = 0; i < nsubdisplay; i++ )
1705  {
1706  if( nsubdisplay > 1 )
1707  subidx = i;
1708 
1709  subproblem = SCIPbendersSubproblem(benders[idx], subidx);
1710  assert(subproblem != NULL);
1711 
1712  if( SCIPgetStage(subproblem) >= SCIP_STAGE_PROBLEM )
1713  {
1714  /* setting up the subproblem with the best solution to the master problem */
1715  SCIP_CALL( SCIPsetupBendersSubproblem(scip, benders[idx], bestsol, subidx) );
1716 
1717  /* solving the subproblem using the best solution to the master problem */
1718  SCIP_CALL( SCIPsolveBendersSubproblem(scip, benders[idx], bestsol, subidx, &infeasible,
1720 
1721  if( infeasible )
1722  SCIPdialogMessage(scip, NULL, "subproblem %d is infeasible.\n", subidx);
1723  else
1724  {
1725  SCIPdialogMessage(scip, NULL, "\n");
1726  SCIPdialogMessage(scip, NULL, "Subproblem %d\n", subidx);
1727  if( SCIPbendersSubproblemIsConvex(benders[idx], subidx) )
1728  SCIP_CALL( SCIPprintSol(subproblem, NULL, NULL, printzeros) );
1729  else
1730  SCIP_CALL( SCIPprintBestSol(subproblem, NULL, printzeros) );
1731  SCIPdialogMessage(scip, NULL, "\n");
1732  }
1733 
1734  /* freeing the subproblem */
1735  SCIP_CALL( SCIPfreeBendersSubproblem(scip, benders[idx], subidx) );
1736  }
1737  else
1738  SCIPdialogMessage(scip, NULL, "no problem available\n");
1739  }
1740  }
1741  }
1742 
1743  SCIPdialogMessage(scip, NULL, "\n");
1744 
1745  return SCIP_OKAY;
1746 }
1747 
1748 /** dialog execution method for the display statistics command */
1749 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayStatistics)
1750 { /*lint --e{715}*/
1751  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1752 
1753  SCIPdialogMessage(scip, NULL, "\n");
1755  SCIPdialogMessage(scip, NULL, "\n");
1756 
1757  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1758 
1759  return SCIP_OKAY;
1760 }
1761 
1762 /** dialog execution method for the display reoptstatistics command */
1763 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayReoptStatistics)
1764 { /*lint --e{715}*/
1765  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1766 
1767  SCIPdialogMessage(scip, NULL, "\n");
1769  SCIPdialogMessage(scip, NULL, "\n");
1770 
1771  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1772 
1773  return SCIP_OKAY;
1774 }
1775 
1776 /** dialog execution method for the display compression command */
1777 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayCompression)
1778 { /*lint --e{715}*/
1779  SCIP_COMPR** comprs;
1780  SCIP_COMPR** sorted;
1781  int ncomprs;
1782  int i;
1783 
1784  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1785 
1786  comprs = SCIPgetComprs(scip);
1787  ncomprs = SCIPgetNCompr(scip);
1788 
1789  /* copy compression array into temporary memory for sorting */
1790  SCIP_CALL( SCIPduplicateBufferArray(scip, &sorted, comprs, ncomprs) );
1791 
1792  /* sort the compression t */
1793  SCIPsortPtr((void**)sorted, SCIPcomprComp, ncomprs);
1794 
1795  /* display sorted list of branching rules */
1796  SCIPdialogMessage(scip, NULL, "\n");
1797  SCIPdialogMessage(scip, NULL, " compression method priority minnodes description\n");
1798  SCIPdialogMessage(scip, NULL, " ------------------ -------- -------- -----------\n");
1799  for( i = 0; i < ncomprs; ++i )
1800  {
1801  SCIPdialogMessage(scip, NULL, " %-24s ", SCIPcomprGetName(sorted[i]));
1802  if( strlen(SCIPcomprGetName(sorted[i])) > 24 )
1803  SCIPdialogMessage(scip, NULL, "\n %24s ", "-->");
1804  SCIPdialogMessage(scip, NULL, "%8d %8d ", SCIPcomprGetPriority(sorted[i]), SCIPcomprGetMinNodes(sorted[i]));
1805  SCIPdialogMessage(scip, NULL, "%s", SCIPcomprGetDesc(sorted[i]));
1806  SCIPdialogMessage(scip, NULL, "\n");
1807  }
1808  SCIPdialogMessage(scip, NULL, "\n");
1809 
1810  /* free temporary memory */
1811  SCIPfreeBufferArray(scip, &sorted);
1812 
1813  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1814 
1815  return SCIP_OKAY;
1816 }
1817 
1818 /** dialog execution method for the display transproblem command */
1819 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayTransproblem)
1820 { /*lint --e{715}*/
1821  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1822 
1823  SCIPdialogMessage(scip, NULL, "\n");
1825  {
1827  }
1828  else
1829  SCIPdialogMessage(scip, NULL, "no transformed problem available\n");
1830 
1831  SCIPdialogMessage(scip, NULL, "\n");
1832 
1833  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1834 
1835  return SCIP_OKAY;
1836 }
1837 
1838 /** dialog execution method for the display value command */
1839 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayValue)
1840 { /*lint --e{715}*/
1841  SCIP_SOL* sol;
1842  SCIP_VAR* var;
1843  char* varname;
1844  SCIP_Real solval;
1845  SCIP_Bool endoffile;
1846 
1847  SCIPdialogMessage(scip, NULL, "\n");
1848 
1850  sol = SCIPgetBestSol(scip);
1851  else
1852  sol = NULL;
1853 
1854  if( sol == NULL )
1855  {
1856  SCIPdialogMessage(scip, NULL, "no feasible solution available\n");
1857  SCIPdialoghdlrClearBuffer(dialoghdlr);
1858  }
1859  else
1860  {
1861  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter variable name: ", &varname, &endoffile) );
1862  if( endoffile )
1863  {
1864  *nextdialog = NULL;
1865  return SCIP_OKAY;
1866  }
1867 
1868  if( varname[0] != '\0' )
1869  {
1870  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, varname, TRUE) );
1871 
1872  var = SCIPfindVar(scip, varname);
1873  if( var == NULL )
1874  SCIPdialogMessage(scip, NULL, "variable <%s> not found\n", varname);
1875  else
1876  {
1877  solval = SCIPgetSolVal(scip, sol, var);
1878  SCIPdialogMessage(scip, NULL, "%-32s", SCIPvarGetName(var));
1879  if( SCIPisInfinity(scip, solval) )
1880  SCIPdialogMessage(scip, NULL, " +infinity");
1881  else if( SCIPisInfinity(scip, -solval) )
1882  SCIPdialogMessage(scip, NULL, " -infinity");
1883  else
1884  SCIPdialogMessage(scip, NULL, " %20.15g", solval);
1885  SCIPdialogMessage(scip, NULL, " \t(obj:%.15g)\n", SCIPvarGetObj(var));
1886  }
1887  }
1888  }
1889  SCIPdialogMessage(scip, NULL, "\n");
1890 
1891  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1892 
1893  return SCIP_OKAY;
1894 }
1895 
1896 /** dialog execution method for the display varbranchstatistics command */
1897 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayVarbranchstatistics)
1898 { /*lint --e{715}*/
1899  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1900 
1901  SCIPdialogMessage(scip, NULL, "\n");
1903  SCIPdialogMessage(scip, NULL, "\n");
1904 
1905  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1906 
1907  return SCIP_OKAY;
1908 }
1909 
1910 /** dialog execution method for the display LP solution quality command */
1911 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayLPSolutionQuality)
1912 { /*lint --e{715}*/
1913  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1914 
1915  SCIPdialogMessage(scip, NULL, "\n");
1917  SCIPdialogMessage(scip, NULL, "\n");
1918 
1919  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1920 
1921  return SCIP_OKAY;
1922 }
1923 
1924 /** dialog execution method for the help command */
1925 SCIP_DECL_DIALOGEXEC(SCIPdialogExecHelp)
1926 { /*lint --e{715}*/
1927  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1928 
1929  SCIPdialogMessage(scip, NULL, "\n");
1931  SCIPdialogMessage(scip, NULL, "\n");
1932 
1933  *nextdialog = SCIPdialogGetParent(dialog);
1934 
1935  return SCIP_OKAY;
1936 }
1937 
1938 /** dialog execution method for the display transsolution command */
1939 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayTranssolution)
1940 { /*lint --e{715}*/
1941  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1942 
1943  SCIPdialogMessage(scip, NULL, "\n");
1945  {
1947  {
1948  SCIPdialogMessage(scip, NULL, "best solution exists only in original problem space\n");
1949  }
1950  else
1951  {
1953  }
1954  }
1955  else
1956  SCIPdialogMessage(scip, NULL, "no solution available\n");
1957  SCIPdialogMessage(scip, NULL, "\n");
1958 
1959  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
1960 
1961  return SCIP_OKAY;
1962 }
1963 
1964 /** dialog execution method for the free command */
1965 SCIP_DECL_DIALOGEXEC(SCIPdialogExecFree)
1966 { /*lint --e{715}*/
1967  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1968 
1970 
1971  *nextdialog = SCIPdialogGetParent(dialog);
1972 
1973  return SCIP_OKAY;
1974 }
1975 
1976 /** dialog execution method for the newstart command */
1977 SCIP_DECL_DIALOGEXEC(SCIPdialogExecNewstart)
1978 { /*lint --e{715}*/
1979  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1980 
1982 
1983  *nextdialog = SCIPdialogGetParent(dialog);
1984 
1985  return SCIP_OKAY;
1986 }
1987 
1988 /** dialog execution method for the transform command */
1989 SCIP_DECL_DIALOGEXEC(SCIPdialogExecTransform)
1990 { /*lint --e{715}*/
1991  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
1992 
1993  SCIPdialogMessage(scip, NULL, "\n");
1994  switch( SCIPgetStage(scip) )
1995  {
1996  case SCIP_STAGE_INIT:
1997  SCIPdialogMessage(scip, NULL, "no problem exists\n");
1998  break;
1999 
2000  case SCIP_STAGE_PROBLEM:
2002  break;
2003 
2005  SCIPdialogMessage(scip, NULL, "problem is already transformed\n");
2006  break;
2007 
2010  case SCIP_STAGE_PRESOLVING:
2011  case SCIP_STAGE_PRESOLVED:
2013  case SCIP_STAGE_INITSOLVE:
2014  case SCIP_STAGE_SOLVING:
2015  case SCIP_STAGE_SOLVED:
2016  case SCIP_STAGE_EXITSOLVE:
2017  case SCIP_STAGE_FREETRANS:
2018  case SCIP_STAGE_FREE:
2019  default:
2020  SCIPerrorMessage("invalid SCIP stage\n");
2021  return SCIP_INVALIDCALL;
2022  }
2023  SCIPdialogMessage(scip, NULL, "\n");
2024 
2025  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2026 
2027  return SCIP_OKAY;
2028 }
2029 
2030 /** dialog execution method for the concurrentopt command */
2031 SCIP_DECL_DIALOGEXEC(SCIPdialogExecConcurrentOpt)
2032 { /*lint --e{715}*/
2033  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2034 
2035  SCIPdialogMessage(scip, NULL, "\n");
2036  switch( SCIPgetStage(scip) )
2037  {
2038  case SCIP_STAGE_INIT:
2039  SCIPdialogMessage(scip, NULL, "no problem exists\n");
2040  break;
2041 
2042  case SCIP_STAGE_PROBLEM:
2044  case SCIP_STAGE_PRESOLVING:
2045  case SCIP_STAGE_PRESOLVED:
2046  case SCIP_STAGE_SOLVING:
2048  break;
2049 
2050  case SCIP_STAGE_SOLVED:
2051  SCIPdialogMessage(scip, NULL, "problem is already solved\n");
2052  break;
2053 
2057  case SCIP_STAGE_INITSOLVE:
2058  case SCIP_STAGE_EXITSOLVE:
2059  case SCIP_STAGE_FREETRANS:
2060  case SCIP_STAGE_FREE:
2061  default:
2062  SCIPerrorMessage("invalid SCIP stage\n");
2063  return SCIP_INVALIDCALL;
2064  }
2065  SCIPdialogMessage(scip, NULL, "\n");
2066 
2067  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2068 
2069  return SCIP_OKAY;
2070 }
2071 
2072 /** dialog execution method for the optimize command */
2073 SCIP_DECL_DIALOGEXEC(SCIPdialogExecOptimize)
2074 { /*lint --e{715}*/
2075  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2076 
2077  SCIPdialogMessage(scip, NULL, "\n");
2078  switch( SCIPgetStage(scip) )
2079  {
2080  case SCIP_STAGE_INIT:
2081  SCIPdialogMessage(scip, NULL, "no problem exists\n");
2082  break;
2083 
2084  case SCIP_STAGE_PROBLEM:
2086  case SCIP_STAGE_PRESOLVING:
2087  case SCIP_STAGE_PRESOLVED:
2088  case SCIP_STAGE_SOLVING:
2089  SCIP_CALL( SCIPsolve(scip) );
2090  break;
2091 
2092  case SCIP_STAGE_SOLVED:
2093  SCIPdialogMessage(scip, NULL, "problem is already solved\n");
2094  break;
2095 
2099  case SCIP_STAGE_INITSOLVE:
2100  case SCIP_STAGE_EXITSOLVE:
2101  case SCIP_STAGE_FREETRANS:
2102  case SCIP_STAGE_FREE:
2103  default:
2104  SCIPerrorMessage("invalid SCIP stage\n");
2105  return SCIP_INVALIDCALL;
2106  }
2107  SCIPdialogMessage(scip, NULL, "\n");
2108 
2109  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2110 
2111  return SCIP_OKAY;
2112 }
2113 
2114 /** dialog execution method for the presolve command */
2115 SCIP_DECL_DIALOGEXEC(SCIPdialogExecPresolve)
2116 { /*lint --e{715}*/
2117  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2118 
2119  SCIPdialogMessage(scip, NULL, "\n");
2120  switch( SCIPgetStage(scip) )
2121  {
2122  case SCIP_STAGE_INIT:
2123  SCIPdialogMessage(scip, NULL, "no problem exists\n");
2124  break;
2125 
2126  case SCIP_STAGE_PROBLEM:
2128  case SCIP_STAGE_PRESOLVING:
2130  break;
2131 
2132  case SCIP_STAGE_PRESOLVED:
2133  case SCIP_STAGE_SOLVING:
2134  SCIPdialogMessage(scip, NULL, "problem is already presolved\n");
2135  break;
2136 
2137  case SCIP_STAGE_SOLVED:
2138  SCIPdialogMessage(scip, NULL, "problem is already solved\n");
2139  break;
2140 
2144  case SCIP_STAGE_INITSOLVE:
2145  case SCIP_STAGE_EXITSOLVE:
2146  case SCIP_STAGE_FREETRANS:
2147  case SCIP_STAGE_FREE:
2148  default:
2149  SCIPerrorMessage("invalid SCIP stage\n");
2150  return SCIP_INVALIDCALL;
2151  }
2152  SCIPdialogMessage(scip, NULL, "\n");
2153 
2154  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2155 
2156  return SCIP_OKAY;
2157 }
2158 
2159 /** dialog execution method for the quit command */
2160 SCIP_DECL_DIALOGEXEC(SCIPdialogExecQuit)
2161 { /*lint --e{715}*/
2162  SCIPdialogMessage(scip, NULL, "\n");
2163 
2164  *nextdialog = NULL;
2165 
2166  return SCIP_OKAY;
2167 }
2168 
2169 /** dialog execution method for the read command */
2170 SCIP_DECL_DIALOGEXEC(SCIPdialogExecRead)
2171 { /*lint --e{715}*/
2172  SCIP_RETCODE retcode;
2173  char* filename;
2174  SCIP_Bool endoffile;
2175 
2176  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
2177  if( endoffile )
2178  {
2179  *nextdialog = NULL;
2180  return SCIP_OKAY;
2181  }
2182 
2183  if( filename[0] != '\0' )
2184  {
2185  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
2186 
2187  if( SCIPfileExists(filename) )
2188  {
2189  char* tmpfilename;
2190  char* extension;
2191 
2192  /* copy filename */
2193  SCIP_CALL( SCIPduplicateBufferArray(scip, &tmpfilename, filename, (int)strlen(filename)+1) );
2194  extension = NULL;
2195 
2196  SCIPinfoMessage(scip, NULL, "\n");
2197  SCIPinfoMessage(scip, NULL, "read problem <%s>\n", filename);
2198  SCIPinfoMessage(scip, NULL, "============\n");
2199  SCIPinfoMessage(scip, NULL, "\n");
2200 
2201  do
2202  {
2203  retcode = SCIPreadProb(scip, tmpfilename, extension);
2204  if( retcode == SCIP_READERROR || retcode == SCIP_NOFILE )
2205  {
2206  if( extension == NULL )
2207  SCIPdialogMessage(scip, NULL, "error reading file <%s>\n", tmpfilename);
2208  else
2209  SCIPdialogMessage(scip, NULL, "error reading file <%s> using <%s> file format\n",
2210  tmpfilename, extension);
2211 
2213  break;
2214  }
2215  else if( retcode == SCIP_PLUGINNOTFOUND )
2216  {
2217  /* ask user once for a suitable reader */
2218  if( extension == NULL )
2219  {
2220  SCIPdialogMessage(scip, NULL, "no reader for input file <%s> available\n", tmpfilename);
2221 
2222  SCIPdialogMessage(scip, NULL, "The following readers are available for reading:\n");
2224 
2225  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
2226  "select a suitable reader by extension (or return): ", &extension, &endoffile) );
2227 
2228  if( extension[0] == '\0' )
2229  break;
2230  }
2231  else
2232  {
2233  SCIPdialogMessage(scip, NULL, "no reader for file extension <%s> available\n", extension);
2234  extension = NULL;
2235  }
2236  }
2237  else
2238  {
2239  /* check if an unexpected error occurred during the reading process */
2240  SCIP_CALL( retcode );
2241  break;
2242  }
2243  }
2244  while( extension != NULL );
2245 
2246  /* free buffer array */
2247  SCIPfreeBufferArray(scip, &tmpfilename);
2248  }
2249  else
2250  {
2251  SCIPdialogMessage(scip, NULL, "file <%s> not found\n", filename);
2252  SCIPdialoghdlrClearBuffer(dialoghdlr);
2253  }
2254  }
2255 
2256  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2257 
2258  return SCIP_OKAY;
2259 }
2260 
2261 /** dialog execution method for the set default command */
2262 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetDefault)
2263 { /*lint --e{715}*/
2264  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2265 
2267  SCIPdialogMessage(scip, NULL, "reset parameters to their default values\n");
2268 
2269  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2270 
2271  return SCIP_OKAY;
2272 }
2273 
2274 /** dialog execution method for the set load command */
2275 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetLoad)
2276 { /*lint --e{715}*/
2277  char* filename;
2278  SCIP_Bool endoffile;
2279 
2280  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
2281  if( endoffile )
2282  {
2283  *nextdialog = NULL;
2284  return SCIP_OKAY;
2285  }
2286 
2287  if( filename[0] != '\0' )
2288  {
2289  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
2290 
2291  if( SCIPfileExists(filename) )
2292  {
2293  SCIP_CALL( SCIPreadParams(scip, filename) );
2294  SCIPdialogMessage(scip, NULL, "loaded parameter file <%s>\n", filename);
2295  }
2296  else
2297  {
2298  SCIPdialogMessage(scip, NULL, "file <%s> not found\n", filename);
2299  SCIPdialoghdlrClearBuffer(dialoghdlr);
2300  }
2301  }
2302 
2303  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2304 
2305  return SCIP_OKAY;
2306 }
2307 
2308 /** dialog execution method for the set save command */
2309 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSave)
2310 { /*lint --e{715}*/
2311  char* filename;
2312  SCIP_Bool endoffile;
2313 
2314  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
2315  if( endoffile )
2316  {
2317  *nextdialog = NULL;
2318  return SCIP_OKAY;
2319  }
2320 
2321  if( filename[0] != '\0' )
2322  {
2323  SCIP_RETCODE retcode;
2324 
2325  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
2326 
2327  retcode = SCIPwriteParams(scip, filename, TRUE, FALSE);
2328 
2329  if( retcode == SCIP_FILECREATEERROR )
2330  {
2331  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
2332  }
2333  else
2334  {
2335  SCIP_CALL( retcode );
2336  SCIPdialogMessage(scip, NULL, "saved parameter file <%s>\n", filename);
2337  }
2338  }
2339 
2340  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2341 
2342  return SCIP_OKAY;
2343 }
2344 
2345 /** dialog execution method for the set diffsave command */
2346 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetDiffsave)
2347 { /*lint --e{715}*/
2348  char* filename;
2349  SCIP_Bool endoffile;
2350 
2351  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
2352  if( endoffile )
2353  {
2354  *nextdialog = NULL;
2355  return SCIP_OKAY;
2356  }
2357 
2358  if( filename[0] != '\0' )
2359  {
2360  SCIP_RETCODE retcode;
2361 
2362  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
2363 
2364  retcode = SCIPwriteParams(scip, filename, TRUE, TRUE);
2365 
2366  if( retcode == SCIP_FILECREATEERROR )
2367  {
2368  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
2369  }
2370  else
2371  {
2372  SCIP_CALL( retcode );
2373  SCIPdialogMessage(scip, NULL, "saved non-default parameter settings to file <%s>\n", filename);
2374  }
2375  }
2376 
2377  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2378 
2379  return SCIP_OKAY;
2380 }
2381 
2382 /** dialog execution method for the set parameter command */
2383 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetParam)
2384 { /*lint --e{715}*/
2385  SCIP_PARAM* param;
2386  char prompt[SCIP_MAXSTRLEN];
2387  char* valuestr;
2388  SCIP_Bool boolval;
2389  int intval;
2390  SCIP_Longint longintval;
2391  SCIP_Real realval;
2392  char charval;
2393  SCIP_Bool endoffile;
2394  SCIP_Bool error;
2395 
2396  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2397 
2398  /* get the parameter to set */
2399  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
2400 
2401  /* depending on the parameter type, request a user input */
2402  switch( SCIPparamGetType(param) )
2403  {
2404  case SCIP_PARAMTYPE_BOOL:
2405  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %s, new value (TRUE/FALSE): ",
2406  SCIPparamGetBool(param) ? "TRUE" : "FALSE");
2407  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2408  if( endoffile )
2409  {
2410  *nextdialog = NULL;
2411  return SCIP_OKAY;
2412  }
2413  if( valuestr[0] == '\0' )
2414  return SCIP_OKAY;
2415 
2416  boolval = parseBoolValue(scip, valuestr, &error);
2417 
2418  if( error )
2419  {
2420  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for bool parameter <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
2421  valuestr, SCIPparamGetName(param));
2422  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2423  }
2424  else
2425  {
2426  assert(SCIPisBoolParamValid(scip, param, boolval));
2427 
2428  SCIP_CALL( SCIPchgBoolParam(scip, param, boolval) );
2429  SCIPdialogMessage(scip, NULL, "%s = %s\n", SCIPparamGetName(param), boolval ? "TRUE" : "FALSE");
2430  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, boolval ? "TRUE" : "FALSE", TRUE) );
2431  }
2432 
2433  break;
2434 
2435  case SCIP_PARAMTYPE_INT:
2436  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %d, new value [%d,%d]: ",
2437  SCIPparamGetInt(param), SCIPparamGetIntMin(param), SCIPparamGetIntMax(param));
2438  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2439  if( endoffile )
2440  {
2441  *nextdialog = NULL;
2442  return SCIP_OKAY;
2443  }
2444  if( valuestr[0] == '\0' )
2445  return SCIP_OKAY;
2446 
2447  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2448 
2449  if( sscanf(valuestr, "%d", &intval) != 1 || !SCIPisIntParamValid(scip, param, intval) )
2450  {
2451  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for int parameter <%s>. Must be integral in range [%d,%d].\n\n",
2452  valuestr, SCIPparamGetName(param), SCIPparamGetIntMin(param), SCIPparamGetIntMax(param));
2453  }
2454  else
2455  {
2456  SCIP_CALL( SCIPchgIntParam(scip, param, intval) );
2457  SCIPdialogMessage(scip, NULL, "%s = %d\n", SCIPparamGetName(param), intval);
2458  }
2459 
2460  break;
2461 
2463  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %" SCIP_LONGINT_FORMAT ", new value [%" SCIP_LONGINT_FORMAT ",%" SCIP_LONGINT_FORMAT "]: ",
2465  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2466  if( endoffile )
2467  {
2468  *nextdialog = NULL;
2469  return SCIP_OKAY;
2470  }
2471  if( valuestr[0] == '\0' )
2472  return SCIP_OKAY;
2473 
2474  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2475 
2476  if( sscanf(valuestr, "%" SCIP_LONGINT_FORMAT, &longintval) != 1 || !SCIPisLongintParamValid(scip, param, longintval) )
2477  {
2478  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for longint parameter <%s>. Must be integral in range [%" SCIP_LONGINT_FORMAT ",%" SCIP_LONGINT_FORMAT "].\n\n",
2479  valuestr, SCIPparamGetName(param), SCIPparamGetLongintMin(param), SCIPparamGetLongintMax(param));
2480  }
2481  else
2482  {
2483  SCIP_CALL( SCIPchgLongintParam(scip, param, longintval) );
2484  SCIPdialogMessage(scip, NULL, "%s = %" SCIP_LONGINT_FORMAT "\n", SCIPparamGetName(param), longintval);
2485  }
2486  break;
2487 
2488  case SCIP_PARAMTYPE_REAL:
2489  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %.15g, new value [%.15g,%.15g]: ",
2491  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2492  if( endoffile )
2493  {
2494  *nextdialog = NULL;
2495  return SCIP_OKAY;
2496  }
2497  if( valuestr[0] == '\0' )
2498  return SCIP_OKAY;
2499 
2500  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2501 
2502  if( sscanf(valuestr, "%" SCIP_REAL_FORMAT, &realval) != 1 || !SCIPisRealParamValid(scip, param, realval) )
2503  {
2504  SCIPdialogMessage(scip, NULL, "\nInvalid real parameter value <%s> for parameter <%s>. Must be in range [%.15g,%.15g].\n\n",
2505  valuestr, SCIPparamGetName(param), SCIPparamGetRealMin(param), SCIPparamGetRealMax(param));
2506  }
2507  else
2508  {
2509  SCIP_CALL( SCIPchgRealParam(scip, param, realval) );
2510  SCIPdialogMessage(scip, NULL, "%s = %.15g\n", SCIPparamGetName(param), realval);
2511  }
2512  break;
2513 
2514  case SCIP_PARAMTYPE_CHAR:
2515  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: <%c>, new value: ", SCIPparamGetChar(param));
2516  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2517  if( endoffile )
2518  {
2519  *nextdialog = NULL;
2520  return SCIP_OKAY;
2521  }
2522  if( valuestr[0] == '\0' )
2523  return SCIP_OKAY;
2524 
2525  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2526 
2527  if( sscanf(valuestr, "%c", &charval) != 1 || !SCIPisCharParamValid(scip, param, charval) )
2528  {
2529  SCIPdialogMessage(scip, NULL, "\nInvalid char parameter value <%s>. Must be in set {%s}.\n\n",
2530  valuestr, SCIPparamGetCharAllowedValues(param));
2531  }
2532  else
2533  {
2534  SCIP_CALL( SCIPchgCharParam(scip, param, charval) );
2535  SCIPdialogMessage(scip, NULL, "%s = %c\n", SCIPparamGetName(param), charval);
2536  }
2537  break;
2538 
2539  case SCIP_PARAMTYPE_STRING:
2540  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: <%s>, new value: ", SCIPparamGetString(param));
2541  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2542  if( endoffile )
2543  {
2544  *nextdialog = NULL;
2545  return SCIP_OKAY;
2546  }
2547  if( valuestr[0] == '\0' )
2548  return SCIP_OKAY;
2549 
2550  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2551 
2552  if ( !SCIPisStringParamValid(scip, param, valuestr) )
2553  {
2554  SCIPdialogMessage(scip, NULL, "\nInvalid character in string parameter.\n\n");
2555  }
2556  else
2557  {
2558  SCIP_CALL( SCIPchgStringParam(scip, param, valuestr) );
2559  SCIPdialogMessage(scip, NULL, "%s = %s\n", SCIPparamGetName(param), valuestr);
2560  }
2561  break;
2562 
2563  default:
2564  SCIPerrorMessage("invalid parameter type\n");
2565  return SCIP_INVALIDDATA;
2566  }
2567 
2568  return SCIP_OKAY;
2569 }
2570 
2571 /** dialog description method for the set parameter command */
2572 SCIP_DECL_DIALOGDESC(SCIPdialogDescSetParam)
2573 { /*lint --e{715}*/
2574  SCIP_PARAM* param;
2575  char valuestr[SCIP_MAXSTRLEN];
2576 
2577  /* get the parameter to set */
2578  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
2579 
2580  /* retrieve parameter's current value */
2581  switch( SCIPparamGetType(param) )
2582  {
2583  case SCIP_PARAMTYPE_BOOL:
2584  if( SCIPparamGetBool(param) )
2585  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "TRUE");
2586  else
2587  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "FALSE");
2588  break;
2589 
2590  case SCIP_PARAMTYPE_INT:
2591  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%d", SCIPparamGetInt(param));
2592  break;
2593 
2595  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%" SCIP_LONGINT_FORMAT, SCIPparamGetLongint(param));
2596  break;
2597 
2598  case SCIP_PARAMTYPE_REAL:
2599  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%.15g", SCIPparamGetReal(param));
2600  if( strchr(valuestr, '.') == NULL && strchr(valuestr, 'e') == NULL )
2601  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%.1f", SCIPparamGetReal(param));
2602  break;
2603 
2604  case SCIP_PARAMTYPE_CHAR:
2605  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%c", SCIPparamGetChar(param));
2606  break;
2607 
2608  case SCIP_PARAMTYPE_STRING:
2609  (void) SCIPsnprintf(valuestr, SCIP_MAXSTRLEN, "%s", SCIPparamGetString(param));
2610  break;
2611 
2612  default:
2613  SCIPerrorMessage("invalid parameter type\n");
2614  return SCIP_INVALIDDATA;
2615  }
2616  valuestr[SCIP_MAXSTRLEN-1] = '\0';
2617 
2618  /* display parameter's description */
2619  SCIPdialogMessage(scip, NULL, "%s", SCIPparamGetDesc(param));
2620 
2621  /* display parameter's current value */
2622  SCIPdialogMessage(scip, NULL, " [%s]", valuestr);
2623 
2624  return SCIP_OKAY;
2625 }
2626 
2627 /** dialog execution method for the fix parameter command */
2628 SCIP_DECL_DIALOGEXEC(SCIPdialogExecFixParam)
2629 { /*lint --e{715}*/
2630  SCIP_PARAM* param;
2631  char prompt[SCIP_MAXSTRLEN];
2632  char* valuestr;
2633  SCIP_Bool fix;
2634  SCIP_Bool endoffile;
2635  SCIP_Bool error;
2636 
2637  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2638 
2639  /* get the parameter to fix */
2640  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
2641 
2642  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current fixing status: %s, new value (TRUE/FALSE): ",
2643  SCIPparamIsFixed(param) ? "TRUE" : "FALSE");
2644  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2645  if( endoffile )
2646  {
2647  *nextdialog = NULL;
2648  return SCIP_OKAY;
2649  }
2650  if( valuestr[0] == '\0' )
2651  return SCIP_OKAY;
2652 
2653  fix = parseBoolValue(scip, valuestr, &error);
2654 
2655  if( !error )
2656  {
2657  SCIPparamSetFixed(param, fix);
2658  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, (fix ? "TRUE" : "FALSE"), TRUE) );
2659  SCIPdialogMessage(scip, NULL, "<%s> %s\n", SCIPparamGetName(param), (fix ? "fixed" : "unfixed"));
2660  }
2661  else
2662  {
2663  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
2664  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s> for fixing status. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
2665  valuestr);
2666  }
2667 
2668  return SCIP_OKAY;
2669 }
2670 
2671 /** dialog description method for the fix parameter command */
2672 SCIP_DECL_DIALOGDESC(SCIPdialogDescFixParam)
2673 { /*lint --e{715}*/
2674  SCIP_PARAM* param;
2675 
2676  /* get the parameter to set */
2677  param = (SCIP_PARAM*)SCIPdialogGetData(dialog);
2678 
2679  /* display parameter's description */
2680  SCIPdialogMessage(scip, NULL, "%s", SCIPparamGetDesc(param));
2681 
2682  /* display parameter's current fixing status */
2683  if( SCIPparamIsFixed(param) )
2684  SCIPdialogMessage(scip, NULL, " [fixed]");
2685  else
2686  SCIPdialogMessage(scip, NULL, " [not fixed]");
2687 
2688  return SCIP_OKAY;
2689 }
2690 
2691 /** dialog execution method for the set branching direction command */
2692 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetBranchingDirection)
2693 { /*lint --e{715}*/
2694  SCIP_VAR* var;
2695  char prompt[SCIP_MAXSTRLEN];
2696  char* valuestr;
2697  int direction;
2698  SCIP_Bool endoffile;
2699 
2700  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2701 
2702  /* branching priorities cannot be set, if no problem was created */
2704  {
2705  SCIPdialogMessage(scip, NULL, "cannot set branching directions before problem was created\n");
2706  return SCIP_OKAY;
2707  }
2708 
2709  /* get variable name from user */
2710  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "variable name: ", &valuestr, &endoffile) );
2711  if( endoffile )
2712  {
2713  *nextdialog = NULL;
2714  return SCIP_OKAY;
2715  }
2716  if( valuestr[0] == '\0' )
2717  return SCIP_OKAY;
2718 
2719  /* find variable */
2720  var = SCIPfindVar(scip, valuestr);
2721  if( var == NULL )
2722  {
2723  SCIPdialogMessage(scip, NULL, "variable <%s> does not exist in problem\n", valuestr);
2724  return SCIP_OKAY;
2725  }
2726 
2727  /* get new branching direction from user */
2728  switch( SCIPvarGetBranchDirection(var) )
2729  {
2731  direction = -1;
2732  break;
2733  case SCIP_BRANCHDIR_AUTO:
2734  direction = 0;
2735  break;
2737  direction = +1;
2738  break;
2739  case SCIP_BRANCHDIR_FIXED:
2740  default:
2741  SCIPerrorMessage("invalid preferred branching direction <%d> of variable <%s>\n",
2743  return SCIP_INVALIDDATA;
2744  }
2745  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %d, new value: ", direction);
2746  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2747  if( endoffile )
2748  {
2749  *nextdialog = NULL;
2750  return SCIP_OKAY;
2751  }
2753  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "%s %s", prompt, valuestr);
2754  if( valuestr[0] == '\0' )
2755  return SCIP_OKAY;
2756 
2757  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, prompt, FALSE) );
2758 
2759  if( sscanf(valuestr, "%d", &direction) != 1 )
2760  {
2761  SCIPdialogMessage(scip, NULL, "\ninvalid input <%s>\n\n", valuestr);
2762  return SCIP_OKAY;
2763  }
2764  if( direction < -1 || direction > +1 )
2765  {
2766  SCIPdialogMessage(scip, NULL, "\ninvalid input <%d>: direction must be -1, 0, or +1\n\n", direction);
2767  return SCIP_OKAY;
2768  }
2769 
2770  /* set new branching direction */
2771  if( direction == -1 )
2773  else if( direction == 0 )
2775  else
2777 
2778  SCIPdialogMessage(scip, NULL, "branching direction of variable <%s> set to %d\n", SCIPvarGetName(var), direction);
2779 
2780  return SCIP_OKAY;
2781 }
2782 
2783 /** dialog execution method for the set branching priority command */
2784 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetBranchingPriority)
2785 { /*lint --e{715}*/
2786  SCIP_VAR* var;
2787  char prompt[SCIP_MAXSTRLEN];
2788  char* valuestr;
2789  int priority;
2790  SCIP_Bool endoffile;
2791 
2792  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2793 
2794  /* branching priorities cannot be set, if no problem was created */
2796  {
2797  SCIPdialogMessage(scip, NULL, "cannot set branching priorities before problem was created\n");
2798  return SCIP_OKAY;
2799  }
2800 
2801  /* get variable name from user */
2802  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "variable name: ", &valuestr, &endoffile) );
2803  if( endoffile )
2804  {
2805  *nextdialog = NULL;
2806  return SCIP_OKAY;
2807  }
2808  if( valuestr[0] == '\0' )
2809  return SCIP_OKAY;
2810 
2811  /* find variable */
2812  var = SCIPfindVar(scip, valuestr);
2813  if( var == NULL )
2814  {
2815  SCIPdialogMessage(scip, NULL, "variable <%s> does not exist in problem\n", valuestr);
2816  return SCIP_OKAY;
2817  }
2818 
2819  /* get new branching priority from user */
2820  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %d, new value: ", SCIPvarGetBranchPriority(var));
2821  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
2822  if( endoffile )
2823  {
2824  *nextdialog = NULL;
2825  return SCIP_OKAY;
2826  }
2828  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "%s %s", prompt, valuestr);
2829  if( valuestr[0] == '\0' )
2830  return SCIP_OKAY;
2831 
2832  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, prompt, FALSE) );
2833 
2834  if( sscanf(valuestr, "%d", &priority) != 1 )
2835  {
2836  SCIPdialogMessage(scip, NULL, "\ninvalid input <%s>\n\n", valuestr);
2837  return SCIP_OKAY;
2838  }
2839 
2840  /* set new branching priority */
2841  SCIP_CALL( SCIPchgVarBranchPriority(scip, var, priority) );
2842  SCIPdialogMessage(scip, NULL, "branching priority of variable <%s> set to %d\n", SCIPvarGetName(var), SCIPvarGetBranchPriority(var));
2843 
2844  return SCIP_OKAY;
2845 }
2846 
2847 /** dialog execution method for the set heuristics aggressive command */
2848 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsAggressive)
2849 { /*lint --e{715}*/
2850  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2851 
2852  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2853 
2855 
2856  return SCIP_OKAY;
2857 }
2858 
2859 /** dialog execution method for the set heuristics default command */
2860 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsDefault)
2861 { /*lint --e{715}*/
2862  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2863 
2864  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2865 
2867 
2868  return SCIP_OKAY;
2869 }
2870 
2871 /** dialog execution method for the set heuristics fast command */
2872 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsFast)
2873 { /*lint --e{715}*/
2874  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2875 
2876  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2877 
2879 
2880  return SCIP_OKAY;
2881 }
2882 
2883 /** dialog execution method for the set heuristics off command */
2884 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetHeuristicsOff)
2885 { /*lint --e{715}*/
2886  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2887 
2888  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2889 
2891 
2892  return SCIP_OKAY;
2893 }
2894 
2895 /** dialog execution method for the set presolving aggressive command */
2896 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingAggressive)
2897 { /*lint --e{715}*/
2898  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2899 
2900  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2901 
2903 
2904  return SCIP_OKAY;
2905 }
2906 
2907 /** dialog execution method for the set presolving default command */
2908 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingDefault)
2909 { /*lint --e{715}*/
2910  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2911 
2912  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2913 
2915 
2916  return SCIP_OKAY;
2917 }
2918 
2919 /** dialog execution method for the set presolving fast command */
2920 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingFast)
2921 { /*lint --e{715}*/
2922  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2923 
2924  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2925 
2927 
2928  return SCIP_OKAY;
2929 }
2930 
2931 /** dialog execution method for the set presolving off command */
2932 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetPresolvingOff)
2933 { /*lint --e{715}*/
2934  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2935 
2936  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2937 
2939 
2940  return SCIP_OKAY;
2941 }
2942 
2943 /** dialog execution method for the set separating aggressive command */
2944 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingAggressive)
2945 { /*lint --e{715}*/
2946  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2947 
2948  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2949 
2951 
2952  return SCIP_OKAY;
2953 }
2954 
2955 /** dialog execution method for the set separating default command */
2956 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingDefault)
2957 { /*lint --e{715}*/
2958  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2959 
2960  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2961 
2963 
2964  return SCIP_OKAY;
2965 }
2966 
2967 /** dialog execution method for the set separating fast command */
2968 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingFast)
2969 { /*lint --e{715}*/
2970  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2971 
2972  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2973 
2975 
2976  return SCIP_OKAY;
2977 }
2978 
2979 /** dialog execution method for the set separating off command */
2980 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetSeparatingOff)
2981 { /*lint --e{715}*/
2982  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2983 
2984  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2985 
2987 
2988  return SCIP_OKAY;
2989 }
2990 
2991 /** dialog execution method for the set emphasis counter command */
2992 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisCounter)
2993 { /*lint --e{715}*/
2994  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
2995 
2996  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
2997 
2998  /* reset SCIP parameters */
3000 
3001  /* set parameters for counting problems */
3003 
3004  return SCIP_OKAY;
3005 }
3006 
3007 /** dialog execution method for the set emphasis cpsolver command */
3008 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisCpsolver)
3009 { /*lint --e{715}*/
3010  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3011 
3012  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3013 
3014  /* reset SCIP parameters */
3016 
3017  /* set parameters for CP like search problems */
3019 
3020  return SCIP_OKAY;
3021 }
3022 
3023 /** dialog execution method for the set emphasis easy CIP command */
3024 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisEasycip)
3025 { /*lint --e{715}*/
3026  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3027 
3028  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3029 
3030  /* reset SCIP parameters */
3032 
3033  /* set parameters for easy CIP problems */
3035 
3036  return SCIP_OKAY;
3037 }
3038 
3039 /** dialog execution method for the set emphasis feasibility command */
3040 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisFeasibility)
3041 { /*lint --e{715}*/
3042  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3043 
3044  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3045 
3046  /* reset SCIP parameters */
3048 
3049  /* set parameters for feasibility problems */
3051 
3052  return SCIP_OKAY;
3053 }
3054 
3055 /** dialog execution method for the set emphasis hard LP command */
3056 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisHardlp)
3057 { /*lint --e{715}*/
3058  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3059 
3060  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3061 
3062  /* reset SCIP parameters */
3064 
3065  /* set parameters for problems with hard LP */
3067 
3068  return SCIP_OKAY;
3069 }
3070 
3071 /** dialog execution method for the set emphasis optimality command */
3072 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetEmphasisOptimality)
3073 { /*lint --e{715}*/
3074  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3075 
3076  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3077 
3078  /* reset SCIP parameters */
3080 
3081  /* set parameters for problems to prove optimality fast */
3083 
3084  return SCIP_OKAY;
3085 }
3086 
3087 /** dialog execution method for the set limits objective command */
3088 SCIP_DECL_DIALOGEXEC(SCIPdialogExecSetLimitsObjective)
3089 { /*lint --e{715}*/
3090  char prompt[SCIP_MAXSTRLEN];
3091  char* valuestr;
3092  SCIP_Real objlim;
3093  SCIP_Bool endoffile;
3094 
3095  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3096 
3097  /* objective limit cannot be set, if no problem was created */
3099  {
3100  SCIPdialogMessage(scip, NULL, "cannot set objective limit before problem was created\n");
3101  return SCIP_OKAY;
3102  }
3103 
3104  /* get new objective limit from user */
3105  (void) SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "current value: %.15g, new value: ", SCIPgetObjlimit(scip));
3106  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &valuestr, &endoffile) );
3107  if( endoffile )
3108  {
3109  *nextdialog = NULL;
3110  return SCIP_OKAY;
3111  }
3112  if( valuestr[0] == '\0' )
3113  return SCIP_OKAY;
3114 
3115  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, valuestr, TRUE) );
3116 
3117  if( sscanf(valuestr, "%" SCIP_REAL_FORMAT, &objlim) != 1 )
3118  {
3119  SCIPdialogMessage(scip, NULL, "\ninvalid input <%s>\n\n", valuestr);
3120  return SCIP_OKAY;
3121  }
3122 
3123  /* check, if new objective limit is valid */
3126  {
3127  SCIPdialogMessage(scip, NULL, "\ncannot relax objective limit from %.15g to %.15g after problem was transformed\n\n",
3128  SCIPgetObjlimit(scip), objlim);
3129  return SCIP_OKAY;
3130  }
3131 
3132  /* set new objective limit */
3133  SCIP_CALL( SCIPsetObjlimit(scip, objlim) );
3134  SCIPdialogMessage(scip, NULL, "objective value limit set to %.15g\n", SCIPgetObjlimit(scip));
3135 
3136  return SCIP_OKAY;
3137 }
3138 
3139 /** dialog execution method for the write LP command */
3140 static
3141 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteLp)
3142 { /*lint --e{715}*/
3143  char* filename;
3144  SCIP_Bool endoffile;
3145 
3146  SCIPdialogMessage(scip, NULL, "\n");
3147 
3148  /* node relaxations only exist in solving & solved stage */
3150  {
3151  SCIPdialogMessage(scip, NULL, "There is no node LP relaxation before solving starts\n");
3152  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3153  return SCIP_OKAY;
3154  }
3156  {
3157  SCIPdialogMessage(scip, NULL, "There is no node LP relaxation after problem was solved\n");
3158  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3159  return SCIP_OKAY;
3160  }
3161 
3162  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3163  if( endoffile )
3164  {
3165  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3166  return SCIP_OKAY;
3167  }
3168  if( filename[0] != '\0' )
3169  {
3170  SCIP_RETCODE retcode;
3171 
3172  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3173  retcode = SCIPwriteLP(scip, filename);
3174 
3175  if( retcode == SCIP_FILECREATEERROR )
3176  {
3177  SCIPdialogMessage(scip, NULL, "error not creating file <%s>\n", filename);
3178  }
3179  else
3180  {
3181  SCIP_CALL( retcode );
3182 
3183  SCIPdialogMessage(scip, NULL, "written node LP relaxation to file <%s>\n", filename);
3184  }
3185  }
3186 
3187  SCIPdialogMessage(scip, NULL, "\n");
3188 
3189  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3190 
3191  return SCIP_OKAY;
3192 }
3193 
3194 /** dialog execution method for the write MIP command */
3195 static
3196 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteMip)
3197 { /*lint --e{715}*/
3198  char command[SCIP_MAXSTRLEN];
3199  char filename[SCIP_MAXSTRLEN];
3200  SCIP_Bool endoffile;
3201  char* valuestr;
3202  SCIP_Bool offset;
3203  SCIP_Bool generic;
3204  SCIP_Bool lazyconss;
3205  SCIP_Bool error;
3206 
3207  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3208 
3209  /* node relaxations only exist in solving & solved stage */
3211  {
3212  SCIPdialogMessage(scip, NULL, "There is no node MIP relaxation before solving starts\n");
3213  return SCIP_OKAY;
3214  }
3216  {
3217  SCIPdialogMessage(scip, NULL, "There is no node MIP relaxation after problem was solved\n");
3218  return SCIP_OKAY;
3219  }
3220 
3221  /* first get file name */
3222  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &valuestr, &endoffile) );
3223  if( endoffile )
3224  {
3225  *nextdialog = NULL;
3226  return SCIP_OKAY;
3227  }
3228  if( valuestr[0] == '\0' )
3229  return SCIP_OKAY;
3230 
3231  (void)SCIPstrncpy(filename, valuestr, SCIP_MAXSTRLEN);
3232 
3233  /* second ask for generic variable and row names */
3234  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
3235  "using generic variable and row names (TRUE/FALSE): ",
3236  &valuestr, &endoffile) );
3237 
3238  if( endoffile )
3239  {
3240  *nextdialog = NULL;
3241  return SCIP_OKAY;
3242  }
3243  if( valuestr[0] == '\0' )
3244  return SCIP_OKAY;
3245 
3246  generic = parseBoolValue(scip, valuestr, &error);
3247 
3248  if( error )
3249  {
3250  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
3251  valuestr);
3252 
3253  return SCIP_OKAY;
3254  }
3255 
3256  /* adjust command and add to the history */
3257  SCIPescapeString(command, SCIP_MAXSTRLEN, filename);
3258  (void) SCIPsnprintf(command, SCIP_MAXSTRLEN, "%s %s", command, generic ? "TRUE" : "FALSE");
3259 
3260  /* third ask if for adjusting the objective offset */
3261  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
3262  "using original objective function (TRUE/FALSE): ",
3263  &valuestr, &endoffile) );
3264 
3265  if( endoffile )
3266  {
3267  *nextdialog = NULL;
3268  return SCIP_OKAY;
3269  }
3270  if( valuestr[0] == '\0' )
3271  return SCIP_OKAY;
3272 
3273  offset = parseBoolValue(scip, valuestr, &error);
3274 
3275  if( error )
3276  {
3277  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
3278  valuestr);
3279 
3280  return SCIP_OKAY;
3281  }
3282 
3283  (void) SCIPsnprintf(command, SCIP_MAXSTRLEN, "%s %s", command, offset ? "TRUE" : "FALSE");
3284  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, command, FALSE) );
3285 
3286  /* fourth ask for lazy constraints */
3287  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog,
3288  "output removable rows as lazy constraints (TRUE/FALSE): ",
3289  &valuestr, &endoffile) );
3290 
3291  if( endoffile )
3292  {
3293  *nextdialog = NULL;
3294  return SCIP_OKAY;
3295  }
3296  if( valuestr[0] == '\0' )
3297  return SCIP_OKAY;
3298 
3299  lazyconss = parseBoolValue(scip, valuestr, &error);
3300 
3301  if( error )
3302  {
3303  SCIPdialogMessage(scip, NULL, "\nInvalid value <%s>. Must be <0>, <1>, <FALSE>, or <TRUE>.\n\n",
3304  valuestr);
3305 
3306  return SCIP_OKAY;
3307  }
3308 
3309  /* adjust command and add to the history */
3310  SCIPescapeString(command, SCIP_MAXSTRLEN, filename);
3311  (void) SCIPsnprintf(command, SCIP_MAXSTRLEN, "%s %s", command, lazyconss ? "TRUE" : "FALSE");
3312 
3313  /* execute command */
3314  SCIP_CALL( SCIPwriteMIP(scip, filename, generic, offset, lazyconss) );
3315  SCIPdialogMessage(scip, NULL, "written node MIP relaxation to file <%s>\n", filename);
3316 
3317  SCIPdialogMessage(scip, NULL, "\n");
3318 
3319  return SCIP_OKAY;
3320 }
3321 
3322 
3323 /** dialog execution method for the write NLP command */
3324 static
3325 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteNlp)
3326 { /*lint --e{715}*/
3327  char* filename;
3328  SCIP_Bool endoffile;
3329 
3330  SCIPdialogMessage(scip, NULL, "\n");
3331 
3332  /* node relaxations only exist in solving & solved stage */
3334  {
3335  SCIPdialogMessage(scip, NULL, "There is no node NLP relaxation before solving starts\n");
3336  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3337  return SCIP_OKAY;
3338  }
3340  {
3341  SCIPdialogMessage(scip, NULL, "There is no node NLP relaxation after problem was solved\n");
3342  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3343  return SCIP_OKAY;
3344  }
3345  if( !SCIPisNLPConstructed(scip) )
3346  {
3347  SCIPdialogMessage(scip, NULL, "There has been no node NLP relaxation constructed\n");
3348  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3349  return SCIP_OKAY;
3350  }
3351 
3352  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3353  if( endoffile )
3354  {
3355  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3356  return SCIP_OKAY;
3357  }
3358  if( filename[0] != '\0' )
3359  {
3360  SCIP_RETCODE retcode;
3361 
3362  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3363  retcode = SCIPwriteNLP(scip, filename);
3364 
3365  if( retcode == SCIP_FILECREATEERROR )
3366  {
3367  SCIPdialogMessage(scip, NULL, "error not creating file <%s>\n", filename);
3368  }
3369  else
3370  {
3371  SCIP_CALL( retcode );
3372 
3373  SCIPdialogMessage(scip, NULL, "written node NLP relaxation to file <%s>\n", filename);
3374  }
3375  }
3376 
3377  SCIPdialogMessage(scip, NULL, "\n");
3378 
3379  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3380 
3381  return SCIP_OKAY;
3382 }
3383 
3384 /** dialog execution method for the write problem command */
3385 static
3386 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteProblem)
3387 { /*lint --e{715}*/
3388  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3389 
3391  {
3392  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, FALSE, FALSE) );
3393  }
3394  else
3395  SCIPdialogMessage(scip, NULL, "no problem available\n");
3396 
3397  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3398 
3399  return SCIP_OKAY;
3400 }
3401 
3402 /** dialog execution method for the write generic problem command */
3403 static
3404 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteGenProblem)
3405 { /*lint --e{715}*/
3406  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3407 
3409  {
3410  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, FALSE, TRUE) );
3411  }
3412  else
3413  SCIPdialogMessage(scip, NULL, "no problem available\n");
3414 
3415  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3416 
3417  return SCIP_OKAY;
3418 }
3419 
3420 /** dialog execution method for the write solution command */
3421 static
3422 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteSolution)
3423 { /*lint --e{715}*/
3424  char* filename;
3425  SCIP_Bool endoffile;
3426 
3427  SCIPdialogMessage(scip, NULL, "\n");
3428 
3429  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3430  if( endoffile )
3431  {
3432  *nextdialog = NULL;
3433  return SCIP_OKAY;
3434  }
3435  if( filename[0] != '\0' )
3436  {
3437  FILE* file;
3438 
3439  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3440 
3441  file = fopen(filename, "w");
3442  if( file == NULL )
3443  {
3444  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3445  SCIPdialoghdlrClearBuffer(dialoghdlr);
3446  }
3447  else
3448  {
3449  SCIP_Bool printzeros;
3450 
3451  SCIPinfoMessage(scip, file, "solution status: ");
3452  SCIP_CALL_FINALLY( SCIPprintStatus(scip, file), fclose(file) );
3453 
3454  SCIP_CALL_FINALLY( SCIPgetBoolParam(scip, "write/printzeros", &printzeros), fclose(file) );
3455 
3456  SCIPinfoMessage(scip, file, "\n");
3457  SCIP_CALL_FINALLY( SCIPprintBestSol(scip, file, printzeros), fclose(file) );
3458 
3459  SCIPdialogMessage(scip, NULL, "written solution information to file <%s>\n", filename);
3460  fclose(file);
3461  }
3462  }
3463 
3464  SCIPdialogMessage(scip, NULL, "\n");
3465 
3466  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3467 
3468  return SCIP_OKAY;
3469 }
3470 
3471 /** dialog execution method for the write mipstart command */
3472 static
3473 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteMIPStart)
3474 { /*lint --e{715}*/
3475  char* filename;
3476  SCIP_Bool endoffile;
3477 
3478  SCIPdialogMessage(scip, NULL, "\n");
3479 
3480  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3481  if( endoffile )
3482  {
3483  *nextdialog = NULL;
3484  return SCIP_OKAY;
3485  }
3486  if( filename[0] != '\0' )
3487  {
3488  FILE* file;
3489 
3490  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3491 
3492  file = fopen(filename, "w");
3493  if( file == NULL )
3494  {
3495  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3496  SCIPdialoghdlrClearBuffer(dialoghdlr);
3497  }
3498  else
3499  {
3500  SCIP_SOL* sol;
3501 
3502  SCIPinfoMessage(scip, file, "\n");
3503 
3504  sol = SCIPgetBestSol(scip);
3505 
3506  if( sol == NULL )
3507  {
3508  SCIPdialogMessage(scip, NULL, "no mip start available\n");
3509  fclose(file);
3510  }
3511  else
3512  {
3513  SCIP_CALL_FINALLY( SCIPprintMIPStart(scip, sol, file), fclose(file) );
3514 
3515  SCIPdialogMessage(scip, NULL, "written mip start information to file <%s>\n", filename);
3516  fclose(file);
3517  }
3518  }
3519  }
3520 
3521  SCIPdialogMessage(scip, NULL, "\n");
3522 
3523  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3524 
3525  return SCIP_OKAY;
3526 }
3527 
3528 /** dialog execution method for writing command line history */
3529 static
3530 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteCommandHistory)
3531 { /*lint --e{715}*/
3532  char* filename;
3533  SCIP_Bool endoffile;
3534 
3535  SCIPdialogMessage(scip, NULL, "\n");
3536 
3537  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3538  if( endoffile )
3539  {
3540  *nextdialog = NULL;
3541  return SCIP_OKAY;
3542  }
3543  if( filename[0] != '\0' )
3544  {
3545  SCIP_RETCODE retcode;
3546 
3547  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3548 
3549  retcode = SCIPdialogWriteHistory(filename);
3550 
3551  if( retcode != SCIP_OKAY )
3552  {
3553  SCIPdialogMessage(scip, NULL, "error writing to file <%s>\n"
3554  "check that the directory exists and that you have correct permissions\n", filename);
3555  SCIPdialoghdlrClearBuffer(dialoghdlr);
3556  }
3557  else
3558  {
3559  SCIPdialogMessage(scip, NULL, "wrote available command line history to <%s>\n", filename);
3560  }
3561  }
3562 
3563  SCIPdialogMessage(scip, NULL, "\n");
3564 
3565  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3566 
3567  return SCIP_OKAY;
3568 }
3569 
3570 /** dialog execution method for the write finitesolution command */
3571 static
3572 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteFiniteSolution)
3573 { /*lint --e{715}*/
3574  char* filename;
3575  SCIP_Bool endoffile;
3576 
3577  SCIPdialogMessage(scip, NULL, "\n");
3578 
3579  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3580  if( endoffile )
3581  {
3582  *nextdialog = NULL;
3583  return SCIP_OKAY;
3584  }
3585  if( filename[0] != '\0' )
3586  {
3587  FILE* file;
3588 
3589  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3590 
3591  file = fopen(filename, "w");
3592  if( file == NULL )
3593  {
3594  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3595  SCIPdialoghdlrClearBuffer(dialoghdlr);
3596  }
3597  else
3598  {
3599  SCIP_SOL* bestsol = SCIPgetBestSol(scip);
3600  SCIP_Bool printzeros;
3601 
3602  SCIPinfoMessage(scip, file, "solution status: ");
3603 
3604  SCIP_CALL_FINALLY( SCIPprintStatus(scip, file), fclose(file) );
3605 
3606  SCIPinfoMessage(scip, file, "\n");
3607 
3608  if( bestsol != NULL )
3609  {
3610  SCIP_SOL* sol;
3611  SCIP_Bool success;
3612 
3613  SCIP_CALL_FINALLY( SCIPcreateFiniteSolCopy(scip, &sol, bestsol, &success), fclose(file) );
3614 
3615  SCIP_CALL_FINALLY( SCIPgetBoolParam(scip, "write/printzeros", &printzeros), fclose(file) );
3616 
3617  if( sol != NULL )
3618  {
3619  SCIP_CALL_FINALLY( SCIPprintSol(scip, sol, file, printzeros), fclose(file) );
3620 
3621  SCIPdialogMessage(scip, NULL, "written solution information to file <%s>\n", filename);
3622 
3623  SCIP_CALL_FINALLY( SCIPfreeSol(scip, &sol), fclose(file) );
3624  }
3625  else
3626  {
3627  SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, "finite solution could not be created\n");
3628  SCIPdialogMessage(scip, NULL, "finite solution could not be created\n", filename);
3629  }
3630  }
3631  else
3632  {
3633  SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, "no solution available\n");
3634  SCIPdialogMessage(scip, NULL, "no solution available\n", filename);
3635  }
3636 
3637  fclose(file);
3638  }
3639  }
3640 
3641  SCIPdialogMessage(scip, NULL, "\n");
3642 
3643  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3644 
3645  return SCIP_OKAY;
3646 }
3647 
3648 /** dialog execution method for the write statistics command */
3649 static
3650 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteStatistics)
3651 { /*lint --e{715}*/
3652  char* filename;
3653  SCIP_Bool endoffile;
3654 
3655  SCIPdialogMessage(scip, NULL, "\n");
3656 
3657  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, "enter filename: ", &filename, &endoffile) );
3658  if( endoffile )
3659  {
3660  *nextdialog = NULL;
3661  return SCIP_OKAY;
3662  }
3663  if( filename[0] != '\0' )
3664  {
3665  FILE* file;
3666 
3667  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, filename, TRUE) );
3668 
3669  file = fopen(filename, "w");
3670  if( file == NULL )
3671  {
3672  SCIPdialogMessage(scip, NULL, "error creating file <%s>\n", filename);
3673  SCIPprintSysError(filename);
3674  SCIPdialoghdlrClearBuffer(dialoghdlr);
3675  }
3676  else
3677  {
3678  SCIP_CALL_FINALLY( SCIPprintStatistics(scip, file), fclose(file) );
3679 
3680  SCIPdialogMessage(scip, NULL, "written statistics to file <%s>\n", filename);
3681  fclose(file);
3682  }
3683  }
3684 
3685  SCIPdialogMessage(scip, NULL, "\n");
3686 
3687  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3688 
3689  return SCIP_OKAY;
3690 }
3691 
3692 /** dialog execution method for the write transproblem command */
3693 static
3694 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteTransproblem)
3695 { /*lint --e{715}*/
3696  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3697 
3699  {
3700  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, TRUE, FALSE) );
3701  }
3702  else
3703  SCIPdialogMessage(scip, NULL, "no transformed problem available\n");
3704 
3705  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3706 
3707  return SCIP_OKAY;
3708 }
3709 
3710 /** dialog execution method for the write generic transproblem command */
3711 static
3712 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteGenTransproblem)
3713 { /*lint --e{715}*/
3714  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3715 
3717  {
3718  SCIP_CALL( writeProblem(scip, dialog, dialoghdlr, nextdialog, TRUE, TRUE) );
3719  }
3720  else
3721  SCIPdialogMessage(scip, NULL, "no transformed problem available\n");
3722 
3723  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3724 
3725  return SCIP_OKAY;
3726 }
3727 
3728 /** dialog execution method for solution validation */
3729 static
3730 SCIP_DECL_DIALOGEXEC(SCIPdialogExecValidateSolve)
3731 { /*lint --e{715}*/
3732  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3733 
3735  {
3736  SCIPdialogMessage(scip, NULL, "\nNo problem available for validation\n");
3737  }
3738  else
3739  {
3740  char *refstrs[2];
3741  SCIP_Real refvals[2] = {SCIP_INVALID, SCIP_INVALID};
3742  const char* primaldual[] = {"primal", "dual"};
3743  char prompt[SCIP_MAXSTRLEN];
3744  int i;
3745 
3746  /* read in primal and dual reference values */
3747  for( i = 0; i < 2; ++i )
3748  {
3749  char * endptr;
3750  SCIP_Bool endoffile;
3751 
3752  (void)SCIPsnprintf(prompt, SCIP_MAXSTRLEN, "Please enter %s validation reference bound (or use +/-infinity) :", primaldual[i]);
3753  SCIP_CALL( SCIPdialoghdlrGetWord(dialoghdlr, dialog, prompt, &(refstrs[i]), &endoffile) );
3754 
3755  /* treat no input as SCIP_UNKNOWN */
3756  if( endoffile || strncmp(refstrs[i], "\0", 1) == 0 ) /*lint !e840*/
3757  {
3758  refvals[i] = SCIP_UNKNOWN;
3759  }
3760  else if( strncmp(refstrs[i], "q", 1) == 0 )
3761  break;
3762  else if( ! SCIPparseReal(scip, refstrs[i], &refvals[i], &endptr) )
3763  {
3764  SCIPdialogMessage(scip, NULL, "Could not parse value '%s', please try again or type 'q' to quit\n", refstrs[i]);
3765  --i;
3766  }
3767  }
3768 
3769  /* check if the loop finished by checking the value of 'i'. Do not validate if user input is missing */
3770  if( i == 2 ) /*lint !e850*/
3771  {
3772  assert(refvals[0] != SCIP_INVALID); /*lint !e777*/
3773  assert(refvals[1] != SCIP_INVALID); /*lint !e777*/
3774  SCIP_CALL( SCIPvalidateSolve(scip, refvals[0], refvals[1], SCIPfeastol(scip), FALSE, NULL, NULL, NULL) );
3775  }
3776  }
3777 
3778  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3779 
3780  return SCIP_OKAY;
3781 }
3782 
3783 /** dialog execution method for linear constraint type classification */
3784 SCIP_DECL_DIALOGEXEC(SCIPdialogExecDisplayLinearConsClassification)
3785 { /*lint --e{715}*/
3786  SCIP_CALL( SCIPdialoghdlrAddHistory(dialoghdlr, dialog, NULL, FALSE) );
3787 
3789  SCIPdialogMessage(scip, NULL, "\nNo problem available for classification\n");
3790  else
3791  {
3792  SCIP_LINCONSSTATS* linconsstats;
3793 
3794  SCIP_CALL( SCIPlinConsStatsCreate(scip, &linconsstats) );
3795 
3796  /* call linear constraint classification and print the statistics to standard out */
3798 
3799  SCIPprintLinConsStats(scip, NULL, linconsstats);
3800 
3801  SCIPlinConsStatsFree(scip, &linconsstats);
3802  }
3803 
3804  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
3805 
3806  return SCIP_OKAY;
3807 }
3808 
3809 /** creates a root dialog */
3811  SCIP* scip, /**< SCIP data structure */
3812  SCIP_DIALOG** root /**< pointer to store the root dialog */
3813  )
3814 {
3815  SCIP_CALL( SCIPincludeDialog(scip, root,
3816  dialogCopyDefault,
3817  SCIPdialogExecMenuLazy, NULL, NULL,
3818  "SCIP", "SCIP's main menu", TRUE, NULL) );
3819 
3820  SCIP_CALL( SCIPsetRootDialog(scip, *root) );
3821  SCIP_CALL( SCIPreleaseDialog(scip, root) );
3822  *root = SCIPgetRootDialog(scip);
3823 
3824  return SCIP_OKAY;
3825 }
3826 
3827 
3828 /** includes or updates the default dialog menus in SCIP */
3830  SCIP* scip /**< SCIP data structure */
3831  )
3832 {
3833  SCIP_DIALOG* root;
3834  SCIP_DIALOG* submenu;
3835  SCIP_DIALOG* dialog;
3836 
3837  /* root menu */
3838  root = SCIPgetRootDialog(scip);
3839  if( root == NULL )
3840  {
3841  SCIP_CALL( SCIPcreateRootDialog(scip, &root) );
3842  }
3843 
3844  /* change */
3845  if( !SCIPdialogHasEntry(root, "change") )
3846  {
3847  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
3848  NULL,
3849  SCIPdialogExecMenu, NULL, NULL,
3850  "change", "change the problem", TRUE, NULL) );
3851  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
3852  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
3853  }
3854  if( SCIPdialogFindEntry(root, "change", &submenu) != 1 )
3855  {
3856  SCIPerrorMessage("change sub menu not found\n");
3857  return SCIP_PLUGINNOTFOUND;
3858  }
3859 
3860  /* change add */
3861  if( !SCIPdialogHasEntry(submenu, "add") )
3862  {
3863  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3864  NULL,
3865  SCIPdialogExecChangeAddCons, NULL, NULL,
3866  "add", "add constraint", FALSE, NULL) );
3867  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3868  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3869  }
3870 
3871  /* change bounds */
3872  if( !SCIPdialogHasEntry(submenu, "bounds") )
3873  {
3874  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3875  NULL,
3876  SCIPdialogExecChangeBounds, NULL, NULL,
3877  "bounds", "change bounds of a variable", FALSE, NULL) );
3878  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3879  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3880  }
3881 
3882  /* free transformed problem */
3883  if( !SCIPdialogHasEntry(submenu, "freetransproblem") )
3884  {
3885  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3886  NULL,
3887  SCIPdialogExecChangeFreetransproblem, NULL, NULL,
3888  "freetransproblem", "free transformed problem", FALSE, NULL) );
3889  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3890  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3891  }
3892 
3893  /* change objective sense */
3894  if( !SCIPdialogHasEntry(submenu, "objsense") )
3895  {
3896  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3897  NULL,
3898  SCIPdialogExecChangeObjSense, NULL, NULL,
3899  "objsense", "change objective sense", FALSE, NULL) );
3900  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3901  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3902  }
3903 
3904  /* checksol */
3905  if( !SCIPdialogHasEntry(root, "checksol") )
3906  {
3907  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3908  NULL,
3909  SCIPdialogExecChecksol, NULL, NULL,
3910  "checksol", "double checks best solution w.r.t. original problem", FALSE, NULL) );
3911  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
3912  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3913  }
3914 
3915  /* display */
3916  if( !SCIPdialogHasEntry(root, "display") )
3917  {
3918  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
3919  NULL,
3920  SCIPdialogExecMenu, NULL, NULL,
3921  "display", "display information", TRUE, NULL) );
3922  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
3923  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
3924  }
3925  if( SCIPdialogFindEntry(root, "display", &submenu) != 1 )
3926  {
3927  SCIPerrorMessage("display sub menu not found\n");
3928  return SCIP_PLUGINNOTFOUND;
3929  }
3930 
3931  /* display benders */
3932  if( !SCIPdialogHasEntry(submenu, "benders") )
3933  {
3934  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3935  NULL,
3936  SCIPdialogExecDisplayBenders, NULL, NULL,
3937  "benders", "display Benders' decomposition", FALSE, NULL) );
3938  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3939  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3940  }
3941 
3942  /* display branching */
3943  if( !SCIPdialogHasEntry(submenu, "branching") )
3944  {
3945  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3946  NULL,
3947  SCIPdialogExecDisplayBranching, NULL, NULL,
3948  "branching", "display branching rules", FALSE, NULL) );
3949  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3950  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3951  }
3952 
3953  /* display compressions */
3954  if( !SCIPdialogHasEntry(submenu, "compression") )
3955  {
3956  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3957  NULL,
3958  SCIPdialogExecDisplayCompression, NULL, NULL,
3959  "compression", "display compression techniques", FALSE, NULL) );
3960  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3961  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3962  }
3963 
3964  /* display conflict */
3965  if( !SCIPdialogHasEntry(submenu, "conflict") )
3966  {
3967  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3968  NULL,
3969  SCIPdialogExecDisplayConflict, NULL, NULL,
3970  "conflict", "display conflict handlers", FALSE, NULL) );
3971  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3972  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3973  }
3974 
3975  /* display conshdlrs */
3976  if( !SCIPdialogHasEntry(submenu, "conshdlrs") )
3977  {
3978  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3979  NULL,
3980  SCIPdialogExecDisplayConshdlrs, NULL, NULL,
3981  "conshdlrs", "display constraint handlers", FALSE, NULL) );
3982  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3983  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3984  }
3985 
3986  /* display displaycols */
3987  if( !SCIPdialogHasEntry(submenu, "displaycols") )
3988  {
3989  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
3990  NULL,
3991  SCIPdialogExecDisplayDisplaycols, NULL, NULL,
3992  "displaycols", "display display columns", FALSE, NULL) );
3993  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
3994  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
3995  }
3996 
3997  /* display heuristics */
3998  if( !SCIPdialogHasEntry(submenu, "heuristics") )
3999  {
4000  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4001  NULL,
4002  SCIPdialogExecDisplayHeuristics, NULL, NULL,
4003  "heuristics", "display primal heuristics", FALSE, NULL) );
4004  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4005  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4006  }
4007 
4008  /* display memory */
4009  if( !SCIPdialogHasEntry(submenu, "memory") )
4010  {
4011  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4012  NULL,
4013  SCIPdialogExecDisplayMemory, NULL, NULL,
4014  "memory", "display memory diagnostics", FALSE, NULL) );
4015  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4016  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4017  }
4018 
4019  /* display nlpi */
4020  if( !SCIPdialogHasEntry(submenu, "nlpis") )
4021  {
4022  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4023  NULL,
4024  SCIPdialogExecDisplayNlpi, NULL, NULL,
4025  "nlpis", "display NLP solver interfaces", FALSE, NULL) );
4026  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4027  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4028  }
4029 
4030  /* display nodeselectors */
4031  if( !SCIPdialogHasEntry(submenu, "nodeselectors") )
4032  {
4033  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4034  NULL,
4035  SCIPdialogExecDisplayNodeselectors, NULL, NULL,
4036  "nodeselectors", "display node selectors", FALSE, NULL) );
4037  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4038  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4039  }
4040 
4041  /* display parameters */
4042  if( !SCIPdialogHasEntry(submenu, "parameters") )
4043  {
4044  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4045  NULL,
4046  SCIPdialogExecDisplayParameters, NULL, NULL,
4047  "parameters", "display non-default parameter settings", FALSE, NULL) );
4048  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4049  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4050  }
4051 
4052  /* display presolvers */
4053  if( !SCIPdialogHasEntry(submenu, "presolvers") )
4054  {
4055  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4056  NULL,
4057  SCIPdialogExecDisplayPresolvers, NULL, NULL,
4058  "presolvers", "display presolvers", FALSE, NULL) );
4059  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4060  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4061  }
4062 
4063  /* display pricers */
4064  if( !SCIPdialogHasEntry(submenu, "pricers") )
4065  {
4066  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4067  NULL,
4068  SCIPdialogExecDisplayPricers, NULL, NULL,
4069  "pricers", "display pricers", FALSE, NULL) );
4070  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4071  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4072  }
4073 
4074  /* display problem */
4075  if( !SCIPdialogHasEntry(submenu, "problem") )
4076  {
4077  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4078  NULL,
4079  SCIPdialogExecDisplayProblem, NULL, NULL,
4080  "problem", "display original problem", FALSE, NULL) );
4081  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4082  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4083  }
4084 
4085  /* display propagators */
4086  if( !SCIPdialogHasEntry(submenu, "propagators") )
4087  {
4088  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4089  NULL,
4090  SCIPdialogExecDisplayPropagators, NULL, NULL,
4091  "propagators", "display propagators", FALSE, NULL) );
4092  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4093  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4094  }
4095 
4096  /* display readers */
4097  if( !SCIPdialogHasEntry(submenu, "readers") )
4098  {
4099  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4100  NULL,
4101  SCIPdialogExecDisplayReaders, NULL, NULL,
4102  "readers", "display file readers", FALSE, NULL) );
4103  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4104  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4105  }
4106 
4107  /* display relaxing */
4108  if( !SCIPdialogHasEntry(submenu, "relaxators") )
4109  {
4110  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4111  NULL,
4112  SCIPdialogExecDisplayRelaxators, NULL, NULL,
4113  "relaxators", "display relaxators", FALSE, NULL) );
4114  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4115  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4116  }
4117 
4118  /* display separators */
4119  if( !SCIPdialogHasEntry(submenu, "separators") )
4120  {
4121  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4122  NULL,
4123  SCIPdialogExecDisplaySeparators, NULL, NULL,
4124  "separators", "display cut separators", FALSE, NULL) );
4125  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4126  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4127  }
4128 
4129  /* display solution */
4130  if( !SCIPdialogHasEntry(submenu, "solution") )
4131  {
4132  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4133  NULL,
4134  SCIPdialogExecDisplaySolution, NULL, NULL,
4135  "solution", "display best primal solution", FALSE, NULL) );
4136  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4137  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4138  }
4139 
4140  /* display finite solution */
4141  if( !SCIPdialogHasEntry(submenu, "finitesolution") )
4142  {
4143  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4144  NULL,
4145  SCIPdialogExecDisplayFiniteSolution, NULL, NULL,
4146  "finitesolution", "display best primal solution (try to make solution values finite, first)", FALSE, NULL) );
4147  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4148  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4149  }
4150 
4151  /* display solution */
4152  if( !SCIPdialogHasEntry(submenu, "dualsolution") )
4153  {
4154  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4155  NULL,
4156  SCIPdialogExecDisplayDualSolution, NULL, NULL,
4157  "dualsolution", "display dual solution vector (LP only, without presolving)", FALSE, NULL) );
4158  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4159  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4160  }
4161 
4162  /* display solution */
4163  if( !SCIPdialogHasEntry(submenu, "sols") )
4164  {
4165  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4166  NULL,
4167  SCIPdialogExecDisplaySolutionPool, NULL, NULL,
4168  "sols", "display solutions from pool", FALSE, NULL) );
4169  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4170  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4171  }
4172 
4173  /* display benders decomposition subproblem */
4174  if( !SCIPdialogHasEntry(submenu, "subproblem") )
4175  {
4176  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4177  NULL,
4178  SCIPdialogExecDisplaySubproblem, NULL, NULL,
4179  "subproblem", "display subproblem of a Benders' decomposition", FALSE, NULL) );
4180  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4181  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4182  }
4183 
4184  /* display the best solution to the benders decomposition subproblem */
4185  if( !SCIPdialogHasEntry(submenu, "subsolution") )
4186  {
4187  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4188  NULL,
4189  SCIPdialogExecDisplaySubSolution, NULL, NULL,
4190  "subsolution", "display solution to the Benders' decomposition subproblems given the best master problem solution", FALSE, NULL) );
4191  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4192  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4193  }
4194 
4195  /* display statistics */
4196  if( !SCIPdialogHasEntry(submenu, "statistics") )
4197  {
4198  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4199  NULL,
4200  SCIPdialogExecDisplayStatistics, NULL, NULL,
4201  "statistics", "display problem and optimization statistics", FALSE, NULL) );
4202  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4203  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4204  }
4205 
4206  /* display reoptimization statistics */
4207  if( !SCIPdialogHasEntry(submenu, "reoptstatistics") )
4208  {
4209  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4210  NULL,
4211  SCIPdialogExecDisplayReoptStatistics, NULL, NULL,
4212  "reoptstatistics", "display reoptimitazion statistics", FALSE, NULL) );
4213  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4214  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4215  }
4216 
4217  /* display transproblem */
4218  if( !SCIPdialogHasEntry(submenu, "transproblem") )
4219  {
4220  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4221  NULL,
4222  SCIPdialogExecDisplayTransproblem, NULL, NULL,
4223  "transproblem", "display current node transformed problem", FALSE, NULL) );
4224  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4225  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4226  }
4227 
4228  /* display value */
4229  if( !SCIPdialogHasEntry(submenu, "value") )
4230  {
4231  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4232  NULL,
4233  SCIPdialogExecDisplayValue, NULL, NULL,
4234  "value", "display value of single variable in best primal solution", FALSE, NULL) );
4235  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4236  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4237  }
4238 
4239  /* display varbranchstatistics */
4240  if( !SCIPdialogHasEntry(submenu, "varbranchstatistics") )
4241  {
4242  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4243  NULL,
4244  SCIPdialogExecDisplayVarbranchstatistics, NULL, NULL,
4245  "varbranchstatistics", "display statistics for branching on variables", FALSE, NULL) );
4246  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4247  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4248  }
4249 
4250  /* display varbranchstatistics */
4251  if( !SCIPdialogHasEntry(submenu, "lpsolquality") )
4252  {
4253  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4254  NULL,
4255  SCIPdialogExecDisplayLPSolutionQuality, NULL, NULL,
4256  "lpsolquality", "display quality of the current LP solution, if available", FALSE, NULL) );
4257  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4258  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4259  }
4260 
4261  /* display transsolution */
4262  if( !SCIPdialogHasEntry(submenu, "transsolution") )
4263  {
4264  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4265  NULL,
4266  SCIPdialogExecDisplayTranssolution, NULL, NULL,
4267  "transsolution", "display best primal solution in transformed variables", FALSE, NULL) );
4268  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4269  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4270  }
4271 
4272  /* display linear constraint type classification */
4273  if( !SCIPdialogHasEntry(submenu, "linclass") )
4274  {
4275  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4276  NULL,
4277  SCIPdialogExecDisplayLinearConsClassification, NULL, NULL,
4278  "linclass", "linear constraint classification as used for MIPLIB", FALSE, NULL) );
4279  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4280  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4281  }
4282 
4283  /* free */
4284  if( !SCIPdialogHasEntry(root, "free") )
4285  {
4286  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4287  NULL,
4288  SCIPdialogExecFree, NULL, NULL,
4289  "free", "free current problem from memory", FALSE, NULL) );
4290  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4291  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4292  }
4293 
4294  /* help */
4295  if( !SCIPdialogHasEntry(root, "help") )
4296  {
4297  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4298  NULL,
4299  SCIPdialogExecHelp, NULL, NULL,
4300  "help", "display this help", FALSE, NULL) );
4301  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4302  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4303  }
4304 
4305  /* newstart */
4306  if( !SCIPdialogHasEntry(root, "newstart") )
4307  {
4308  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4309  NULL,
4310  SCIPdialogExecNewstart, NULL, NULL,
4311  "newstart", "reset branch and bound tree to start again from root", FALSE, NULL) );
4312  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4313  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4314  }
4315 
4316 #ifndef NDEBUG
4317  /* transform problem (for debugging) */
4318  if( !SCIPdialogHasEntry(root, "transform") )
4319  {
4320  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4321  NULL,
4322  SCIPdialogExecTransform, NULL, NULL,
4323  "transform", "transforms problem from original state", FALSE, NULL) );
4324  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4325  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4326  }
4327 #endif
4328 
4329  /* optimize */
4330  if( !SCIPdialogHasEntry(root, "optimize") )
4331  {
4332  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4333  NULL,
4334  SCIPdialogExecOptimize, NULL, NULL,
4335  "optimize", "solve the problem", FALSE, NULL) );
4336  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4337  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4338  }
4339 
4340  /* optimize */
4341  if( !SCIPdialogHasEntry(root, "concurrentopt") )
4342  {
4343  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4344  NULL,
4345  SCIPdialogExecConcurrentOpt, NULL, NULL,
4346  "concurrentopt", "solve the problem using concurrent solvers", FALSE, NULL) );
4347  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4348  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4349  }
4350 
4351  /* presolve */
4352  if( !SCIPdialogHasEntry(root, "presolve") )
4353  {
4354  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4355  NULL,
4356  SCIPdialogExecPresolve, NULL, NULL,
4357  "presolve", "solve the problem, but stop after presolving stage", FALSE, NULL) );
4358  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4359  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4360  }
4361 
4362  /* quit */
4363  if( !SCIPdialogHasEntry(root, "quit") )
4364  {
4365  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4366  NULL,
4367  SCIPdialogExecQuit, NULL, NULL,
4368  "quit", "leave SCIP", FALSE, NULL) );
4369  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4370  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4371  }
4372 
4373  /* read */
4374  if( !SCIPdialogHasEntry(root, "read") )
4375  {
4376  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4377  NULL,
4378  SCIPdialogExecRead, NULL, NULL,
4379  "read", "read a problem", FALSE, NULL) );
4380  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4381  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4382  }
4383 
4384  /* set */
4386 
4387  /* fix */
4389 
4390  /* write */
4391  if( !SCIPdialogHasEntry(root, "write") )
4392  {
4393  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4394  NULL,
4395  SCIPdialogExecMenu, NULL, NULL,
4396  "write", "write information to file", TRUE, NULL) );
4397  SCIP_CALL( SCIPaddDialogEntry(scip, root, submenu) );
4398  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4399  }
4400  if( SCIPdialogFindEntry(root, "write", &submenu) != 1 )
4401  {
4402  SCIPerrorMessage("write sub menu not found\n");
4403  return SCIP_PLUGINNOTFOUND;
4404  }
4405 
4406  /* write LP */
4407  if( !SCIPdialogHasEntry(submenu, "lp") )
4408  {
4409  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4410  NULL,
4411  SCIPdialogExecWriteLp, NULL, NULL,
4412  "lp", "write current node LP relaxation in LP format to file", FALSE, NULL) );
4413  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4414  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4415  }
4416 
4417  /* write MIP */
4418  if( !SCIPdialogHasEntry(submenu, "mip") )
4419  {
4420  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4421  NULL,
4422  SCIPdialogExecWriteMip, NULL, NULL,
4423  "mip", "write current node MIP relaxation in LP format to file", FALSE, NULL) );
4424  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4425  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4426  }
4427 
4428  /* write NLP */
4429  if( !SCIPdialogHasEntry(submenu, "nlp") )
4430  {
4431  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4432  NULL,
4433  SCIPdialogExecWriteNlp, NULL, NULL,
4434  "nlp", "write current node NLP relaxation to file", FALSE, NULL) );
4435  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4436  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4437  }
4438 
4439  /* write problem */
4440  if( !SCIPdialogHasEntry(submenu, "problem") )
4441  {
4442  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4443  NULL,
4444  SCIPdialogExecWriteProblem, NULL, NULL,
4445  "problem",
4446  "write original problem to file (format is given by file extension, e.g., orig.{lp,rlp,cip,mps})",
4447  FALSE, NULL) );
4448  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4449  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4450  }
4451 
4452  /* write generic problem */
4453  if( !SCIPdialogHasEntry(submenu, "genproblem") )
4454  {
4455  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4456  NULL,
4457  SCIPdialogExecWriteGenProblem, NULL, NULL,
4458  "genproblem",
4459  "write original problem with generic names to file (format is given by file extension, e.g., orig.{lp,rlp,cip,mps})",
4460  FALSE, NULL) );
4461  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4462  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4463  }
4464 
4465  /* write solution */
4466  if( !SCIPdialogHasEntry(submenu, "solution") )
4467  {
4468  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4469  NULL,
4470  SCIPdialogExecWriteSolution, NULL, NULL,
4471  "solution", "write best primal solution to file", FALSE, NULL) );
4472  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4473  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4474  }
4475 
4476  /* write finite solution */
4477  if( !SCIPdialogHasEntry(submenu, "finitesolution") )
4478  {
4479  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4480  NULL,
4481  SCIPdialogExecWriteFiniteSolution, NULL, NULL,
4482  "finitesolution", "write best primal solution to file (try to make solution values finite, first)", FALSE, NULL) );
4483  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4484  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4485  }
4486 
4487  /* write mip start */
4488  if( !SCIPdialogHasEntry(submenu, "mipstart") )
4489  {
4490  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4491  NULL,
4492  SCIPdialogExecWriteMIPStart, NULL, NULL,
4493  "mipstart", "write mip start to file", FALSE, NULL) );
4494  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4495  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4496  }
4497 
4498  /* write statistics */
4499  if( !SCIPdialogHasEntry(submenu, "statistics") )
4500  {
4501  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4502  NULL,
4503  SCIPdialogExecWriteStatistics, NULL, NULL,
4504  "statistics", "write statistics to file", FALSE, NULL) );
4505  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4506  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4507  }
4508 
4509  /* write transproblem */
4510  if( !SCIPdialogHasEntry(submenu, "transproblem") )
4511  {
4512  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4513  NULL,
4514  SCIPdialogExecWriteTransproblem, NULL, NULL,
4515  "transproblem",
4516  "write current node transformed problem to file (format is given by file extension, e.g., trans.{lp,rlp,cip,mps})",
4517  FALSE, NULL) );
4518  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4519  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4520  }
4521 
4522  /* write transproblem with generic names */
4523  if( !SCIPdialogHasEntry(submenu, "gentransproblem") )
4524  {
4525  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4526  NULL,
4527  SCIPdialogExecWriteGenTransproblem, NULL, NULL,
4528  "gentransproblem",
4529  "write current node transformed problem with generic names to file (format is given by file extension, e.g., trans.{lp,rlp,cip,mps})",
4530  FALSE, NULL) );
4531  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4532  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4533  }
4534 
4535  /* write cliquegraph */
4536  if( !SCIPdialogHasEntry(submenu, "cliquegraph") )
4537  {
4538  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4539  NULL,
4540  SCIPdialogExecCliquegraph, NULL, NULL,
4541  "cliquegraph",
4542  "write graph of cliques and implications of binary variables to GML file (better call after presolving)",
4543  FALSE, NULL) );
4544  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4545  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4546  }
4547 
4548  /* write command line history */
4549  if( !SCIPdialogHasEntry(submenu, "history") )
4550  {
4551  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4552  NULL,
4553  SCIPdialogExecWriteCommandHistory, NULL, NULL,
4554  "history",
4555  "write command line history to a file (only works if SCIP was compiled with 'readline')",
4556  FALSE, NULL) );
4557  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4558  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4559  }
4560 
4561  /* validate solve */
4562  if( !SCIPdialogHasEntry(root, "validatesolve") )
4563  {
4564  SCIP_CALL( SCIPincludeDialog(scip, &dialog, NULL, SCIPdialogExecValidateSolve, NULL, NULL,
4565  "validatesolve",
4566  "validate the solution against external objective reference interval",
4567  FALSE, NULL) );
4568  SCIP_CALL( SCIPaddDialogEntry(scip, root, dialog) );
4569  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4570  }
4571 
4572  return SCIP_OKAY;
4573 }
4574 
4575 /** if a '/' occurs in the parameter's name, adds a sub menu dialog to the given menu and inserts the parameter dialog
4576  * recursively in the sub menu; if no '/' occurs in the name, adds a parameter change dialog into the given dialog menu
4577  */
4578 static
4580  SCIP* scip, /**< SCIP data structure */
4581  SCIP_DIALOG* menu, /**< dialog menu to insert the parameter into */
4582  SCIP_PARAM* param, /**< parameter to add a dialog for */
4583  char* paramname /**< parameter name to parse */
4584  )
4585 {
4586  char* slash;
4587  char* dirname;
4588 
4589  assert(paramname != NULL);
4590 
4591  /* check for a '/' */
4592  slash = strchr(paramname, '/');
4593 
4594  if( slash == NULL )
4595  {
4596  /* check, if the corresponding dialog already exists */
4597  if( !SCIPdialogHasEntry(menu, paramname) )
4598  {
4599  SCIP_DIALOG* paramdialog;
4600 
4601  if( SCIPparamIsAdvanced(param) )
4602  {
4603  SCIP_DIALOG* advmenu;
4604 
4605  if( !SCIPdialogHasEntry(menu, "advanced") )
4606  {
4607  /* if not yet existing, create an advanced sub menu */
4608  char desc[SCIP_MAXSTRLEN];
4609 
4610  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "advanced parameters");
4611  SCIP_CALL( SCIPincludeDialog(scip, &advmenu,
4612  NULL,
4613  SCIPdialogExecMenu, NULL, NULL, "advanced", desc, TRUE, NULL) );
4614  SCIP_CALL( SCIPaddDialogEntry(scip, menu, advmenu) );
4615  SCIP_CALL( SCIPreleaseDialog(scip, &advmenu) );
4616  }
4617 
4618  /* find the corresponding sub menu */
4619  (void)SCIPdialogFindEntry(menu, "advanced", &advmenu);
4620  if( advmenu == NULL )
4621  {
4622  SCIPerrorMessage("dialog sub menu not found\n");
4623  return SCIP_PLUGINNOTFOUND;
4624  }
4625 
4626  if( !SCIPdialogHasEntry(advmenu, paramname) )
4627  {
4628  /* create a parameter change dialog */
4629  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4630  NULL,
4631  SCIPdialogExecSetParam, SCIPdialogDescSetParam, NULL,
4632  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4633  SCIP_CALL( SCIPaddDialogEntry(scip, advmenu, paramdialog) );
4634  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4635  }
4636  }
4637  else
4638  {
4639  /* create a parameter change dialog */
4640  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4641  NULL,
4642  SCIPdialogExecSetParam, SCIPdialogDescSetParam, NULL,
4643  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4644  SCIP_CALL( SCIPaddDialogEntry(scip, menu, paramdialog) );
4645  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4646  }
4647  }
4648  }
4649  else
4650  {
4651  SCIP_DIALOG* submenu;
4652 
4653  /* split the parameter name into dirname and parameter name */
4654  dirname = paramname;
4655  paramname = slash+1;
4656  *slash = '\0';
4657 
4658  /* if not yet existing, create a corresponding sub menu */
4659  if( !SCIPdialogHasEntry(menu, dirname) )
4660  {
4661  char desc[SCIP_MAXSTRLEN];
4662 
4663  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "parameters for <%s>", dirname);
4664  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4665  NULL,
4666  SCIPdialogExecMenu, NULL, NULL, dirname, desc, TRUE, NULL) );
4667  SCIP_CALL( SCIPaddDialogEntry(scip, menu, submenu) );
4668  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4669  }
4670 
4671  /* find the corresponding sub menu */
4672  (void)SCIPdialogFindEntry(menu, dirname, &submenu);
4673  if( submenu == NULL )
4674  {
4675  SCIPerrorMessage("dialog sub menu not found\n");
4676  return SCIP_PLUGINNOTFOUND;
4677  }
4678 
4679  /* recursively call add parameter method */
4680  SCIP_CALL( addSetParamDialog(scip, submenu, param, paramname) );
4681  }
4682 
4683  return SCIP_OKAY;
4684 }
4685 
4686 /** if a '/' occurs in the parameter's name, adds a sub menu dialog to the given menu and inserts the parameter dialog
4687  * recursively in the sub menu; if no '/' occurs in the name, adds a fix parameter dialog into the given dialog menu
4688  */
4689 static
4691  SCIP* scip, /**< SCIP data structure */
4692  SCIP_DIALOG* menu, /**< dialog menu to insert the parameter into */
4693  SCIP_PARAM* param, /**< parameter to add a dialog for */
4694  char* paramname /**< parameter name to parse */
4695  )
4696 {
4697  char* slash;
4698  char* dirname;
4699 
4700  assert(paramname != NULL);
4701 
4702  /* check for a '/' */
4703  slash = strchr(paramname, '/');
4704 
4705  if( slash == NULL )
4706  {
4707  /* check, if the corresponding dialog already exists */
4708  if( !SCIPdialogHasEntry(menu, paramname) )
4709  {
4710  SCIP_DIALOG* paramdialog;
4711 
4712  if( SCIPparamIsAdvanced(param) )
4713  {
4714  SCIP_DIALOG* advmenu;
4715 
4716  if( !SCIPdialogHasEntry(menu, "advanced") )
4717  {
4718  /* if not yet existing, create an advanced sub menu */
4719  char desc[SCIP_MAXSTRLEN];
4720 
4721  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "advanced parameters");
4722  SCIP_CALL( SCIPincludeDialog(scip, &advmenu,
4723  NULL,
4724  SCIPdialogExecMenu, NULL, NULL, "advanced", desc, TRUE, NULL) );
4725  SCIP_CALL( SCIPaddDialogEntry(scip, menu, advmenu) );
4726  SCIP_CALL( SCIPreleaseDialog(scip, &advmenu) );
4727  }
4728 
4729  /* find the corresponding sub menu */
4730  (void)SCIPdialogFindEntry(menu, "advanced", &advmenu);
4731  if( advmenu == NULL )
4732  {
4733  SCIPerrorMessage("dialog sub menu not found\n");
4734  return SCIP_PLUGINNOTFOUND;
4735  }
4736 
4737  if( !SCIPdialogHasEntry(advmenu, paramname) )
4738  {
4739  /* create a fix parameter dialog */
4740  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4741  NULL,
4742  SCIPdialogExecFixParam, SCIPdialogDescFixParam, NULL,
4743  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4744  SCIP_CALL( SCIPaddDialogEntry(scip, advmenu, paramdialog) );
4745  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4746  }
4747  }
4748  else
4749  {
4750  /* create a fix parameter dialog */
4751  SCIP_CALL( SCIPincludeDialog(scip, &paramdialog,
4752  NULL,
4753  SCIPdialogExecFixParam, SCIPdialogDescFixParam, NULL,
4754  paramname, SCIPparamGetDesc(param), FALSE, (SCIP_DIALOGDATA*)param) );
4755  SCIP_CALL( SCIPaddDialogEntry(scip, menu, paramdialog) );
4756  SCIP_CALL( SCIPreleaseDialog(scip, &paramdialog) );
4757  }
4758  }
4759  }
4760  else
4761  {
4762  SCIP_DIALOG* submenu;
4763 
4764  /* split the parameter name into dirname and parameter name */
4765  dirname = paramname;
4766  paramname = slash+1;
4767  *slash = '\0';
4768 
4769  /* if not yet existing, create a corresponding sub menu */
4770  if( !SCIPdialogHasEntry(menu, dirname) )
4771  {
4772  char desc[SCIP_MAXSTRLEN];
4773 
4774  (void) SCIPsnprintf(desc, SCIP_MAXSTRLEN, "parameters for <%s>", dirname);
4775  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4776  NULL,
4777  SCIPdialogExecMenu, NULL, NULL, dirname, desc, TRUE, NULL) );
4778  SCIP_CALL( SCIPaddDialogEntry(scip, menu, submenu) );
4779  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4780  }
4781 
4782  /* find the corresponding sub menu */
4783  (void)SCIPdialogFindEntry(menu, dirname, &submenu);
4784  if( submenu == NULL )
4785  {
4786  SCIPerrorMessage("dialog sub menu not found\n");
4787  return SCIP_PLUGINNOTFOUND;
4788  }
4789 
4790  /* recursively call add parameter method */
4791  SCIP_CALL( addFixParamDialog(scip, submenu, param, paramname) );
4792  }
4793 
4794  return SCIP_OKAY;
4795 }
4796 
4797 /** create a "emphasis" sub menu */
4798 static
4800  SCIP* scip, /**< SCIP data structure */
4801  SCIP_DIALOG* root, /**< the menu to add the empty sub menu */
4802  SCIP_DIALOG** submenu /**< pointer to store the created emphasis sub menu */
4803  )
4804 {
4805  if( !SCIPdialogHasEntry(root, "emphasis") )
4806  {
4807  SCIP_CALL( SCIPincludeDialog(scip, submenu,
4808  NULL, SCIPdialogExecMenu, NULL, NULL,
4809  "emphasis", "predefined parameter settings", TRUE, NULL) );
4810  SCIP_CALL( SCIPaddDialogEntry(scip, root, *submenu) );
4811  SCIP_CALL( SCIPreleaseDialog(scip, submenu) );
4812  }
4813  else if( SCIPdialogFindEntry(root, "emphasis", submenu) != 1 )
4814  {
4815  SCIPerrorMessage("emphasis sub menu not found\n");
4816  return SCIP_PLUGINNOTFOUND;
4817  }
4818 
4819  assert(*submenu != NULL);
4820 
4821  return SCIP_OKAY;
4822 }
4823 
4824 
4825 /** includes or updates the "set" menu for each available parameter setting */
4827  SCIP* scip /**< SCIP data structure */
4828  )
4829 {
4830  SCIP_DIALOG* root;
4831  SCIP_DIALOG* setmenu;
4832  SCIP_DIALOG* emphasismenu;
4833  SCIP_DIALOG* submenu;
4834  SCIP_DIALOG* dialog;
4835  SCIP_PARAM** params;
4836  char* paramname;
4837  int nparams;
4838  int i;
4839 
4840  SCIP_BRANCHRULE** branchrules;
4841  SCIP_CONFLICTHDLR** conflicthdlrs;
4842  SCIP_CONSHDLR** conshdlrs;
4843  SCIP_DISP** disps;
4844  SCIP_HEUR** heurs;
4845  SCIP_NLPI** nlpis;
4846  SCIP_NODESEL** nodesels;
4847  SCIP_PRESOL** presols;
4848  SCIP_PRICER** pricers;
4849  SCIP_READER** readers;
4850  SCIP_SEPA** sepas;
4851  int nbranchrules;
4852  int nconflicthdlrs;
4853  int nconshdlrs;
4854  int ndisps;
4855  int nheurs;
4856  int nnlpis;
4857  int nnodesels;
4858  int npresols;
4859  int npricers;
4860  int nreaders;
4861  int nsepas;
4862 
4863  /* get root dialog */
4864  root = SCIPgetRootDialog(scip);
4865  if( root == NULL )
4866  {
4867  SCIPerrorMessage("root dialog not found\n");
4868  return SCIP_PLUGINNOTFOUND;
4869  }
4870 
4871  /* find (or create) the "set" menu of the root dialog */
4872  if( !SCIPdialogHasEntry(root, "set") )
4873  {
4874  SCIP_CALL( SCIPincludeDialog(scip, &setmenu,
4875  NULL, SCIPdialogExecMenu, NULL, NULL,
4876  "set", "load/save/change parameters", TRUE, NULL) );
4877  SCIP_CALL( SCIPaddDialogEntry(scip, root, setmenu) );
4878  SCIP_CALL( SCIPreleaseDialog(scip, &setmenu) );
4879  }
4880  if( SCIPdialogFindEntry(root, "set", &setmenu) != 1 )
4881  {
4882  SCIPerrorMessage("set sub menu not found\n");
4883  return SCIP_PLUGINNOTFOUND;
4884  }
4885 
4886  /* set default */
4887  if( !SCIPdialogHasEntry(setmenu, "default") )
4888  {
4889  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4890  NULL,
4891  SCIPdialogExecSetDefault, NULL, NULL,
4892  "default", "reset parameter settings to their default values", FALSE, NULL) );
4893  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, dialog) );
4894  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4895  }
4896 
4897  /* set load */
4898  if( !SCIPdialogHasEntry(setmenu, "load") )
4899  {
4900  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4901  NULL,
4902  SCIPdialogExecSetLoad, NULL, NULL,
4903  "load", "load parameter settings from a file", FALSE, NULL) );
4904  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, dialog) );
4905  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4906  }
4907 
4908  /* set save */
4909  if( !SCIPdialogHasEntry(setmenu, "save") )
4910  {
4911  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4912  NULL,
4913  SCIPdialogExecSetSave, NULL, NULL,
4914  "save", "save parameter settings to a file", FALSE, NULL) );
4915  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, dialog) );
4916  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4917  }
4918 
4919  /* set diffsave */
4920  if( !SCIPdialogHasEntry(setmenu, "diffsave") )
4921  {
4922  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4923  NULL,
4924  SCIPdialogExecSetDiffsave, NULL, NULL,
4925  "diffsave", "save non-default parameter settings to a file", FALSE, NULL) );
4926  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, dialog) );
4927  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4928  }
4929 
4930  /* set branching */
4931  if( !SCIPdialogHasEntry(setmenu, "branching") )
4932  {
4933  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4934  NULL,
4935  SCIPdialogExecMenu, NULL, NULL,
4936  "branching", "change parameters for branching rules", TRUE, NULL) );
4937  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4938  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4939  }
4940  if( SCIPdialogFindEntry(setmenu, "branching", &submenu) != 1 )
4941  {
4942  SCIPerrorMessage("branching sub menu not found\n");
4943  return SCIP_PLUGINNOTFOUND;
4944  }
4945 
4946  nbranchrules = SCIPgetNBranchrules(scip);
4947  branchrules = SCIPgetBranchrules(scip);
4948 
4949  for( i = 0; i < nbranchrules; ++i )
4950  {
4951  if( !SCIPdialogHasEntry(submenu, SCIPbranchruleGetName(branchrules[i])) )
4952  {
4953  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4954  NULL,
4955  SCIPdialogExecMenu, NULL, NULL,
4956  SCIPbranchruleGetName(branchrules[i]), SCIPbranchruleGetDesc(branchrules[i]), TRUE, NULL) );
4957  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4958  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4959  }
4960  }
4961 
4962  /* set branching priority */
4963  if( !SCIPdialogHasEntry(submenu, "priority") )
4964  {
4965  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4966  NULL,
4967  SCIPdialogExecSetBranchingPriority, NULL, NULL,
4968  "priority", "change branching priority of a single variable", FALSE, NULL) );
4969  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4970  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4971  }
4972 
4973  /* set branching direction */
4974  if( !SCIPdialogHasEntry(submenu, "direction") )
4975  {
4976  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
4977  NULL,
4978  SCIPdialogExecSetBranchingDirection, NULL, NULL,
4979  "direction", "change preferred branching direction of a single variable (-1:down, 0:auto, +1:up)",
4980  FALSE, NULL) );
4981  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
4982  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
4983  }
4984 
4985  /* set conflict */
4986  if( !SCIPdialogHasEntry(setmenu, "conflict") )
4987  {
4988  SCIP_CALL( SCIPincludeDialog(scip, &submenu,
4989  NULL,
4990  SCIPdialogExecMenu, NULL, NULL,
4991  "conflict", "change parameters for conflict handlers", TRUE, NULL) );
4992  SCIP_CALL( SCIPaddDialogEntry(scip, setmenu, submenu) );
4993  SCIP_CALL( SCIPreleaseDialog(scip, &submenu) );
4994  }
4995  if( SCIPdialogFindEntry(setmenu, "conflict", &submenu) != 1 )
4996  {
4997  SCIPerrorMessage("conflict sub menu not found\n");
4998  return SCIP_PLUGINNOTFOUND;
4999  }
5000 
5001  nconflicthdlrs = SCIPgetNConflicthdlrs(scip);