Detailed Description
Coil Compression Spring Design model.
This example shows how to setup quadratic and nonlinear constraints in SCIP when using SCIP as callable library. The example implements a model for the design of a coil compression spring as it can be found in the GAMS model library: https://www.gams.com/latest/gamslib_ml/libhtml/gamslib_spring.html
The task is to find a minimum volume of a wire for the production of a coil compression spring.
Original model source:
- E. Sangren
Nonlinear Integer and Discrete Programming in Mechanical Design Optimization
Journal of Mechanical Design, Trans. ASME 112 (1990), 223-229
Definition in file spring.c.
Go to the source code of this file.
Macros | |
#define | nwires 11 |
Functions | |
static SCIP_RETCODE | setupProblem (SCIP *scip) |
static SCIP_RETCODE | runSpring (void) |
int | main (int argc, char **argv) |
Variables | |
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 } |
static const SCIP_Real | preload = 300 |
static const SCIP_Real | maxworkload = 1000 |
static const SCIP_Real | maxdeflect = 6 |
static const SCIP_Real | deflectpreload = 1.25 |
static const SCIP_Real | maxfreelen = 14.0 |
static const SCIP_Real | maxcoildiam = 3.0 |
static const SCIP_Real | maxshearstress = 189000.0 |
static const SCIP_Real | shearmod = 11500000.0 |
Macro Definition Documentation
◆ nwires
#define nwires 11 |
Function Documentation
◆ setupProblem()
|
static |
sets up problem
- Parameters
-
scip SCIP data structure
Definition at line 93 of file spring.c.
References deflectpreload, diameters, FALSE, M_PI, maxcoildiam, maxdeflect, maxfreelen, maxshearstress, maxworkload, NULL, nwires, preload, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_CONTINUOUS, SCIP_VARTYPE_INTEGER, SCIPaddCoefLinear(), SCIPaddCons(), SCIPaddVar(), SCIPchgVarLb(), SCIPchgVarUb(), SCIPcreateConsBasicLinear(), SCIPcreateConsBasicNonlinear(), SCIPcreateConsBasicSetpart(), SCIPcreateConsQuadraticNonlinear(), SCIPcreateExprPow(), SCIPcreateExprProduct(), SCIPcreateExprSum(), SCIPcreateExprVar(), SCIPcreateProbBasic(), SCIPcreateVarBasic(), SCIPinfinity(), SCIPreleaseCons(), SCIPreleaseExpr(), SCIPreleaseVar(), SCIPsnprintf(), shearmod, TRUE, and y.
Referenced by runSpring().
◆ runSpring()
|
static |
runs spring example
Definition at line 426 of file spring.c.
References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPcreate(), SCIPfree(), SCIPgetBestSol(), SCIPgetNSols(), SCIPincludeDefaultPlugins(), SCIPinfoMessage(), SCIPpresolve(), SCIPprintOrigProblem(), SCIPprintSol(), SCIPsolve(), and setupProblem().
Referenced by main().
◆ main()
int main | ( | int | argc, |
char ** | argv | ||
) |
main method starting SCIP
- Parameters
-
argc number of arguments from the shell argv array of shell arguments
Definition at line 467 of file spring.c.
References runSpring(), SCIP_OKAY, and SCIPprintError().
Variable Documentation
◆ diameters
|
static |
diameters of available diameters (in)
Definition at line 64 of file spring.c.
Referenced by setupProblem().
◆ preload
|
static |
◆ maxworkload
|
static |
◆ maxdeflect
|
static |
◆ deflectpreload
|
static |
◆ maxfreelen
|
static |
maximal free length of spring (in)
Definition at line 79 of file spring.c.
Referenced by setupProblem().
◆ maxcoildiam
|
static |
◆ maxshearstress
|
static |
◆ shearmod
|
static |