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 SCFLP/src/cmain.c
17  * @brief Main file for capacitated facility location example
18  * @author Stephen J. Maher
19  *
20  * This the file contains the \ref main() main function of the projects. This includes all the default plugins of
21  * \SCIP and the once which belong to that projects. After that is starts the interactive shell of \SCIP or processes
22  * the shell arguments if given.
23  */
24 #include <stdio.h>
25 
26 #include "scip/scip.h"
27 #include "scip/scipshell.h"
28 #include "scip/scipdefplugins.h"
29 #include "scip/cons_benders.h"
30 #include "scip/cons_benderslp.h"
31 #include "scip/benders_default.h"
32 
33 #include "reader_scflp.h"
34 
35 /** creates a SCIP instance with default plugins, evaluates command line parameters, runs SCIP appropriately,
36  * and frees the SCIP instance
37  */
38 static
40  int argc, /**< number of shell parameters */
41  char** argv, /**< array with shell parameters */
42  const char* defaultsetname /**< name of default settings file */
43  )
44 {
45  SCIP* scip = NULL;
46 
47  /*********
48  * Setup *
49  *********/
50 
51  /* initialize SCIP */
52  SCIP_CALL( SCIPcreate(&scip) );
53 
54  /* include SCFLP reader */
56 
57  /* include default SCIP plugins */
59 
60  /* for Benders' decomposition instances restarts must be disabled */
61  SCIP_CALL( SCIPsetIntParam(scip,"presolving/maxrestarts",0) );
62 
63  /* activating the trysol heuristic so that solutions checked by the Benders' decomposition subproblems are added to
64  * the main SCIP
65  */
66  SCIP_CALL( SCIPsetIntParam(scip, "heuristics/trysol/freq", 1) );
67 
68  /**********************************
69  * Process command line arguments *
70  **********************************/
71  SCIP_CALL( SCIPprocessShellArguments(scip, argc, argv, defaultsetname) );
72 
73  /********************
74  * Deinitialization *
75  ********************/
76 
77  SCIP_CALL( SCIPfree(&scip) );
78 
80 
81  return SCIP_OKAY;
82 }
83 
84 int
86  int argc,
87  char** argv
88  )
89 {
90  SCIP_RETCODE retcode;
91 
92  retcode = runShell(argc, argv, "scip.set");
93  if( retcode != SCIP_OKAY )
94  {
95  SCIPprintError(retcode);
96  return -1;
97  }
98 
99  return 0;
100 }
void SCIPprintError(SCIP_RETCODE retcode)
Definition: scip_general.c:211
constraint handler for Benders&#39; decomposition
#define BMScheckEmptyMemory()
Definition: memory.h:147
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
static SCIP_RETCODE runShell(int argc, char **argv, const char *defaultsetname)
Definition: cmain.c:39
int main(int argc, char **argv)
Definition: cmain.c:102
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:283
SCIP command line interface.
SCFLP problem reader file reader.
#define NULL
Definition: lpi_spx1.cpp:155
#define SCIP_CALL(x)
Definition: def.h:364
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
SCIP_RETCODE SCIPincludeReaderScflp(SCIP *scip)
Definition: reader_scflp.c:466
SCIP_RETCODE SCIPprocessShellArguments(SCIP *scip, int argc, char **argv, const char *defaultsetname)
Definition: scipshell.c:148
constraint handler for benderslp decomposition
default Benders&#39; decomposition plugin
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:315
default SCIP plugins
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip_param.c:497
SCIP callable library.