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-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 Ringpacking/src/cmain.c
26  * @brief Main file for ringpacking pricing example
27  * @author Benjamin Mueller
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 ones 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 
39 #include "cons_rpa.h"
40 #include "reader_rpa.h"
41 #include "pricer_rpa.h"
42 
43 #define DEFAULT_TEXFILENAME "" /**< filename for tex output for the best found solution (\"\": disable) */
44 
45 /** creates a SCIP instance with default plugins, evaluates command line parameters, runs SCIP appropriately,
46  * and frees the SCIP instance
47  */
48 static
50  int argc, /**< number of shell parameters */
51  char** argv, /**< array with shell parameters */
52  const char* defaultsetname /**< name of default settings file */
53  )
54 {
55  SCIP* scip = NULL;
56 
57  /*********
58  * Setup *
59  *********/
60 
61  /* initialize SCIP */
62  SCIP_CALL( SCIPcreate(&scip) );
63 
64  /* we explicitly enable the use of a debug solution for this main SCIP instance */
65  SCIPenableDebugSol(scip);
66 
67  /* include default SCIP plugins */
69 
70  /* include reader for ringpacking instances */
72 
73  /* include ringpacking constraint handler */
75 
76  /* include ringpacking pricer */
78 
79  /* for column generation instances, disable restarts */
80  SCIP_CALL( SCIPsetIntParam(scip,"presolving/maxrestarts",0) );
81 
82  /* turn off all separation algorithms */
84 
85  /*
86  * miscellaneous parameters
87  */
88 
90  "ringpacking/texfilename",
91  "filename for tex output for the best found solution (\"\": disable)",
93 
94  /**********************************
95  * Process command line arguments *
96  **********************************/
97  SCIP_CALL( SCIPprocessShellArguments(scip, argc, argv, defaultsetname) );
98 
99  /********************
100  * Deinitialization *
101  ********************/
102 
103  SCIP_CALL( SCIPfree(&scip) );
104 
106 
107  return SCIP_OKAY;
108 }
109 
110 int
112  int argc,
113  char** argv
114  )
115 {
116  SCIP_RETCODE retcode;
117 
118  retcode = runShell(argc, argv, "scip.set");
119  if( retcode != SCIP_OKAY )
120  {
121  SCIPprintError(retcode);
122  return -1;
123  }
124 
125  return 0;
126 }
SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip_param.c:958
#define BMScheckEmptyMemory()
Definition: memory.h:157
#define FALSE
Definition: def.h:96
#define TRUE
Definition: def.h:95
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
SCIP_RETCODE SCIPincludeReaderRpa(SCIP *scip)
Definition: reader_rpa.c:284
SCIP_RETCODE SCIPaddStringParam(SCIP *scip, const char *name, const char *desc, char **valueptr, SCIP_Bool isadvanced, const char *defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:194
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:292
int main(int argc, char **argv)
Definition: cmain.c:111
SCIP_RETCODE SCIPincludeConshdlrRpa(SCIP *scip)
Definition: cons_rpa.c:687
SCIP command line interface.
#define NULL
Definition: lpi_spx1.cpp:164
#define SCIP_CALL(x)
Definition: def.h:394
constraint handler for ringpacking
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
SCIP_RETCODE SCIPincludePricerRpa(SCIP *scip)
Definition: pricer_rpa.c:920
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip_param.c:487
static SCIP_RETCODE runShell(int argc, char **argv, const char *defaultsetname)
Definition: cmain.c:49
SCIP_RETCODE SCIPprocessShellArguments(SCIP *scip, int argc, char **argv, const char *defaultsetname)
Definition: scipshell.c:243
#define DEFAULT_TEXFILENAME
Definition: cmain.c:43
Ringpacking variable pricer.
void SCIPprintError(SCIP_RETCODE retcode)
Definition: scip_general.c:220
default SCIP plugins
SCIP callable library.
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:324
void SCIPenableDebugSol(SCIP *scip)
Definition: scip_debug.c:57