Scippy

SCIP

Solving Constraint Integer Programs

dialog_stp.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2019 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file dialog_stp.c
17  * @brief stp user interface dialog
18  * @author Gerald Gamrath
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #include <assert.h>
24 #include <string.h>
25 
26 #include "dialog_stp.h"
27 #include "probdata_stp.h"
28 
29 
30 /** dialog execution method for the write LP command */
31 static
32 SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteStpsol)
33 { /*lint --e{715}*/
34  SCIPdialogMessage(scip, NULL, "\n");
35 
37 
38  SCIPdialogMessage(scip, NULL, "written STP solution\n");
39 
40  *nextdialog = SCIPdialoghdlrGetRoot(dialoghdlr);
41 
42  return SCIP_OKAY;
43 }
44 
45 
46 
47 /** includes or updates the stp dialog menus in SCIP */
49  SCIP* scip /**< SCIP data structure */
50  )
51 {
52  SCIP_DIALOG* root;
53  SCIP_DIALOG* submenu;
54  SCIP_DIALOG* dialog;
55 
56  /* root menu */
57  root = SCIPgetRootDialog(scip);
58  assert(root != NULL);
59 
60  /* write */
61  assert(SCIPdialogHasEntry(root, "write"));
62  if( SCIPdialogFindEntry(root, "write", &submenu) != 1 )
63  {
64  SCIPerrorMessage("write sub menu not found\n");
65  return SCIP_PLUGINNOTFOUND;
66  }
67 
68  /* write STP solution */
69  if( !SCIPdialogHasEntry(submenu, "stpsolution") )
70  {
71  SCIP_CALL( SCIPincludeDialog(scip, &dialog,
72  NULL,
73  SCIPdialogExecWriteStpsol, NULL, NULL,
74  "stpsolution", "write solution to STP logfile", FALSE, NULL) );
75  SCIP_CALL( SCIPaddDialogEntry(scip, submenu, dialog) );
76  SCIP_CALL( SCIPreleaseDialog(scip, &dialog) );
77  }
78 
79  return SCIP_OKAY;
80 }
#define NULL
Definition: def.h:246
void SCIPdialogMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:262
SCIP_RETCODE SCIPaddDialogEntry(SCIP *scip, SCIP_DIALOG *dialog, SCIP_DIALOG *subdialog)
Definition: scip_dialog.c:242
#define FALSE
Definition: def.h:72
Problem data for stp problem.
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
int SCIPdialogFindEntry(SCIP_DIALOG *dialog, const char *entryname, SCIP_DIALOG **subdialog)
Definition: dialog.c:1015
SCIP_RETCODE SCIPprobdataWriteLogfileEnd(SCIP *scip)
SCIP_DIALOG * SCIPgetRootDialog(SCIP *scip)
Definition: scip_dialog.c:228
SCIP_RETCODE SCIPincludeDialog(SCIP *scip, SCIP_DIALOG **dialog, SCIP_DECL_DIALOGCOPY((*dialogcopy)), SCIP_DECL_DIALOGEXEC((*dialogexec)), SCIP_DECL_DIALOGDESC((*dialogdesc)), SCIP_DECL_DIALOGFREE((*dialogfree)), const char *name, const char *desc, SCIP_Bool issubmenu, SCIP_DIALOGDATA *dialogdata)
Definition: scip_dialog.c:130
#define SCIPerrorMessage
Definition: pub_message.h:45
stp user interface dialog
#define SCIP_CALL(x)
Definition: def.h:358
SCIP_Bool SCIPdialogHasEntry(SCIP_DIALOG *dialog, const char *entryname)
Definition: dialog.c:982
SCIP_RETCODE SCIPincludeDialogStp(SCIP *scip)
Definition: dialog_stp.c:48
SCIP_DIALOG * SCIPdialoghdlrGetRoot(SCIP_DIALOGHDLR *dialoghdlr)
Definition: dialog.c:423
SCIP_RETCODE SCIPreleaseDialog(SCIP *scip, SCIP_DIALOG **dialog)
Definition: scip_dialog.c:195
static SCIP_DECL_DIALOGEXEC(SCIPdialogExecWriteStpsol)
Definition: dialog_stp.c:32