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-2020 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 visit scipopt.org. */
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  /* expression for 1.0 / const1 */
272  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &const1expr, SCIP_EXPR_VARIDX, 0) );
273  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &expr, SCIP_EXPR_INTPOWER, const1expr, -1) );
274 
275  /* expression tree from expr */
276  SCIP_CALL( SCIPexprtreeCreate(SCIPblkmem(scip), &exprtrees[1], expr, 1, 0, NULL) );
277  SCIP_CALL( SCIPexprtreeSetVars(exprtrees[1], 1, &const1) );
278 
279  /* create nonlinear constraint for exprtree[0] + 0.615 * exprtree[1] - const2 = 0.0 */
280  coefs[0] = 1.0;
281  coefs[1] = 0.615;
282  SCIP_CALL( SCIPcreateConsBasicNonlinear(scip, &defconst2, "defconst2", 1, &const2, &minusone, 2, exprtrees, coefs, 0.0, 0.0) );
283 
284  /* free expression trees, because they were copied by the constraint */
285  SCIP_CALL( SCIPexprtreeFree(&exprtrees[0]) );
286  SCIP_CALL( SCIPexprtreeFree(&exprtrees[1]) );
287  }
288 
289  /* quadratic constraint shear: 8.0*maxworkload/PI * const1 * const2 - maxshearstress * wire^2 <= 0.0 */
290  {
291  /* create empty quadratic constraint with right-hand-side 0.0 */
292  SCIP_CALL( SCIPcreateConsBasicQuadratic(scip, &shear, "shear", 0, NULL, NULL, 0, NULL, NULL, NULL, -SCIPinfinity(scip), 0.0) );
293 
294  /* add bilinear term 8.0*maxworkload/PI * const1 * const2 */
295  SCIP_CALL( SCIPaddBilinTermQuadratic(scip, shear, const1, const2, 8.0 * maxworkload / M_PI) );
296 
297  /* add square term -maxshearstress * wire^2 */
298  SCIP_CALL( SCIPaddSquareCoefQuadratic(scip, shear, wire, -maxshearstress) );
299  }
300 
301  /* nonlinear constraint defdefl: 8.0/shearmod * ncoils * const1^3 / wire - defl == 0.0 */
302  {
303  SCIP_EXPR* expr;
304  SCIP_EXPR* children[3];
305  SCIP_Real exponents[3] = { 1.0, 3.0, -1.0 };
306  SCIP_VAR* vars[3];
307  SCIP_EXPRDATA_MONOMIAL* monomial;
308  SCIP_EXPRTREE* exprtree;
309  SCIP_Real one;
310  SCIP_Real minusone;
311 
312  one = 1.0;
313  minusone = -1.0;
314 
315  /* we relate the variable indices as follows:
316  * 0: ncoils
317  * 1: const1
318  * 2: wire
319  */
320 
321  /* setup expressions for ncoils, const1, and wire */
322  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &children[0], SCIP_EXPR_VARIDX, 0) );
323  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &children[1], SCIP_EXPR_VARIDX, 1) );
324  SCIP_CALL( SCIPexprCreate(SCIPblkmem(scip), &children[2], SCIP_EXPR_VARIDX, 2) );
325 
326  /* setup monomial for 8.0/shearmod * ncoils * const1^3 / wire */
327  SCIP_CALL( SCIPexprCreateMonomial(SCIPblkmem(scip), &monomial, 8.0 / shearmod, 3, NULL, exponents) );
328 
329  /* setup polynomial expression for only one monomial */
330  SCIP_CALL( SCIPexprCreatePolynomial(SCIPblkmem(scip), &expr, 3, children, 1, &monomial, 0.0, FALSE) );
331 
332  /* setup expression tree with expr as root expression */
333  SCIP_CALL( SCIPexprtreeCreate(SCIPblkmem(scip), &exprtree, expr, 3, 0, NULL) );
334 
335  /* assign SCIP variables to tree */
336  vars[0] = ncoils;
337  vars[1] = const1;
338  vars[2] = wire;
339  SCIP_CALL( SCIPexprtreeSetVars(exprtree, 3, vars) );
340 
341  /* create nonlinear constraint for exprtree - defl = 0.0 */
342  SCIP_CALL( SCIPcreateConsBasicNonlinear(scip, &defdefl, "defdefl", 1, &defl, &minusone, 1, &exprtree, &one, 0.0, 0.0) );
343 
344  /* free expression tree, because it was copied by the constraint */
345  SCIP_CALL( SCIPexprtreeFree(&exprtree) );
346  }
347 
348  /* quadratic constraint freel: maxworkload * defl + 1.05 * ncoils * wire + 2.1 * wire <= maxfreelen */
349  {
350  SCIP_Real one05;
351 
352  /* create quadratic constraint maxworkload * defl + 1.05 * ncoils * wire <= maxfreelen */
353  one05 = 1.05;
354  SCIP_CALL( SCIPcreateConsBasicQuadratic(scip, &freel, "freel",
355  1, &defl, (SCIP_Real*)&maxworkload,
356  1, &ncoils, &wire, &one05, -SCIPinfinity(scip), maxfreelen) );
357 
358  /* add linear term 2.1 * wire for variable wire in quadratic part of constraint */
359  SCIP_CALL( SCIPaddQuadVarLinearCoefQuadratic(scip, freel, wire, 2.1) );
360  }
361 
362  /* linear constraint coilwidth: coil + wire <= maxcoildiam */
363  {
364  /* create empty linear constraint with right-hand-side maxcoildiam */
365  SCIP_CALL( SCIPcreateConsBasicLinear(scip, &coilwidth, "coilwidth", 0, NULL, NULL, -SCIPinfinity(scip), maxcoildiam) );
366 
367  /* add linear term coil + wire */
368  SCIP_CALL( SCIPaddCoefLinear(scip, coilwidth, coil, 1.0) );
369  SCIP_CALL( SCIPaddCoefLinear(scip, coilwidth, wire, 1.0) );
370  }
371 
372  /* linear constraint defwire: sum_i b[i]*y[i] - wire == 0.0 */
373  {
374  /* create linear constraint sum_i b[i]*y[i] == 0.0 */
375  SCIP_CALL( SCIPcreateConsBasicLinear(scip, &defwire, "defwire", nwires, y, (SCIP_Real*)diameters, 0.0, 0.0) );
376 
377  /* add term -wire */
378  SCIP_CALL( SCIPaddCoefLinear(scip, defwire, wire, -1.0) );
379  }
380 
381  /* specialized linear constraint selectwire: sum_i y[i] == 1.0 */
382  {
383  SCIP_CALL( SCIPcreateConsBasicSetpart(scip, &selectwire, "selectwire", nwires, y) );
384  }
385 
386  /* add constraints to problem */
387  SCIP_CALL( SCIPaddCons(scip, voldef) );
388  SCIP_CALL( SCIPaddCons(scip, defconst1) );
389  SCIP_CALL( SCIPaddCons(scip, defconst2) );
390  SCIP_CALL( SCIPaddCons(scip, shear) );
391  SCIP_CALL( SCIPaddCons(scip, defdefl) );
392  SCIP_CALL( SCIPaddCons(scip, freel) );
393  SCIP_CALL( SCIPaddCons(scip, coilwidth) );
394  SCIP_CALL( SCIPaddCons(scip, defwire) );
395  SCIP_CALL( SCIPaddCons(scip, selectwire) );
396 
397  /* release variables and constraints
398  * the problem has them captured, and we do not require them anymore
399  */
400  SCIP_CALL( SCIPreleaseVar(scip, &coil) );
401  SCIP_CALL( SCIPreleaseVar(scip, &wire) );
402  SCIP_CALL( SCIPreleaseVar(scip, &defl) );
403  SCIP_CALL( SCIPreleaseVar(scip, &ncoils) );
404  SCIP_CALL( SCIPreleaseVar(scip, &const1) );
405  SCIP_CALL( SCIPreleaseVar(scip, &const2) );
406  SCIP_CALL( SCIPreleaseVar(scip, &volume) );
407  for( i = 0; i < nwires; ++i )
408  {
409  SCIP_CALL( SCIPreleaseVar(scip, &y[i]) );
410  }
411 
412  SCIP_CALL( SCIPreleaseCons(scip, &voldef) );
413  SCIP_CALL( SCIPreleaseCons(scip, &defconst1) );
414  SCIP_CALL( SCIPreleaseCons(scip, &defconst2) );
415  SCIP_CALL( SCIPreleaseCons(scip, &shear) );
416  SCIP_CALL( SCIPreleaseCons(scip, &defdefl) );
417  SCIP_CALL( SCIPreleaseCons(scip, &freel) );
418  SCIP_CALL( SCIPreleaseCons(scip, &coilwidth) );
419  SCIP_CALL( SCIPreleaseCons(scip, &defwire) );
420  SCIP_CALL( SCIPreleaseCons(scip, &selectwire) );
421 
422  return SCIP_OKAY;
423 }
424 
425 /** runs string example */
426 static
428 {
429  SCIP* scip;
430 
431  SCIP_CALL( SCIPcreate(&scip) );
433 
434  SCIPinfoMessage(scip, NULL, "\n");
435  SCIPinfoMessage(scip, NULL, "************************************************\n");
436  SCIPinfoMessage(scip, NULL, "* Running Coil Compression String Design Model *\n");
437  SCIPinfoMessage(scip, NULL, "************************************************\n");
438  SCIPinfoMessage(scip, NULL, "\n");
439 
440  SCIP_CALL( setupProblem(scip) );
441 
442  SCIPinfoMessage(scip, NULL, "Original problem:\n");
443  SCIP_CALL( SCIPprintOrigProblem(scip, NULL, "cip", FALSE) );
444 
445  SCIPinfoMessage(scip, NULL, "\n");
446  SCIP_CALL( SCIPpresolve(scip) );
447 
448  /* SCIPinfoMessage(scip, NULL, "Reformulated problem:\n");
449  SCIP_CALL( SCIPprintTransProblem(scip, NULL, "cip", FALSE) );
450  */
451 
452  SCIPinfoMessage(scip, NULL, "\nSolving...\n");
453  SCIP_CALL( SCIPsolve(scip) );
454 
455  if( SCIPgetNSols(scip) > 0 )
456  {
457  SCIPinfoMessage(scip, NULL, "\nSolution:\n");
458  SCIP_CALL( SCIPprintSol(scip, SCIPgetBestSol(scip), NULL, FALSE) );
459  }
460 
461  SCIP_CALL( SCIPfree(&scip) );
462 
463  return SCIP_OKAY;
464 }
465 
466 
467 /** main method starting SCIP */
468 int main(
469  int argc, /**< number of arguments from the shell */
470  char** argv /**< array of shell arguments */
471  )
472 { /*lint --e{715}*/
473  SCIP_RETCODE retcode;
474 
475  retcode = runString();
476 
477  /* evaluate return code of the SCIP process */
478  if( retcode != SCIP_OKAY )
479  {
480  /* write error back trace */
481  SCIPprintError(retcode);
482  return -1;
483  }
484 
485  return 0;
486 }
static SCIP_RETCODE setupProblem(SCIP *scip)
Definition: string.c:81
void SCIPprintError(SCIP_RETCODE retcode)
Definition: scip_general.c:211
SCIP_RETCODE SCIPcreateConsBasicSetpart(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars)
Definition: cons_setppc.c:9096
static const SCIP_Real maxcoildiam
Definition: string.c:70
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)
#define SCIP_MAXSTRLEN
Definition: def.h:273
SCIP_RETCODE SCIPaddSquareCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
SCIP_RETCODE SCIPaddCoefLinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
SCIP_RETCODE SCIPexprCreateMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL **monomial, SCIP_Real coef, int nfactors, int *childidxs, SCIP_Real *exponents)
Definition: expr.c:7039
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_var.c:185
static const SCIP_Real maxworkload
Definition: string.c:58
#define FALSE
Definition: def.h:73
#define M_PI
Definition: string.c:42
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)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
static const SCIP_Real maxdeflect
Definition: string.c:61
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip_solve.c:2527
SCIP_RETCODE SCIPexprtreeCreate(BMS_BLKMEM *blkmem, SCIP_EXPRTREE **tree, SCIP_EXPR *root, int nvars, int nparams, SCIP_Real *params)
Definition: expr.c:8775
SCIP_RETCODE SCIPpresolve(SCIP *scip)
Definition: scip_solve.c:2366
static const SCIP_Real maxfreelen
Definition: string.c:67
int SCIPgetNSols(SCIP *scip)
Definition: scip_sol.c:2206
SCIP_RETCODE SCIPaddQuadVarLinearCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
static const SCIP_Real shearmod
Definition: string.c:76
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:283
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)
SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip_var.c:4677
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:48
static const SCIP_Real deflectpreload
Definition: string.c:64
#define NULL
Definition: lpi_spx1.cpp:155
SCIP_RETCODE SCIPprintOrigProblem(SCIP *scip, FILE *file, const char *extension, SCIP_Bool genericnames)
#define SCIP_CALL(x)
Definition: def.h:364
SCIP_RETCODE SCIPaddBilinTermQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Real coef)
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:6636
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
SCIP_RETCODE SCIPexprtreeSetVars(SCIP_EXPRTREE *tree, int nvars, SCIP_VAR **vars)
Definition: nlp.c:113
SCIP_RETCODE SCIPexprCreate(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, SCIP_EXPROP op,...)
Definition: expr.c:5977
SCIP_RETCODE SCIPexprtreeFree(SCIP_EXPRTREE **tree)
Definition: expr.c:8856
static const SCIP_Real diameters[]
Definition: string.c:52
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
Definition: scip_prob.c:1666
SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip_var.c:4767
int main(int argc, char **argv)
Definition: string.c:468
#define nwires
Definition: string.c:49
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10604
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
Definition: scip_sol.c:1767
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
Definition: scip_var.c:1252
#define SCIP_Real
Definition: def.h:163
SCIP_VAR ** y
Definition: circlepacking.c:55
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip_prob.c:2764
static const SCIP_Real maxshearstress
Definition: string.c:73
static const SCIP_Real preload
Definition: string.c:55
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:315
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:199
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip_cons.c:1110
SCIP_RETCODE SCIPexprCreateLinear(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, int nchildren, SCIP_EXPR **children, SCIP_Real *coefs, SCIP_Real constant)
Definition: expr.c:6506
default SCIP plugins
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip_sol.c:2305
SCIP_RETCODE SCIPcreateProbBasic(SCIP *scip, const char *name)
Definition: scip_prob.c:170
static SCIP_RETCODE runString(void)
Definition: string.c:427
SCIP callable library.