Scippy

SCIP

Solving Constraint Integer Programs

src/main.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-2021 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 scip/src/main.c
17  * @ingroup OTHER_CFILES
18  * @brief main file for C compilation
19  * @author Tobias Achterberg
20  */
21 
22 /* global todos: */
23 
24 /**@todo pricing for pseudo solutions */
25 /**@todo unboundness detection in presolving -> convert problem into feasibility problem to decide
26  * unboundness/infeasibility */
27 /**@todo variable event PSSOLCHANGED, update pseudo activities in constraints to speed up checking of pseudo solutions */
28 /**@todo branching rule acting as a filter by temporary changing the branching priority of variables and returning
29  * SCIP_DIDNOTFIND to let the next branching rule select the branching variable */
30 /**@todo try to not use the first but the shortest constraint as reason for a deduction */
31 
32 /*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33 
34 #include <stdio.h>
35 #include <signal.h>
36 
37 #include "scip/scip.h"
38 #include "scip/scipshell.h"
39 #include "scip/interrupt.h"
40 
41 /** callback function for handling signals */ /*lint -e715*/
42 static
44  int signum /**< signal code */
45  )
46 { /*lint --e{715}*/
47  /* Calling the following function is not directly async-signal-safe, since it counts how often the function is
48  * called. For achieving the goal of terminating this seems unproblematic. */
49  SCIPtryTerminate(); /*lint !e2761*/
50 }
51 
52 /** main method starting SCIP */
53 int main(
54  int argc, /**< number of arguments from the shell */
55  char** argv /**< array of shell arguments */
56  )
57 {
58  SCIP_RETCODE retcode;
59 
60  (void)signal(SIGTERM, handleSigterm);
61  /* run interactive shell */
62  retcode = SCIPrunShell(argc, argv, "scip.set");
63 
64  /* evaluate retrun code of the SCIP process */
65  if( retcode != SCIP_OKAY )
66  {
67  /* write error back trace */
68  SCIPprintError(retcode);
69  return -1;
70  }
71 
72  return 0;
73 }
void SCIPprintError(SCIP_RETCODE retcode)
Definition: scip_general.c:211
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP command line interface.
SCIP_RETCODE SCIPrunShell(int argc, char **argv, const char *defaultsetname)
Definition: scipshell.c:427
methods for catching the user CTRL-C interrupt
static void handleSigterm(int signum)
Definition: main.c:43
void SCIPtryTerminate(void)
Definition: interrupt.c:173
int main(int argc, char **argv)
Definition: main.c:53
SCIP callable library.