# SCIP

Solving Constraint Integer Programs

string.c File Reference

## Detailed Description

Coil Compression String 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 string as it can be found in the GAMS model library: http://www.gams.com/modlib/libhtml/spring.htm

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 string.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 M_PI   3.141592653589793238462643

#define nwires   11

## Functions

static SCIP_RETCODE setupProblem (SCIP *scip)

static SCIP_RETCODE runString (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

## ◆ M_PI

 #define M_PI   3.141592653589793238462643

Definition at line 42 of file string.c.

Referenced by setupProblem().

## ◆ nwires

 #define nwires   11

number of possible wire types

Definition at line 49 of file string.c.

Referenced by setupProblem().

## ◆ setupProblem()

 static SCIP_RETCODE setupProblem ( SCIP * scip )
static

sets up problem

Parameters
 scip SCIP data structure

Definition at line 81 of file string.c.

Referenced by runString().

## ◆ runString()

 static SCIP_RETCODE runString ( void )
static

runs string example

Definition at line 427 of file string.c.

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 468 of file string.c.

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

## ◆ 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 52 of file string.c.

Referenced by setupProblem().

static

Definition at line 55 of file string.c.

Referenced by setupProblem().

static

Definition at line 58 of file string.c.

Referenced by setupProblem().

## ◆ maxdeflect

 const SCIP_Real maxdeflect = 6
static

maximal deflection (in)

Definition at line 61 of file string.c.

Referenced by setupProblem().

static

Definition at line 64 of file string.c.

Referenced by setupProblem().

## ◆ maxfreelen

 const SCIP_Real maxfreelen = 14.0
static

maximal free length of spring (in)

Definition at line 67 of file string.c.

Referenced by setupProblem().

## ◆ maxcoildiam

 const SCIP_Real maxcoildiam = 3.0
static

maximal coil diameter (in)

Definition at line 70 of file string.c.

Referenced by setupProblem().

## ◆ maxshearstress

 const SCIP_Real maxshearstress = 189000.0
static

maximal shear stress

Definition at line 73 of file string.c.

Referenced by setupProblem().

## ◆ shearmod

 const SCIP_Real shearmod = 11500000.0
static

shear modulus of material

Definition at line 76 of file string.c.

Referenced by setupProblem().