Scippy

SCIP

Solving Constraint Integer Programs

cmain.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-2020 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file examples/Eventhdlr/src/cmain.c
17  * @brief Main file for C compilation
18  * @author Stefan Heinz
19  */
20 
21 /*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 
24 #include "scip/scip.h"
25 #include "scip/scipdefplugins.h"
26 #include "scip/scipshell.h"
27 
28 #include "event_bestsol.h"
29 #include "event_boundwriting.h"
30 
31 /** runs the shell */
32 static
34  int argc, /**< number of shell parameters */
35  char** argv, /**< array with shell parameters */
36  const char* defaultsetname /**< name of default settings file */
37  )
38 {
39  SCIP* scip = NULL;
40 
41  /*********
42  * Setup *
43  *********/
44 
45  /* initialize SCIP */
46  SCIP_CALL( SCIPcreate(&scip) );
47 
48  /* include default plugins */
50 
51  /* include event handler for best solution found */
54 
55  /**********************************
56  * Process command line arguments *
57  **********************************/
58 
59  SCIP_CALL( SCIPprocessShellArguments(scip, argc, argv, defaultsetname) );
60 
61  /********************
62  * Deinitialization *
63  ********************/
64 
65  SCIP_CALL( SCIPfree(&scip) );
66 
67  /* check block memory */
69 
70  return SCIP_OKAY;
71 }
72 
73 /** main method */
74 int main(
75  int argc, /**< number of shell parameters */
76  char** argv /**< array with shell parameters */
77  )
78 {
79  SCIP_RETCODE retcode;
80 
81  retcode = runShell(argc, argv, "scip.set");
82 
83  if( retcode != SCIP_OKAY )
84  {
85  SCIPprintError(retcode);
86  return -1;
87  }
88 
89  return 0;
90 }
void SCIPprintError(SCIP_RETCODE retcode)
Definition: scip_general.c:211
#define BMScheckEmptyMemory()
Definition: memory.h:147
static SCIP_RETCODE runShell(int argc, char **argv, const char *defaultsetname)
Definition: cmain.c:33
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
int main(int argc, char **argv)
Definition: cmain.c:102
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:283
SCIP command line interface.
SCIP_RETCODE SCIPincludeEventHdlrBoundwriting(SCIP *scip)
#define NULL
Definition: lpi_spx1.cpp:155
#define SCIP_CALL(x)
Definition: def.h:364
event handler for writing primal- and dual bound for all open nodes
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
SCIP_RETCODE SCIPprocessShellArguments(SCIP *scip, int argc, char **argv, const char *defaultsetname)
Definition: scipshell.c:148
SCIP_RETCODE SCIPincludeEventHdlrBestsol(SCIP *scip)
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:315
default SCIP plugins
eventhdlr for best solution found
SCIP callable library.