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