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-2016 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 email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file cmain.c
17  * @brief Main file for binpacking pricing example
18  * @author Timo Berthold
19  * @author Stefan Heinz
20  *
21  * This the file contains the \ref main() main function of the projects. This includes all the default plugins of
22  * \SCIP and the once which belong to that projects. After that is starts the interactive shell of \SCIP or processes
23  * the shell arguments if given.
24  */
25 #include <stdio.h>
26 
27 #include "scip/scip.h"
28 #include "scip/scipshell.h"
29 #include "scip/scipdefplugins.h"
30 
31 #include "branch_ryanfoster.h"
32 #include "cons_samediff.h"
33 #include "pricer_binpacking.h"
34 #include "reader_bpa.h"
35 
36 /** creates a SCIP instance with default plugins, evaluates command line parameters, runs SCIP appropriately,
37  * and frees the SCIP instance
38  */
39 static
40 SCIP_RETCODE runShell(
41  int argc, /**< number of shell parameters */
42  char** argv, /**< array with shell parameters */
43  const char* defaultsetname /**< name of default settings file */
44  )
45 {
46  SCIP* scip = NULL;
47 
48  /*********
49  * Setup *
50  *********/
51 
52  /* initialize SCIP */
53  SCIP_CALL( SCIPcreate(&scip) );
54 
55  /* we explicitly enable the use of a debug solution for this main SCIP instance */
56  SCIPenableDebugSol(scip);
57 
58  /* include binpacking reader */
59  SCIP_CALL( SCIPincludeReaderBpa(scip) );
60 
61  /* include binpacking branching and branching data */
62  SCIP_CALL( SCIPincludeBranchruleRyanFoster(scip) );
63  SCIP_CALL( SCIPincludeConshdlrSamediff(scip) );
64 
65  /* include binpacking pricer */
66  SCIP_CALL( SCIPincludePricerBinpacking(scip) );
67 
68  /* include default SCIP plugins */
69  SCIP_CALL( SCIPincludeDefaultPlugins(scip) );
70 
71  /* for column generation instances, disable restarts */
72  SCIP_CALL( SCIPsetIntParam(scip,"presolving/maxrestarts",0) );
73 
74  /* turn off all separation algorithms */
75  SCIP_CALL( SCIPsetSeparating(scip, SCIP_PARAMSETTING_OFF, TRUE) );
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 
88  BMScheckEmptyMemory();
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 }
110 
Ryan/Foster branching rule.
SCIP_RETCODE SCIPincludeReaderBpa(SCIP *scip)
Definition: reader_bpa.c:249
SCIP_RETCODE SCIPincludePricerBinpacking(SCIP *scip)
int main(int argc, char **argv)
Definition: cmain.c:94
SCIP_RETCODE SCIPincludeBranchruleRyanFoster(SCIP *scip)
Constraint handler stores the local branching decision data.
Binpacking variable pricer.
static SCIP_RETCODE runShell(int argc, char **argv, const char *defaultsetname)
Definition: cmain.c:40
SCIP_RETCODE SCIPincludeConshdlrSamediff(SCIP *scip)
Binpacking problem reader file reader.