Write MPS Files

Share:

Description

This function writes MPS files - the standard format for Linear Programming problems.

Usage

1
writeMps( file, cvec, bvec, Amat, name="LP" )

Arguments

file

a character string naming the file to write.

cvec

vector c.

bvec

vector b.

Amat

matrix A.

name

an optional name for the Linear Programming problem.

Details

The exported LP can be solved by running other software on this MPS file (e.g. lp_solve, see ftp://ftp.es.ele.tue.nl/pub/lp_solve).

Author(s)

Arne Henningsen

See Also

solveLP, readMps

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## example of Steinhauser, Langbehn and Peters (1992)
## Production activities
cvec <- c(1800, 600, 600)  # gross margins
names(cvec) <- c("Cows","Bulls","Pigs")

## Constraints (quasi-fix factors)
bvec <- c(40, 90, 2500)  # endowment
names(bvec) <- c("Land","Stable","Labor")

## Needs of Production activities
Amat <- rbind( c(  0.7,   0.35,   0 ),
               c(  1.5,   1,      3 ),
               c( 50,    12.5,   20 ) )

## Write to MPS file
writeMps( "steinh.mps", cvec, bvec, Amat, "Steinhauser" )