Toggle navigation
SCIP Optimization Suite
SCIP
SoPlex
ZIMPL
UG
GCG
Documentation
SCIP 9.2.0
SCIP 8.1.0
SCIP 7.0.3
SCIP 6.0.2
SCIP 5.0.1
SCIP 4.0.1
SCIP 3.2.1
SCIP
Solving Constraint Integer Programs
examples
Eventhdlr
src
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-2018 Konrad-Zuse-Zentrum */
7
/* fuer Informationstechnik Berlin */
8
/* */
9
/* SCIP is distributed under the terms of the ZIB Academic License. */
10
/* */
11
/* You should have received a copy of the ZIB Academic License */
12
/* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
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
33
SCIP_RETCODE
runShell
(
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 */
49
SCIP_CALL
(
SCIPincludeDefaultPlugins
(scip) );
50
51
/* include event handler for best solution found */
52
SCIP_CALL
(
SCIPincludeEventHdlrBestsol
(scip) );
53
SCIP_CALL
(
SCIPincludeEventHdlrBoundwriting
(scip) );
54
55
/**********************************
56
* Process command line arguments *
57
**********************************/
58
59
SCIP_CALL
(
SCIPprocessShellArguments
(scip, argc, argv, defaultsetname) );
60
61
62
/********************
63
* Deinitialization *
64
********************/
65
66
SCIP_CALL
(
SCIPfree
(&scip) );
67
68
/* check block memory */
69
BMScheckEmptyMemory
();
70
71
return
SCIP_OKAY
;
72
}
73
74
/** main method */
75
int
main
(
76
int
argc,
/**< number of arguments */
77
char
** argv
/**< string array with arguments */
78
)
79
{
80
SCIP_RETCODE
retcode;
81
82
retcode =
runShell
(argc, argv,
"scip.set"
);
83
84
if
( retcode !=
SCIP_OKAY
)
85
{
86
SCIPprintError
(retcode);
87
return
-1;
88
}
89
90
return
0;
91
}
BMScheckEmptyMemory
#define BMScheckEmptyMemory()
Definition:
memory.h:137
Scip
Definition:
struct_scip.h:58
SCIP_RETCODE
enum SCIP_Retcode SCIP_RETCODE
Definition:
type_retcode.h:53
main
int main(int argc, char **argv)
Definition:
cmain.c:94
SCIPcreate
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition:
scip.c:748
runShell
static SCIP_RETCODE runShell(int argc, char **argv, const char *defaultsetname)
Definition:
cmain.c:33
scipshell.h
SCIP command line interface.
SCIPincludeEventHdlrBoundwriting
SCIP_RETCODE SCIPincludeEventHdlrBoundwriting(SCIP *scip)
Definition:
event_boundwriting.c:665
SCIP_OKAY
Definition:
type_retcode.h:33
SCIP_CALL
#define SCIP_CALL(x)
Definition:
def.h:350
event_boundwriting.h
event handler for writing primal- and dual bound for all open nodes
SCIPincludeDefaultPlugins
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
Definition:
scipdefplugins.c:27
event_bestsol.h
eventhdlr for best solution found
SCIPprocessShellArguments
SCIP_RETCODE SCIPprocessShellArguments(SCIP *scip, int argc, char **argv, const char *defaultsetname)
Definition:
scipshell.c:149
SCIPincludeEventHdlrBestsol
SCIP_RETCODE SCIPincludeEventHdlrBestsol(SCIP *scip)
Definition:
event_bestsol.c:100
SCIPprintError
void SCIPprintError(SCIP_RETCODE retcode)
Definition:
scip.c:676
scip
Definition:
objbranchrule.h:33
scipdefplugins.h
default SCIP plugins
scip.h
SCIP callable library.
SCIPfree
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition:
scip.c:780