Scippy

SCIP

Solving Constraint Integer Programs

string.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-2017 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 string.c
17  * @brief Coil Compression String Design model
18  * @author Stefan Vigerske
19  *
20  * This example shows how to setup quadratic and nonlinear constraints in SCIP when using SCIP as callable library.
21  * The example implements a model for the design of a coil compression string as it can be found in the GAMS model library:
22  * http://www.gams.com/modlib/libhtml/spring.htm
23  *
24  * The task is to find a minimum volume of a wire for the production of a coil compression spring.
25  *
26  * Original model source:
27  * @par
28  * E. Sangren@n
29  * Nonlinear Integer and Discrete Programming in Mechanical Design Optimization@n
30  * Journal of Mechanical Design, Trans. ASME 112 (1990), 223-229
31  */
32 
33 /*--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #include <stdio.h>
36 #include <math.h>
37 
38 #include "scip/scip.h"
39 #include "scip/scipdefplugins.h"
40 
41 #ifndef M_PI
42 #define M_PI 3.141592653589793238462643
43 #endif
44 
45 
46 /* Model parameters */
47 
48 /** number of possible wire types */
49 #define nwires 11
50 
51 /** diameters of available diameters (in) */
52 static const SCIP_Real diameters[] = { 0.207, 0.225, 0.244, 0.263, 0.283, 0.307, 0.331, 0.362, 0.394, 0.4375, 0.500 };
53 
54 /** preload (lb) */
55 static const SCIP_Real preload = 300;
56 
57 /** maximal working load (lb) */
58 static const SCIP_Real maxworkload = 1000;
59 
60 /** maximal deflection (in) */
61 static const SCIP_Real maxdeflect = 6;
62 
63 /** deflection from preload (in) */
64 static const SCIP_Real deflectpreload = 1.25;
65 
66 /** maximal free length of spring (in) */
67 static const SCIP_Real maxfreelen = 14.0;
68 
69 /** maximal coil diameter (in) */
70 static const SCIP_Real maxcoildiam = 3.0;
71 
72 /** maximal shear stress */
73 static const SCIP_Real maxshearstress = 189000.0;
74 
75 /** shear modulus of material */
76 static const SCIP_Real shearmod = 11500000.0;
77 
78 
79 /** sets up problem */
80 static
82  SCIP* scip /**< SCIP data structure */
83  )
84 {
85  SCIP_VAR* coil; /* coil diameter */
86  SCIP_VAR* wire; /* wire diameter */
87  SCIP_VAR* defl; /* deflection */
88  SCIP_VAR* ncoils; /* number of coils (integer) */
89  SCIP_VAR* const1; /* a constant */
90  SCIP_VAR* const2; /* another constant */
91  SCIP_VAR* volume; /* total volume */
92  SCIP_VAR* y[nwires]; /* wire choice (binary) */
93 
94  SCIP_CONS* voldef;
95  SCIP_CONS* defconst1;
96  SCIP_CONS* defconst2;
97  SCIP_CONS* shear;
98  SCIP_CONS* defdefl;
99  SCIP_CONS* freel;
100  SCIP_CONS* coilwidth;
101  SCIP_CONS* defwire;
102  SCIP_CONS* selectwire;
103 
104  char name[SCIP_MAXSTRLEN];
105  int i;
106 
107  /* create empty problem */
108  SCIP_CALL( SCIPcreateProbBasic(scip, "string") );
109 
110  /* create variables */
111  SCIP_CALL( SCIPcreateVarBasic(scip, &coil, "coildiam", 0.0, SCIPinfinity(scip), 0.0, SCIP_VARTYPE_CONTINUOUS) );
112  SCIP_CALL( SCIPcreateVarBasic(scip, &wire, "wirediam", 0.0, SCIPinfinity(scip), 0.0, SCIP_VARTYPE_CONTINUOUS) );
113  SCIP_CALL( SCIPcreateVarBasic(scip, &defl, "deflection", 0.0, SCIPinfinity(scip), 0.0, SCIP_VARTYPE_CONTINUOUS) );
114  SCIP_CALL( SCIPcreateVarBasic(scip, &ncoils, "ncoils", 0.0, SCIPinfinity(scip), 0.0, SCIP_VARTYPE_INTEGER) );
115  SCIP_CALL( SCIPcreateVarBasic(scip, &const1, "const1", 0.0, SCIPinfinity(scip), 0.0, SCIP_VARTYPE_CONTINUOUS) );
116  SCIP_CALL( SCIPcreateVarBasic(scip, &const2, "const2", 0.0, SCIPinfinity(scip), 0.0, SCIP_VARTYPE_CONTINUOUS) );
117  SCIP_CALL( SCIPcreateVarBasic(scip, &volume, "volume", 0.0, SCIPinfinity(scip), 1.0, SCIP_VARTYPE_CONTINUOUS) );
118  for( i = 0; i < nwires; ++i )
119  {
120  (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "wire%d", i+1);
121  SCIP_CALL( SCIPcreateVarBasic(scip, &y[i], name, 0.0, 1.0, 0.0, SCIP_VARTYPE_BINARY) );
122  }
123 
124  /* set nonstandard variable bounds */
126  SCIP_CALL( SCIPchgVarUb(scip, defl, maxdeflect / preload) );
127 
128  /* add variables to problem */
129  SCIP_CALL( SCIPaddVar(scip, coil) );
130  SCIP_CALL( SCIPaddVar(scip, wire) );
131  SCIP_CALL( SCIPaddVar(scip, defl) );
132  SCIP_CALL( SCIPaddVar(scip, ncoils) );
133  SCIP_CALL( SCIPaddVar(scip, const1) );
134  SCIP_CALL( SCIPaddVar(scip, const2) );
135  SCIP_CALL( SCIPaddVar(scip, volume) );
136  for( i = 0; i < nwires; ++i )
137  {
138  SCIP_CALL( SCIPaddVar(scip, y[i]) );
139  }
140 
141  /* nonlinear constraint voldef: PI/2 * (ncoils+2)*coil*wire^2 - volume == 0 */
142  {
143  SCIP_EXPR* ncoilsplus2;
144  SCIP_EXPR* coilexpr;
145  SCIP_EXPR* wireexpr;
146  SCIP_EXPR* expr;
147  SCIP_EXPR* children[3];
148  SCIP_Real exponents[3] = { 1.0, 1.0, 2.0 };
149  SCIP_VAR* vars[3];
150  SCIP_EXPRDATA_MONOMIAL* monomial;
151  SCIP_EXPRTREE* exprtree;
152  SCIP_Real one;
153  SCIP_Real minusone;
154 
155  one = 1.0;
156  minusone = -1.0;
157 
158  /* setup expression tree for PI/2 * (N+2)*coil*wire^2
159  * in the expression tree, we relate the variable indices as follows:
160  * 0: ncoils
161  * 1: coil
162  * 2: wire
163  */
164 
165  /* setup expression for ncoils+2 */
166  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &ncoilsplus2, SCIP_EXPR_VARIDX, 0) );
167  SCIP_CALL( SCIPexprCreateLinear(SCIPblkmem(scip), &ncoilsplus2, 1, &ncoilsplus2, &one, 2.0) );
168 
169  /* setup expression for variable coil */
170  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &coilexpr, SCIP_EXPR_VARIDX, 1) );
171 
172  /* setup expression for variable wire */
173  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &wireexpr, SCIP_EXPR_VARIDX, 2) );
174 
175  /* setup monomial for PI/2 * ncoilsplus2 * coilexpr * wireexpr^2 */
176  SCIP_CALL( SCIPexprCreateMonomial(SCIPblkmem(scip), &monomial, M_PI / 2.0, 3, NULL, exponents) );
177 
178  /* setup polynomial expression for only one monomial
179  * (FALSE as last argument indicates that the polynomial assumes ownership of monomial)
180  */
181  children[0] = ncoilsplus2;
182  children[1] = coilexpr;
183  children[2] = wireexpr;
184  SCIP_CALL( SCIPexprCreatePolynomial(SCIPblkmem(scip), &expr, 3, children, 1, &monomial, 0.0, FALSE) );
185 
186  /* setup expression tree with expr as root expression, the tree is defined w.r.t. 3 variables */
187  SCIP_CALL( SCIPexprtreeCreate(SCIPblkmem(scip), &exprtree, expr, 3, 0, NULL) );
188 
189  /* assign SCIP variables to tree */
190  vars[0] = ncoils;
191  vars[1] = coil;
192  vars[2] = wire;
193  SCIP_CALL( SCIPexprtreeSetVars(exprtree, 3, vars) );
194 
195  /* create nonlinear constraint for exprtree - volume = 0.0 */
196  SCIP_CALL( SCIPcreateConsBasicNonlinear(scip, &voldef, "voldef", 1, &volume, &minusone, 1, &exprtree, &one, 0.0, 0.0) );
197 
198  /* free expression tree, because it was copied by the constraint */
199  SCIP_CALL( SCIPexprtreeFree(&exprtree) );
200  }
201 
202  /* nonlinear constraint defconst1: coil / wire - const1 == 0.0 */
203  {
204  SCIP_EXPR* coilexpr;
205  SCIP_EXPR* wireexpr;
206  SCIP_EXPR* expr;
207  SCIP_EXPRTREE* exprtree;
208  SCIP_VAR* vars[2];
209 
210  SCIP_Real one;
211  SCIP_Real minusone;
212 
213  one = 1.0;
214  minusone = -1.0;
215 
216  /* expression for variables coilexpr (index 0) and wireexpr (index 1) */
217  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &coilexpr, SCIP_EXPR_VARIDX, 0) );
218  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &wireexpr, SCIP_EXPR_VARIDX, 1) );
219 
220  /* expression for coil / wire */
221  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &expr, SCIP_EXPR_DIV, coilexpr, wireexpr) );
222 
223  /* expression tree from expr */
224  SCIP_CALL( SCIPexprtreeCreate(SCIPblkmem(scip), &exprtree, expr, 2, 0, NULL) );
225 
226  /* set variables in expression tree */
227  vars[0] = coil;
228  vars[1] = wire;
229  SCIP_CALL( SCIPexprtreeSetVars(exprtree, 2, vars) );
230 
231  /* create nonlinear constraint for exprtree - const1 = 0.0 */
232  SCIP_CALL( SCIPcreateConsBasicNonlinear(scip, &defconst1, "defconst1", 1, &const1, &minusone, 1, &exprtree, &one, 0.0, 0.0) );
233 
234  /* free expression tree, because it was copied by the constraint */
235  SCIP_CALL( SCIPexprtreeFree(&exprtree) );
236  }
237 
238  /* nonlinear constraint defconst2: (4.0 * const1 - 1.0) / (4.0 * const1 - 4.0) + 0.615 / const1 - const2 == 0.0 */
239  {
240  SCIP_EXPR* const1expr;
241  SCIP_EXPR* denom;
242  SCIP_EXPR* nomin;
243  SCIP_EXPR* expr;
244  SCIP_EXPRTREE* exprtrees[2];
245 
246  SCIP_Real coef;
247  SCIP_Real coefs[2];
248  SCIP_Real minusone;
249 
250  minusone = -1.0;
251 
252  /* expression for denominator 4.0 * const1 - 1.0 */
253  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &const1expr, SCIP_EXPR_VARIDX, 0) );
254  coef = 4.0;
255  SCIP_CALL( SCIPexprCreateLinear(SCIPblkmem(scip), &denom, 1, &const1expr, &coef, -1.0) );
256 
257  /* expression for nominator 4.0 * const1 - 4.0
258  * (we cannot reuse const1expr a second time in the expression tree, thus we create a new expression for this variable)
259  */
260  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &const1expr, SCIP_EXPR_VARIDX, 0) );
261  coef = 4.0;
262  SCIP_CALL( SCIPexprCreateLinear(SCIPblkmem(scip), &nomin, 1, &const1expr, &coef, -4.0) );
263 
264  /* expression for quotient (4.0 * const1 - 1.0) / (4.0 * const1 - 4.0) */
265  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &expr, SCIP_EXPR_DIV, denom, nomin) );
266 
267  /* expression tree from expr */
268  SCIP_CALL( SCIPexprtreeCreate(SCIPblkmem(scip), &exprtrees[0], expr, 1, 0, NULL) );
269  SCIP_CALL( SCIPexprtreeSetVars(exprtrees[0], 1, &const1) );
270 
271 
272  /* expression for 1.0 / const1 */
273  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &const1expr, SCIP_EXPR_VARIDX, 0) );
274  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &expr, SCIP_EXPR_INTPOWER, const1expr, -1) );
275 
276  /* expression tree from expr */
277  SCIP_CALL( SCIPexprtreeCreate(SCIPblkmem(scip), &exprtrees[1], expr, 1, 0, NULL) );
278  SCIP_CALL( SCIPexprtreeSetVars(exprtrees[1], 1, &const1) );
279 
280 
281  /* create nonlinear constraint for exprtree[0] + 0.615 * exprtree[1] - const2 = 0.0 */
282  coefs[0] = 1.0;
283  coefs[1] = 0.615;
284  SCIP_CALL( SCIPcreateConsBasicNonlinear(scip, &defconst2, "defconst2", 1, &const2, &minusone, 2, exprtrees, coefs, 0.0, 0.0) );
285 
286 
287  /* free expression trees, because they were copied by the constraint */
288  SCIP_CALL( SCIPexprtreeFree(&exprtrees[0]) );
289  SCIP_CALL( SCIPexprtreeFree(&exprtrees[1]) );
290  }
291 
292  /* quadratic constraint shear: 8.0*maxworkload/PI * const1 * const2 - maxshearstress * wire^2 <= 0.0 */
293  {
294  /* create empty quadratic constraint with right-hand-side 0.0 */
295  SCIP_CALL( SCIPcreateConsBasicQuadratic(scip, &shear, "shear", 0, NULL, NULL, 0, NULL, NULL, NULL, -SCIPinfinity(scip), 0.0) );
296 
297  /* add bilinear term 8.0*maxworkload/PI * const1 * const2 */
298  SCIP_CALL( SCIPaddBilinTermQuadratic(scip, shear, const1, const2, 8.0 * maxworkload / M_PI) );
299 
300  /* add square term -maxshearstress * wire^2 */
301  SCIP_CALL( SCIPaddSquareCoefQuadratic(scip, shear, wire, -maxshearstress) );
302  }
303 
304  /* nonlinear constraint defdefl: 8.0/shearmod * ncoils * const1^3 / wire - defl == 0.0 */
305  {
306  SCIP_EXPR* expr;
307  SCIP_EXPR* children[3];
308  SCIP_Real exponents[3] = { 1.0, 3.0, -1.0 };
309  SCIP_VAR* vars[3];
310  SCIP_EXPRDATA_MONOMIAL* monomial;
311  SCIP_EXPRTREE* exprtree;
312  SCIP_Real one;
313  SCIP_Real minusone;
314 
315  one = 1.0;
316  minusone = -1.0;
317 
318  /* we relate the variable indices as follows:
319  * 0: ncoils
320  * 1: const1
321  * 2: wire
322  */
323 
324  /* setup expressions for ncoils, const1, and wire */
325  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &children[0], SCIP_EXPR_VARIDX, 0) );
326  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &children[1], SCIP_EXPR_VARIDX, 1) );
327  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &children[2], SCIP_EXPR_VARIDX, 2) );
328 
329  /* setup monomial for 8.0/shearmod * ncoils * const1^3 / wire */
330  SCIP_CALL( SCIPexprCreateMonomial(SCIPblkmem(scip), &monomial, 8.0 / shearmod, 3, NULL, exponents) );
331 
332  /* setup polynomial expression for only one monomial */
333  SCIP_CALL( SCIPexprCreatePolynomial(SCIPblkmem(scip), &expr, 3, children, 1, &monomial, 0.0, FALSE) );
334 
335  /* setup expression tree with expr as root expression */
336  SCIP_CALL( SCIPexprtreeCreate(SCIPblkmem(scip), &exprtree, expr, 3, 0, NULL) );
337 
338  /* assign SCIP variables to tree */
339  vars[0] = ncoils;
340  vars[1] = const1;
341  vars[2] = wire;
342  SCIP_CALL( SCIPexprtreeSetVars(exprtree, 3, vars) );
343 
344  /* create nonlinear constraint for exprtree - defl = 0.0 */
345  SCIP_CALL( SCIPcreateConsBasicNonlinear(scip, &defdefl, "defdefl", 1, &defl, &minusone, 1, &exprtree, &one, 0.0, 0.0) );
346 
347  /* free expression tree, because it was copied by the constraint */
348  SCIP_CALL( SCIPexprtreeFree(&exprtree) );
349  }
350 
351  /* quadratic constraint freel: maxworkload * defl + 1.05 * ncoils * wire + 2.1 * wire <= maxfreelen */
352  {
353  SCIP_Real one05;
354 
355  /* create quadratic constraint maxworkload * defl + 1.05 * ncoils * wire <= maxfreelen */
356  one05 = 1.05;
357  SCIP_CALL( SCIPcreateConsBasicQuadratic(scip, &freel, "freel",
358  1, &defl, (SCIP_Real*)&maxworkload,
359  1, &ncoils, &wire, &one05, -SCIPinfinity(scip), maxfreelen) );
360 
361  /* add linear term 2.1 * wire for variable wire in quadratic part of constraint */
362  SCIP_CALL( SCIPaddQuadVarLinearCoefQuadratic(scip, freel, wire, 2.1) );
363  }
364 
365  /* linear constraint coilwidth: coil + wire <= maxcoildiam */
366  {
367  /* create empty linear constraint with right-hand-side maxcoildiam */
368  SCIP_CALL( SCIPcreateConsBasicLinear(scip, &coilwidth, "coilwidth", 0, NULL, NULL, -SCIPinfinity(scip), maxcoildiam) );
369 
370  /* add linear term coil + wire */
371  SCIP_CALL( SCIPaddCoefLinear(scip, coilwidth, coil, 1.0) );
372  SCIP_CALL( SCIPaddCoefLinear(scip, coilwidth, wire, 1.0) );
373  }
374 
375  /* linear constraint defwire: sum_i b[i]*y[i] - wire == 0.0 */
376  {
377  /* create linear constraint sum_i b[i]*y[i] == 0.0 */
378  SCIP_CALL( SCIPcreateConsBasicLinear(scip, &defwire, "defwire", nwires, y, (SCIP_Real*)diameters, 0.0, 0.0) );
379 
380  /* add term -wire */
381  SCIP_CALL( SCIPaddCoefLinear(scip, defwire, wire, -1.0) );
382  }
383 
384  /* specialized linear constraint selectwire: sum_i y[i] == 1.0 */
385  {
386  SCIP_CALL( SCIPcreateConsBasicSetpart(scip, &selectwire, "selectwire", nwires, y) );
387  }
388 
389 
390  /* add constraints to problem */
391  SCIP_CALL( SCIPaddCons(scip, voldef) );
392  SCIP_CALL( SCIPaddCons(scip, defconst1) );
393  SCIP_CALL( SCIPaddCons(scip, defconst2) );
394  SCIP_CALL( SCIPaddCons(scip, shear) );
395  SCIP_CALL( SCIPaddCons(scip, defdefl) );
396  SCIP_CALL( SCIPaddCons(scip, freel) );
397  SCIP_CALL( SCIPaddCons(scip, coilwidth) );
398  SCIP_CALL( SCIPaddCons(scip, defwire) );
399  SCIP_CALL( SCIPaddCons(scip, selectwire) );
400 
401 
402  /* release variables and constraints
403  * the problem has them captured, and we do not require them anymore
404  */
405  SCIP_CALL( SCIPreleaseVar(scip, &coil) );
406  SCIP_CALL( SCIPreleaseVar(scip, &wire) );
407  SCIP_CALL( SCIPreleaseVar(scip, &defl) );
408  SCIP_CALL( SCIPreleaseVar(scip, &ncoils) );
409  SCIP_CALL( SCIPreleaseVar(scip, &const1) );
410  SCIP_CALL( SCIPreleaseVar(scip, &const2) );
411  SCIP_CALL( SCIPreleaseVar(scip, &volume) );
412  for( i = 0; i < nwires; ++i )
413  {
414  SCIP_CALL( SCIPreleaseVar(scip, &y[i]) );
415  }
416 
417  SCIP_CALL( SCIPreleaseCons(scip, &voldef) );
418  SCIP_CALL( SCIPreleaseCons(scip, &defconst1) );
419  SCIP_CALL( SCIPreleaseCons(scip, &defconst2) );
420  SCIP_CALL( SCIPreleaseCons(scip, &shear) );
421  SCIP_CALL( SCIPreleaseCons(scip, &defdefl) );
422  SCIP_CALL( SCIPreleaseCons(scip, &freel) );
423  SCIP_CALL( SCIPreleaseCons(scip, &coilwidth) );
424  SCIP_CALL( SCIPreleaseCons(scip, &defwire) );
425  SCIP_CALL( SCIPreleaseCons(scip, &selectwire) );
426 
427  return SCIP_OKAY;
428 }
429 
430 /* runs string example */
431 static
433 {
434  SCIP* scip;
435 
436  SCIP_CALL( SCIPcreate(&scip) );
438 
439  SCIPinfoMessage(scip, NULL, "\n");
440  SCIPinfoMessage(scip, NULL, "************************************************\n");
441  SCIPinfoMessage(scip, NULL, "* Running Coil Compression String Design Model *\n");
442  SCIPinfoMessage(scip, NULL, "************************************************\n");
443  SCIPinfoMessage(scip, NULL, "\n");
444 
445  SCIP_CALL( setupProblem(scip) );
446 
447  SCIPinfoMessage(scip, NULL, "Original problem:\n");
448  SCIP_CALL( SCIPprintOrigProblem(scip, NULL, "cip", FALSE) );
449 
450  SCIPinfoMessage(scip, NULL, "\n");
451  SCIP_CALL( SCIPpresolve(scip) );
452 
453  /* SCIPinfoMessage(scip, NULL, "Reformulated problem:\n");
454  SCIP_CALL( SCIPprintTransProblem(scip, NULL, "cip", FALSE) );
455  */
456 
457  SCIPinfoMessage(scip, NULL, "\nSolving...\n");
458  SCIP_CALL( SCIPsolve(scip) );
459 
460  SCIP_CALL( SCIPfreeTransform(scip) );
461 
462  if( SCIPgetNSols(scip) > 0 )
463  {
464  SCIPinfoMessage(scip, NULL, "\nSolution:\n");
465  SCIP_CALL( SCIPprintSol(scip, SCIPgetBestSol(scip), NULL, FALSE) );
466  }
467 
468  SCIP_CALL( SCIPfree(&scip) );
469 
470  return SCIP_OKAY;
471 }
472 
473 
474 /** main method starting SCIP */
475 int main(
476  int argc, /**< number of arguments from the shell */
477  char** argv /**< array of shell arguments */
478  ) /*lint --e{715}*/
479 {
480  SCIP_RETCODE retcode;
481 
482  retcode = runString();
483 
484  /* evaluate return code of the SCIP process */
485  if( retcode != SCIP_OKAY )
486  {
487  /* write error back trace */
488  SCIPprintError(retcode);
489  return -1;
490  }
491 
492  return 0;
493 }
static SCIP_RETCODE setupProblem(SCIP *scip)
Definition: string.c:81
static const SCIP_Real maxcoildiam
Definition: string.c:70
SCIP_RETCODE SCIPcreateConsBasicLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs)
SCIP_RETCODE SCIPaddSquareCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
#define SCIP_MAXSTRLEN
Definition: def.h:215
SCIP_RETCODE SCIPexprCreateMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL **monomial, SCIP_Real coef, int nfactors, int *childidxs, SCIP_Real *exponents)
Definition: expr.c:6994
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
Definition: scip.c:18384
static const SCIP_Real maxworkload
Definition: string.c:58
#define FALSE
Definition: def.h:64
#define M_PI
Definition: string.c:42
SCIP_Real SCIPinfinity(SCIP *scip)
Definition: scip.c:45816
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:9340
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
static const SCIP_Real maxdeflect
Definition: string.c:61
SCIP_RETCODE SCIPcreateVarBasic(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype)
Definition: scip.c:17317
SCIP_RETCODE SCIPexprtreeSetVars(SCIP_EXPRTREE *tree, int nvars, SCIP_VAR **vars)
Definition: nlp.c:111
SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:21611
SCIP_RETCODE SCIPexprtreeCreate(BMS_BLKMEM *blkmem, SCIP_EXPRTREE **tree, SCIP_EXPR *root, int nvars, int nparams, SCIP_Real *params)
Definition: expr.c:8702
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip.c:696
SCIP_RETCODE SCIPcreateConsBasicQuadratic(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs, SCIP_Real lhs, SCIP_Real rhs)
static const SCIP_Real maxfreelen
Definition: string.c:67
SCIP_RETCODE SCIPaddCoefLinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip.c:1336
SCIP_RETCODE SCIPcreateProbBasic(SCIP *scip, const char *name)
Definition: scip.c:9839
static const SCIP_Real shearmod
Definition: string.c:76
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip.c:15777
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip.c:12410
SCIP_RETCODE SCIPpresolve(SCIP *scip)
Definition: scip.c:15616
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip.c:45519
static const SCIP_Real deflectpreload
Definition: string.c:64
SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:21701
SCIP_RETCODE SCIPprintOrigProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
Definition: scip.c:43265
#define NULL
Definition: lpi_spx1.cpp:137
#define SCIP_CALL(x)
Definition: def.h:306
SCIP_RETCODE SCIPexprCreatePolynomial(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, int nchildren, SCIP_EXPR **children, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Real constant, SCIP_Bool copymonomials)
Definition: expr.c:6591
SCIP_RETCODE SCIPaddBilinTermQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Real coef)
SCIP_RETCODE SCIPfreeTransform(SCIP *scip)
Definition: scip.c:16873
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
SCIP_RETCODE SCIPexprCreate(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, SCIP_EXPROP op,...)
Definition: expr.c:5934
SCIP_RETCODE SCIPexprtreeFree(SCIP_EXPRTREE **tree)
Definition: expr.c:8783
int SCIPgetNSols(SCIP *scip)
Definition: scip.c:38832
static const SCIP_Real diameters[]
Definition: string.c:52
int main(int argc, char **argv)
Definition: string.c:475
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip.c:38931
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
Definition: scip.c:11311
#define nwires
Definition: string.c:49
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip.c:27323
#define SCIP_Real
Definition: def.h:135
SCIP_RETCODE SCIPaddQuadVarLinearCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
static const SCIP_Real maxshearstress
Definition: string.c:73
static const SCIP_Real preload
Definition: string.c:55
SCIP_RETCODE SCIPcreateConsBasicSetpart(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars)
Definition: cons_setppc.c:9016
void SCIPprintError(SCIP_RETCODE retcode)
Definition: scip.c:670
SCIP_RETCODE SCIPexprCreateLinear(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, int nchildren, SCIP_EXPR **children, SCIP_Real *coefs, SCIP_Real constant)
Definition: expr.c:6461
SCIP_RETCODE SCIPcreateConsBasicNonlinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *nonlincoefs, SCIP_Real lhs, SCIP_Real rhs)
default SCIP plugins
static SCIP_RETCODE runString(void)
Definition: string.c:432
SCIP callable library.
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip.c:774
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
Definition: scip.c:38421