SCIP-SDP  2.1.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-2016 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-2016 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 "cons_savedsdpsettings.h"
43 #include "relax_sdp.h"
44 #include "objreader_sdpa.h"
45 #include "prop_sdpredcost.h"
46 #include "disp_sdpiterations.h"
47 #include "disp_sdpavgiterations.h"
48 #include "disp_sdpfastsettings.h"
49 #include "disp_sdppenalty.h"
50 #include "disp_sdpunsolved.h"
51 #include "branch_sdpmostfrac.h"
52 #include "branch_sdpmostinf.h"
53 #include "branch_sdpobjective.h"
54 #include "branch_sdpinfobjective.h"
55 #include "heur_sdpfracdiving.h"
56 #include "heur_sdprand.h"
57 #include "prop_sdpobbt.h"
58 
59 using namespace scip;
60 
62 static
63 SCIP_RETCODE runSCIP(
64  int argc,
65  char** argv
66  )
67 {
68  SCIP* scip = NULL;
69 
70  SCIP_CALL( SCIPcreate(&scip) );
71 
72  /* include new plugins */
73  SCIP_CALL( SCIPincludeObjReader(scip, new ObjReaderSDPA(scip), TRUE) );
74  SCIP_CALL( SCIPincludeConshdlrSdp(scip) );
75  SCIP_CALL( SCIPincludeConshdlrSavedsdpsettings(scip) );
76  SCIP_CALL( SCIPincludeRelaxSdp(scip) );
77  SCIP_CALL( SCIPincludePropSdpredcost(scip) );
78  SCIP_CALL( SCIPincludeBranchruleSdpmostfrac(scip) );
79  SCIP_CALL( SCIPincludeBranchruleSdpmostinf(scip) );
80  SCIP_CALL( SCIPincludeBranchruleSdpobjective(scip) );
81  SCIP_CALL( SCIPincludeBranchruleSdpinfobjective(scip) );
82  SCIP_CALL( SCIPincludeHeurSdpFracdiving(scip) );
83  SCIP_CALL( SCIPincludeHeurSdpRand(scip) );
84  SCIP_CALL( SCIPincludePropSdpObbt(scip) );
85 
86  /* include default SCIP plugins */
87  SCIP_CALL( SCIPincludeDefaultPlugins(scip) );
88 
89  /* disable restarts - for the meantime */
90  SCIP_CALL( SCIPsetIntParam(scip, "limits/restarts", 0) );
91 
92  /* set clocktype to walltime to not add multiple threads together */
93  SCIP_CALL( SCIPsetIntParam(scip, "timing/clocktype", 2) );
94 
95  /* change certain paramters: */
96  SCIP_CALL( SCIPsetIntParam(scip, "display/verblevel", 5) );
97 
98  /* Choose between LP and SDP relaxations */
99  SCIP_CALL( SCIPsetIntParam(scip, "lp/solvefreq", -1) );
100  SCIP_CALL( SCIPsetIntParam(scip, "relaxing/SDP/freq", 1) );
101  SCIP_CALL( SCIPincludeDispSdpiterations(scip) );
102  SCIP_CALL( SCIPincludeDispSdpavgiterations(scip) );
103  SCIP_CALL( SCIPsetIntParam(scip, "display/lpiterations/active", 0) );
104  SCIP_CALL( SCIPsetIntParam(scip, "display/lpavgiterations/active", 0) );
105 
106  /* display numerical problems in SDPs instead of current columns and strong branching */
107  SCIP_CALL( SCIPsetIntParam(scip, "display/nfrac/active", 0) );
108  SCIP_CALL( SCIPsetIntParam(scip, "display/curcols/active", 0) );
109  SCIP_CALL( SCIPsetIntParam(scip, "display/strongbranchs/active", 0) );
110  SCIP_CALL( SCIPincludeDispSdpfastsettings(scip) );
111  SCIP_CALL( SCIPincludeDispSdppenalty(scip) );
112  SCIP_CALL( SCIPincludeDispSdpunsolved(scip) );
113  SCIP_CALL( SCIPsetIntParam(scip, "display/sdpfastsettings/active", 0) );
114  SCIP_CALL( SCIPsetIntParam(scip, "display/sdppenalty/active", 0) );
115 
116  /* change epsilons for numerical stability */
117  SCIP_CALL( SCIPsetRealParam(scip, "numerics/epsilon", 1e-6) );
118  SCIP_CALL( SCIPsetRealParam(scip, "numerics/sumepsilon", 1e-4) );
119  SCIP_CALL( SCIPsetRealParam(scip, "numerics/feastol", 1e-6) );
120 
121  /* parameters for separation */
122  SCIP_CALL( SCIPsetBoolParam(scip, "lp/cleanuprows", FALSE) );
123  SCIP_CALL( SCIPsetBoolParam(scip, "lp/cleanuprowsroot", FALSE) );
124  SCIP_CALL( SCIPsetIntParam(scip, "lp/rowagelimit", 10) );
125 
126  /* maximum age a cut can reach before it is deleted from the global cut pool, or -1 to keep all cuts */
127  SCIP_CALL( SCIPsetIntParam(scip, "separating/cutagelimit", 10) );
128 
129  SCIP_CALL( SCIPsetIntParam(scip, "separating/maxrounds", 20) );
130 
131  /* Parameters for node selection */
132 
133  /* Because in the SDP-world there are no warmstarts as for LPs, the main advantage for DFS (that the change in the
134  * problem is minimal and therefore the Simplex can continue with the current Basis) is lost and best first search, which
135  * provably needs the least number of nodes (see the Dissertation of Tobias Achterberg, the node selection rule with
136  * the least number of nodes, allways has to be a best first search), is the optimal choice
137  */
138  SCIP_CALL( SCIPsetIntParam(scip, "nodeselection/hybridestim/stdpriority", 1000000) );
139  SCIP_CALL( SCIPsetIntParam(scip, "nodeselection/hybridestim/maxplungedepth", 0) );
140  SCIP_CALL( SCIPsetRealParam(scip, "nodeselection/hybridestim/estimweight", 0.0) );
141 
142  /* run interactive shell */
143  SCIP_CALL( SCIPprocessShellArguments(scip, argc, argv, "scip.set") );
144 
145  /* deinitialization */
146  SCIP_CALL( SCIPfree(&scip) );
147 
148  BMScheckEmptyMemory();
149 
150  return SCIP_OKAY;
151 }
152 
154 int main (
155  int argc,
156  char** argv
157  )
158 {
159  SCIP_RETCODE retcode;
160 
161  retcode = runSCIP(argc, argv);
162  if( retcode != SCIP_OKAY )
163  {
164  SCIPprintError(retcode);
165  return -1;
166  }
167 
168  return 0;
169 }
SCIP_RETCODE SCIPincludeConshdlrSavedsdpsettings(SCIP *scip)
SCIP_RETCODE SCIPincludeDispSdpfastsettings(SCIP *scip)
Column to display the percentage of SDP-relaxations that were solved using fast settings.
SCIP_RETCODE SCIPincludePropSdpObbt(SCIP *scip)
Definition: prop_sdpobbt.c:436
int main(int argc, char **argv)
Definition: main.cpp:154
SCIP_RETCODE SCIPincludeConshdlrSdp(SCIP *scip)
Definition: cons_sdp.c:2270
SDP-relaxator.
most fractional branching rule for SCIP-SDP
Reader for SDPA-Files.
SCIP_RETCODE SCIPincludeDispSdppenalty(SCIP *scip)
SCIP_RETCODE SCIPincludeBranchruleSdpmostinf(SCIP *scip)
optimization-based bound tightening propagator for semidefinite programs
Column to display the percentage of SDP-relaxations that could not be solved even using a penalty for...
highest absolute objective branching rule for SCIP-SDP
combined infeasibility and absolute objective branching rule for SCIP-SDP
SCIP_RETCODE SCIPincludeBranchruleSdpmostfrac(SCIP *scip)
most infeasible branching rule for SCIP-SDP
Constraint handler for SDP-constraints.
SCIP_RETCODE SCIPincludeDispSdpavgiterations(SCIP *scip)
SCIP_RETCODE SCIPincludeHeurSdpRand(SCIP *scip)
Definition: heur_sdprand.c:403
SDP diving heuristic that chooses fixings w.r.t. the fractionalities.
Column to display the total number of SDP-iterations.
SCIP_RETCODE SCIPincludeHeurSdpFracdiving(SCIP *scip)
randomized rounding heuristic for SDPs
SCIP_RETCODE SCIPincludeBranchruleSdpinfobjective(SCIP *scip)
reduced cost / dual fixing for SDPs
static SCIP_RETCODE runSCIP(int argc, char **argv)
Definition: main.cpp:63
SCIP_RETCODE SCIPincludeBranchruleSdpobjective(SCIP *scip)
Column to display the average number of SDP-iterations.
Column to display the percentage of SDP-relaxations where a penalty formulation had to be used...
SCIP_RETCODE SCIPincludePropSdpredcost(SCIP *scip)
SCIP_RETCODE SCIPincludeDispSdpiterations(SCIP *scip)
SCIP_RETCODE SCIPincludeDispSdpunsolved(SCIP *scip)
SCIP_RETCODE SCIPincludeRelaxSdp(SCIP *scip)
Definition: relax_sdp.c:1649
constraint handler for saving SDP settings