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