SCIP-SDP  3.1.1
 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 programs based on SCIP. */
5 /* */
6 /* Copyright (C) 2011-2013 Discrete Optimization, TU Darmstadt */
7 /* EDOM, FAU Erlangen-Nürnberg */
8 /* 2014-2018 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-2018 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 #define SCIPSDPVERSION "3.1.1"
40 
41 #include "objscip/objscipdefplugins.h"
42 
43 #include "cons_sdp.h"
45 #include "cons_savedsdpsettings.h"
46 #include "relax_sdp.h"
47 #include "objreader_sdpa.h"
48 #include "objreader_sdpaind.h"
49 #include "reader_cbf.h"
50 #include "prop_sdpredcost.h"
51 #include "disp_sdpiterations.h"
52 #include "disp_sdpavgiterations.h"
53 #include "disp_sdpfastsettings.h"
54 #include "disp_sdppenalty.h"
55 #include "disp_sdpunsolved.h"
56 #include "branch_sdpmostfrac.h"
57 #include "branch_sdpmostinf.h"
58 #include "branch_sdpobjective.h"
59 #include "branch_sdpinfobjective.h"
60 #include "heur_sdpfracdiving.h"
61 #include "heur_sdprand.h"
62 #include "prop_sdpobbt.h"
63 #include "prop_companalcent.h"
64 #include "scipsdpgithash.c"
65 #include "table_relaxsdp.h"
66 #include "table_sdpsolversuccess.h"
67 #include "table_slater.h"
68 
69 using namespace scip;
70 
72 static
73 SCIP_RETCODE runSCIP(
74  int argc,
75  char** argv
76  )
77 {
78  SCIP* scip = NULL;
79  char scipsdpname[SCIP_MAXSTRLEN];
80  char scipsdpdesc[SCIP_MAXSTRLEN];
81 
82  SCIP_CALL( SCIPcreate(&scip) );
83 
84  /* include new plugins */
85  SCIP_CALL( SCIPincludeObjReader(scip, new ObjReaderSDPAind(scip), TRUE) );
86  SCIP_CALL( SCIPincludeObjReader(scip, new ObjReaderSDPA(scip), TRUE) );
87  SCIP_CALL( SCIPincludeReaderCbf(scip) );
88  SCIP_CALL( SCIPincludeConshdlrSdp(scip) );
89  SCIP_CALL( SCIPincludeConshdlrSavesdpsol(scip) );
90  SCIP_CALL( SCIPincludeConshdlrSavedsdpsettings(scip) );
91  SCIP_CALL( SCIPincludeRelaxSdp(scip) );
92  SCIP_CALL( SCIPincludePropSdpredcost(scip) );
93  SCIP_CALL( SCIPincludeBranchruleSdpmostfrac(scip) );
94  SCIP_CALL( SCIPincludeBranchruleSdpmostinf(scip) );
95  SCIP_CALL( SCIPincludeBranchruleSdpobjective(scip) );
96  SCIP_CALL( SCIPincludeBranchruleSdpinfobjective(scip) );
97  SCIP_CALL( SCIPincludeHeurSdpFracdiving(scip) );
98  SCIP_CALL( SCIPincludeHeurSdpRand(scip) );
99  SCIP_CALL( SCIPincludePropSdpObbt(scip) );
100  SCIP_CALL( SCIPincludePropCompAnalCent(scip) );
101 
102  /* add description */
103  (void) SCIPsnprintf(scipsdpname, SCIP_MAXSTRLEN, "SCIP-SDP %s", SCIPSDPVERSION);
104  (void) SCIPsnprintf(scipsdpdesc, SCIP_MAXSTRLEN, "Mixed Integer Semidefinite Programming Plugin for SCIP "
105  "[GitHash: %s] (www.opt.tu-darmstadt.de/scipsdp/)", SCIPSDP_GITHASH);
106  SCIP_CALL( SCIPincludeExternalCodeInformation(scip, scipsdpname, scipsdpdesc) );
107 
108  /* include default SCIP plugins */
109  SCIP_CALL( SCIPincludeDefaultPlugins(scip) );
110 
111  /* set clocktype to walltime to not add multiple threads together */
112  SCIP_CALL( SCIPsetIntParam(scip, "timing/clocktype", 2) );
113 
114  /* change certain paramters: */
115  SCIP_CALL( SCIPsetIntParam(scip, "display/verblevel", 5) );
116 
117  /* Choose between LP and SDP relaxations */
118  SCIP_CALL( SCIPsetIntParam(scip, "lp/solvefreq", -1) );
119  SCIP_CALL( SCIPsetIntParam(scip, "relaxing/SDP/freq", 1) );
120  SCIP_CALL( SCIPincludeDispSdpiterations(scip) );
121  SCIP_CALL( SCIPincludeDispSdpavgiterations(scip) );
122  SCIP_CALL( SCIPsetIntParam(scip, "display/lpiterations/active", 0) );
123  SCIP_CALL( SCIPsetIntParam(scip, "display/lpavgiterations/active", 0) );
124 
125  /* display numerical problems in SDPs instead of current columns and strong branching */
126  SCIP_CALL( SCIPsetIntParam(scip, "display/nfrac/active", 0) );
127  SCIP_CALL( SCIPsetIntParam(scip, "display/curcols/active", 0) );
128  SCIP_CALL( SCIPsetIntParam(scip, "display/strongbranchs/active", 0) );
129  SCIP_CALL( SCIPincludeDispSdpfastsettings(scip) );
130  SCIP_CALL( SCIPincludeDispSdppenalty(scip) );
131  SCIP_CALL( SCIPincludeDispSdpunsolved(scip) );
132  SCIP_CALL( SCIPsetIntParam(scip, "display/sdpfastsettings/active", 0) );
133  SCIP_CALL( SCIPsetIntParam(scip, "display/sdppenalty/active", 0) );
134 
135  /* display SDP statistics instead of default relaxator statistics */
136  SCIP_CALL( SCIPincludeTableRelaxSdp(scip) );
137  SCIP_CALL( SCIPincludeTableSdpSolverSuccess(scip) );
138  SCIP_CALL( SCIPincludeTableSlater(scip) );
139  SCIP_CALL( SCIPsetBoolParam(scip, "table/relaxator/active", FALSE) );
140 
141  /* change epsilons for numerical stability */
142  SCIP_CALL( SCIPsetRealParam(scip, "numerics/epsilon", 1e-9) );
143  SCIP_CALL( SCIPsetRealParam(scip, "numerics/sumepsilon", 1e-6) );
144  SCIP_CALL( SCIPsetRealParam(scip, "numerics/feastol", 1e-6) );
145 
146  /* parameters for separation */
147  SCIP_CALL( SCIPsetBoolParam(scip, "lp/cleanuprows", FALSE) );
148  SCIP_CALL( SCIPsetBoolParam(scip, "lp/cleanuprowsroot", FALSE) );
149 
150  /* Parameters for node selection */
151 
152  /* Because in the SDP-world there are no warmstarts as for LPs, the main advantage for DFS (that the change in the
153  * problem is minimal and therefore the Simplex can continue with the current Basis) is lost and best first search, which
154  * provably needs the least number of nodes (see the Dissertation of Tobias Achterberg, the node selection rule with
155  * the least number of nodes, allways has to be a best first search), is the optimal choice
156  */
157  SCIP_CALL( SCIPsetIntParam(scip, "nodeselection/hybridestim/stdpriority", 1000000) );
158  SCIP_CALL( SCIPsetIntParam(scip, "nodeselection/hybridestim/maxplungedepth", 0) );
159  SCIP_CALL( SCIPsetRealParam(scip, "nodeselection/hybridestim/estimweight", 0.0) );
160 
161  /* we explicitly enable the use of a debug solution for this main SCIP instance */
162  SCIPenableDebugSol(scip);
163 
164  /* run interactive shell */
165  SCIP_CALL( SCIPprocessShellArguments(scip, argc, argv, "scip.set") );
166 
167  /* deinitialization */
168  SCIP_CALL( SCIPfree(&scip) );
169 
170  BMScheckEmptyMemory();
171 
172  return SCIP_OKAY;
173 }
174 
176 int main (
177  int argc,
178  char** argv
179  )
180 {
181  SCIP_RETCODE retcode;
182 
183  retcode = runSCIP(argc, argv);
184  if( retcode != SCIP_OKAY )
185  {
186  SCIPprintError(retcode);
187  return -1;
188  }
189 
190  return 0;
191 }
SCIP_RETCODE SCIPincludeConshdlrSavedsdpsettings(SCIP *scip)
SCIP_RETCODE SCIPincludePropCompAnalCent(SCIP *scip)
SCIP_RETCODE SCIPincludeDispSdpfastsettings(SCIP *scip)
Column to display the percentage of SDP-relaxations that were solved using fast settings.
SCIP_RETCODE SCIPincludeTableRelaxSdp(SCIP *scip)
SCIP_RETCODE SCIPincludePropSdpObbt(SCIP *scip)
Definition: prop_sdpobbt.c:459
SCIP_RETCODE SCIPincludeTableSlater(SCIP *scip)
Definition: table_slater.c:308
int main(int argc, char **argv)
Definition: main.cpp:176
Reader for SDPA-Files with indicator constraints (-var in linear constraint => indicator constraint w...
SCIP_RETCODE SCIPincludeConshdlrSdp(SCIP *scip)
Definition: cons_sdp.c:2448
file reader for mixed-integer semidefinite programs in CBF format
SDP-relaxator.
most fractional branching rule for SCIP-SDP
Reader for SDPA-Files.
Slater statistics table.
SCIP_RETCODE SCIPincludeDispSdppenalty(SCIP *scip)
SCIP_RETCODE SCIPincludeBranchruleSdpmostinf(SCIP *scip)
#define SCIPSDPVERSION
Definition: main.cpp:39
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 SCIPincludeReaderCbf(SCIP *scip)
Definition: reader_cbf.c:1912
SCIP_RETCODE SCIPincludeTableSdpSolverSuccess(SCIP *scip)
SCIP_RETCODE SCIPincludeHeurSdpRand(SCIP *scip)
Definition: heur_sdprand.c:406
advanced SDP relaxator statistics table
compute analytic center propagator
SDP diving heuristic that chooses fixings w.r.t. the fractionalities.
Column to display the total number of SDP-iterations.
SCIP_RETCODE SCIPincludeConshdlrSavesdpsol(SCIP *scip)
SDP solver success statistics table.
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:73
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)
constraint handler for saving SDP solutions in nodes
SCIP_RETCODE SCIPincludeRelaxSdp(SCIP *scip)
Definition: relax_sdp.c:4275
constraint handler for saving SDP settings