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