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 Binpacking/src/cmain.c
26  * @brief Main file for binpacking pricing example
27  * @author Timo Berthold
28  * @author Stefan Heinz
29  *
30  * This the file contains the \ref main() main function of the projects. This includes all the default plugins of
31  * \SCIP and the once which belong to that projects. After that is starts the interactive shell of \SCIP or processes
32  * the shell arguments if given.
33  */
34 #include <stdio.h>
35 
36 #include "scip/scip.h"
37 #include "scip/scipshell.h"
38 #include "scip/scipdefplugins.h"
39 
40 #include "branch_ryanfoster.h"
41 #include "cons_samediff.h"
42 #include "pricer_binpacking.h"
43 #include "reader_bpa.h"
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 binpacking reader */
69 
70  /* include binpacking branching and branching data */
73 
74  /* include binpacking pricer */
76 
77  /* include default SCIP plugins */
79 
80  /* for column generation instances, disable restarts */
81  SCIP_CALL( SCIPsetIntParam(scip,"presolving/maxrestarts",0) );
82 
83  /* turn off all separation algorithms */
85 
86  /**********************************
87  * Process command line arguments *
88  **********************************/
89  SCIP_CALL( SCIPprocessShellArguments(scip, argc, argv, defaultsetname) );
90 
91  /********************
92  * Deinitialization *
93  ********************/
94 
95  SCIP_CALL( SCIPfree(&scip) );
96 
98 
99  return SCIP_OKAY;
100 }
101 
102 int
104  int argc,
105  char** argv
106  )
107 {
108  SCIP_RETCODE retcode;
109 
110  retcode = runShell(argc, argv, "scip.set");
111  if( retcode != SCIP_OKAY )
112  {
113  SCIPprintError(retcode);
114  return -1;
115  }
116 
117  return 0;
118 }
119 
SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip_param.c:979
#define NULL
Definition: def.h:267
#define BMScheckEmptyMemory()
Definition: memory.h:155
Ryan/Foster branching rule.
static SCIP_RETCODE runShell(int argc, char **argv, const char *defaultsetname)
Definition: cmain.c:49
SCIP_RETCODE SCIPincludeReaderBpa(SCIP *scip)
Definition: reader_bpa.c:257
SCIP_RETCODE SCIPincludePricerBinpacking(SCIP *scip)
SCIP_RETCODE SCIPincludeBranchruleRyanFoster(SCIP *scip)
Constraint handler stores the local branching decision data.
Binpacking variable pricer.
#define TRUE
Definition: def.h:93
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:307
int main(int argc, char **argv)
Definition: cmain.c:111
SCIP command line interface.
#define SCIP_CALL(x)
Definition: def.h:380
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
SCIP_RETCODE SCIPincludeConshdlrSamediff(SCIP *scip)
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
Binpacking problem reader file reader.
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
void SCIPenableDebugSol(SCIP *scip)
Definition: scip_debug.c:57