Scippy

SCIP

Solving Constraint Integer Programs

spring.c File Reference

Detailed Description

Coil Compression Spring Design model.

Author
Stefan Vigerske

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.

#include <stdio.h>
#include <math.h>
#include "scip/scip.h"
#include "scip/scipdefplugins.h"

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

number of possible wire types

Definition at line 52 of file spring.c.

Referenced by setupProblem().

Function Documentation

◆ setupProblem()

◆ runSpring()

◆ main()

int main ( int  argc,
char **  argv 
)

main method starting SCIP

Parameters
argcnumber of arguments from the shell
argvarray of shell arguments

Definition at line 458 of file spring.c.

References runSpring(), SCIP_OKAY, and SCIPprintError().

Variable Documentation

◆ diameters

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

diameters of available diameters (in)

Definition at line 55 of file spring.c.

Referenced by setupProblem().

◆ preload

const SCIP_Real preload = 300
static

preload (lb)

Definition at line 58 of file spring.c.

Referenced by setupProblem().

◆ maxworkload

const SCIP_Real maxworkload = 1000
static

maximal working load (lb)

Definition at line 61 of file spring.c.

Referenced by setupProblem().

◆ maxdeflect

const SCIP_Real maxdeflect = 6
static

maximal deflection (in)

Definition at line 64 of file spring.c.

Referenced by setupProblem().

◆ deflectpreload

const SCIP_Real deflectpreload = 1.25
static

deflection from preload (in)

Definition at line 67 of file spring.c.

Referenced by setupProblem().

◆ maxfreelen

const SCIP_Real maxfreelen = 14.0
static

maximal free length of spring (in)

Definition at line 70 of file spring.c.

Referenced by setupProblem().

◆ maxcoildiam

const SCIP_Real maxcoildiam = 3.0
static

maximal coil diameter (in)

Definition at line 73 of file spring.c.

Referenced by setupProblem().

◆ maxshearstress

const SCIP_Real maxshearstress = 189000.0
static

maximal shear stress

Definition at line 76 of file spring.c.

Referenced by setupProblem().

◆ shearmod

const SCIP_Real shearmod = 11500000.0
static

shear modulus of material

Definition at line 79 of file spring.c.

Referenced by setupProblem().