SCIP-SDP  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
main.cpp
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of SCIPSDP - a solving framework for mixed-integer */
4 /* semidefinite programms based on SCIP. */
5 /* */
6 /* Copyright (C) 2011-2013 Discrete Optimization, TU Darmstadt */
7 /* EDOM, FAU Erlangen-Nürnberg */
8 /* 2014-2015 Discrete Optimization, TU Darmstadt */
9 /* */
10 /* */
11 /* This program is free software; you can redistribute it and/or */
12 /* modify it under the terms of the GNU Lesser General Public License */
13 /* as published by the Free Software Foundation; either version 3 */
14 /* of the License, or (at your option) any later version. */
15 /* */
16 /* This program is distributed in the hope that it will be useful, */
17 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
18 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
19 /* GNU Lesser General Public License for more details. */
20 /* */
21 /* You should have received a copy of the GNU Lesser General Public License */
22 /* along with this program; if not, write to the Free Software */
23 /* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.*/
24 /* */
25 /* */
26 /* Based on SCIP - Solving Constraint Integer Programs */
27 /* Copyright (C) 2002-2015 Zuse Institute Berlin */
28 /* SCIP is distributed under the terms of the SCIP Academic Licence, */
29 /* see file COPYING in the SCIP distribution. */
30 /* */
31 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
32 
39 #include "objscip/objscipdefplugins.h"
40 
41 #include "cons_sdp.h"
42 #include "relax_sdp.h"
43 #include "objreader_sdpa.h"
44 #include "prop_sdpredcost.h"
45 #include "disp_sdpiterations.h"
46 #include "disp_sdpavgiterations.h"
47 #include "branch_sdpmostfrac.h"
48 #include "branch_sdpmostinf.h"
49 #include "branch_sdpobjective.h"
50 #include "branch_sdpinfobjective.h"
51 
52 using namespace scip;
53 
55 static
56 SCIP_RETCODE runSCIP(
57  int argc,
58  char** argv
59  )
60 {
61  SCIP* scip = NULL;
62 
63  SCIP_CALL( SCIPcreate(&scip) );
64 
65  /* include new plugins */
66  SCIP_CALL( SCIPincludeObjReader(scip, new ObjReaderSDPA(scip), TRUE) );
67  SCIP_CALL( SCIPincludeConshdlrSdp(scip) );
68  SCIP_CALL( SCIPincludeRelaxSdp(scip) );
69  SCIP_CALL( SCIPincludePropSdpredcost(scip) );
70  SCIP_CALL( SCIPincludeBranchruleSdpmostfrac(scip) );
71  SCIP_CALL( SCIPincludeBranchruleSdpmostinf(scip) );
72  SCIP_CALL( SCIPincludeBranchruleSdpobjective(scip) );
73  SCIP_CALL( SCIPincludeBranchruleSdpinfobjective(scip) );
74 
75  /* include default SCIP plugins */
76  SCIP_CALL( SCIPincludeDefaultPlugins(scip) );
77 
78  /* disable subscips - for the meantime */
79  SCIP_CALL( SCIPsetSubscipsOff(scip, TRUE) );
80 
81  /* disable restarts - for the meantime */
82  SCIP_CALL( SCIPsetIntParam(scip, "limits/restarts", 0) );
83 
84  /* set clocktype to walltime to not add multiple threads together */
85  SCIP_CALL( SCIPsetIntParam(scip, "timing/clocktype", 2) );
86 
87  /* change certain paramters: */
88  SCIP_CALL( SCIPsetIntParam(scip, "display/verblevel", 5) );
89 
90  /* Choose between LP and SDP relaxations */
91  SCIP_CALL( SCIPsetIntParam(scip, "lp/solvefreq", -1) );
92  SCIP_CALL( SCIPsetIntParam(scip, "relaxing/SDP/freq", 1) );
93  SCIP_CALL( SCIPincludeDispSdpiterations(scip) );
94  SCIP_CALL( SCIPincludeDispSdpavgiterations(scip) );
95  SCIP_CALL( SCIPsetIntParam(scip, "display/lpiterations/active", 0) );
96  SCIP_CALL( SCIPsetIntParam(scip, "display/lpavgiterations/active", 0) );
97 
98  /* change epsilons for numerical stability */
99  SCIP_CALL( SCIPsetRealParam(scip, "numerics/epsilon", 1e-5) );
100  SCIP_CALL( SCIPsetRealParam(scip, "numerics/sumepsilon", 1e-3) );
101  SCIP_CALL( SCIPsetRealParam(scip, "numerics/feastol", 1e-4) );
102 
103  /* parameters for separation */
104  SCIP_CALL( SCIPsetBoolParam(scip, "lp/cleanuprows", FALSE) );
105  SCIP_CALL( SCIPsetBoolParam(scip, "lp/cleanuprowsroot", FALSE) );
106  SCIP_CALL( SCIPsetIntParam(scip, "lp/rowagelimit", 10) );
107 
108  /* maximum age a cut can reach before it is deleted from the global cut pool, or -1 to keep all cuts */
109  SCIP_CALL( SCIPsetIntParam(scip, "separating/cutagelimit", 10) );
110 
111  SCIP_CALL( SCIPsetIntParam(scip, "separating/maxrounds", 20) );
112 
113  /* Parameters for node selection */
114 
115  /* Because in the SDP-world there are no warmstarts as for LPs, the main advantage for DFS (that the change in the
116  * problem is minimal and therefore the Simplex can continue with the current Basis) is lost and best first search, which
117  * provably needs the least number of nodes (see the Dissertation of Tobias Achterberg, the node selection rule with
118  * the least number of nodes, allways has to be a best first search), is the optimal choice
119  */
120  SCIP_CALL( SCIPsetIntParam(scip, "nodeselection/hybridestim/stdpriority", 1000000) );
121  SCIP_CALL( SCIPsetIntParam(scip, "nodeselection/hybridestim/maxplungedepth", 0) );
122  SCIP_CALL( SCIPsetRealParam(scip, "nodeselection/hybridestim/estimweight", 0.0) );
123 
124  /* run interactive shell */
125  SCIP_CALL( SCIPprocessShellArguments(scip, argc, argv, "scip.set") );
126 
127  /* deinitialization */
128  SCIP_CALL( SCIPfree(&scip) );
129 
130  BMScheckEmptyMemory();
131 
132  return SCIP_OKAY;
133 }
134 
136 int main (
137  int argc,
138  char** argv
139  )
140 {
141  SCIP_RETCODE retcode;
142 
143  retcode = runSCIP(argc, argv);
144  if( retcode != SCIP_OKAY )
145  {
146  SCIPprintError(retcode);
147  return -1;
148  }
149 
150  return 0;
151 }
int main(int argc, char **argv)
Definition: main.cpp:136
SCIP_RETCODE SCIPincludeConshdlrSdp(SCIP *scip)
Definition: cons_sdp.c:2013
SDP relaxator.
most fractional branching rule for SCIPSDP
Reader for SDPA-Files.
SCIP_RETCODE SCIPincludeBranchruleSdpmostinf(SCIP *scip)
highest absolute objective branching rule for SCIPSDP
combined infeasibility and absolute objective branching rule for SCIPSDP
SCIP_RETCODE SCIPincludeBranchruleSdpmostfrac(SCIP *scip)
most infeasible branching rule for SCIPSDP
Constraint handler for SDP-constraints.
SCIP_RETCODE SCIPincludeDispSdpavgiterations(SCIP *scip)
Column to display the total number of SDP iterations.
SCIP_RETCODE SCIPincludeBranchruleSdpinfobjective(SCIP *scip)
reduced cost fixing for SDPs
static SCIP_RETCODE runSCIP(int argc, char **argv)
Definition: main.cpp:56
SCIP_RETCODE SCIPincludeBranchruleSdpobjective(SCIP *scip)
Column to display the average number of SDP iterations.
SCIP_RETCODE SCIPincludePropSdpredcost(SCIP *scip)
SCIP_RETCODE SCIPincludeDispSdpiterations(SCIP *scip)
SCIP_RETCODE SCIPincludeRelaxSdp(SCIP *scip)
Definition: relax_sdp.c:964