Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.3 - Português

Change language to:
English - Français - 日本語 -

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Ajuda Scilab >> Otimização e Simulação > readmps

readmps

reads a file in MPS format

Calling Sequence

mps= readmps (file-name,bounds [,maxsizes]);

Arguments

file-name

a string, the name of the mps file

bounds

2-vector [lowbound,upbound] , default lower and upper bounds

maxsizes

3-vector [maxm,maxn,maxnza] Maximum number of contraints and variables, maximum number of nonzeros entries in the LP constraint matrix. If omitted readmps reads the file once just to compute these numbers.

mps

tlist with following fields

irobj

integer (index of the objective row).

namec

character string (Name of the objective).

nameb

character string (Name of the right hand side).

namran

character string (Name of the ranges section).

nambnd

character string (Name of the bounds section).

name

character string (Name of the LP problem).

rownames

character string column vector (Name of the rows).

colnames

character string row vector (Name of the columns).

rowstat

integer vector, row types:

1

row type is "="

2

row type is ">="

3

row type is "<="

4

objective row

5

other free row

rowcode

real matrix [hdrowcd,lnkrow] with

hdrowcd

real vector (Header to the linked list of rows with the same codes).

lnkrow

integer vector (Linked list of rows with the same codes).

colcode

real matrix [hdcolcd,lnkcol] with

hdcolcd

integer vector (Header to the linked list of columns with the same codes).

lnkcol

integer vector (Linked list of columns with the same codes).

rownmbs

integer vector (Row numbers of nonzeros in columns of matrix A.)

colpnts

integer vector (Pointers to the beginning of columns of matrix A).

acoeff

real vector (Array of nonzero elements for each column).

rhs

real vector ( Right hand side of the linear program).

ranges

real vector of constraint ranges.

bounds

real matrix [lbounds,ubounds] with

ubounds

full column vector of upper bounds

lbounds

full column vector of lower bounds

stavar

full column vector of variable status

0

standard (non negative) variable

1

upper bounded variable

2

lower bounded variable

3

lower and upper bounded variable

4

minus infinity type variable i.e -inf<x<=u

5

plus infinity type variable i.e l<=x< inf

6

fixed type variable i.e l=x=u

-k

free variable

Description

Reads a file containing description of an LP problem given in MPS format and returns a tlist which describes the problem. It is an interface with the program rdmps1.f of hopdm (J. Gondzio). For a description of the variables, see the file rdmps1.f.

MPS format is a standard ASCII medium for LP codes. MPS format is described in more detail in Murtagh's book:

Murtagh B. (1981). Advanced Linear Programming, McGrew-Hill, New York, 1981.

Examples

//Let the LP problem:
//objective:
//   min     XONE + 4 YTWO + 9 ZTHREE
//constraints:
//  LIM1:    XONE +   YTWO            < = 5
//  LIM2:    XONE +            ZTHREE > = 10
// MYEQN:         -   YTWO  +  ZTHREE   = 7
//Bounds
//  0 < = XONE < = 4
// -1 < = YTWO < = 1

//Generate MPS file 
txt=['NAME          TESTPROB'
     'ROWS'
     ' N  COST'
     ' L  LIM1'
     ' G  LIM2'
     ' E  MYEQN'
     'COLUMNS'
     '    XONE      COST                 1   LIM1                 1'
     '    XONE      LIM2                 1'
     '    YTWO      COST                 4   LIM1                 1'
     '    YTWO      MYEQN               -1'
     '    ZTHREE    COST                 9   LIM2                 1'
     '    ZTHREE    MYEQN                1'
     'RHS'
     '    RHS1      LIM1                 5   LIM2                10'
     '    RHS1      MYEQN                7'
     'BOUNDS'
     ' UP BND1      XONE                 4'
     ' LO BND1      YTWO                -1'
     ' UP BND1      YTWO                 1'
     'ENDATA'];
mputl(txt,TMPDIR+'/test.mps')
//Read the MPS file
P=readmps(TMPDIR+'/test.mps',[0 10^30])
disp(P)
<< quapro Otimização e Simulação recons >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Oct 05 12:11:47 CEST 2011