1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
// =============================================================================
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2011 - DIGITEO - Michael Baudin
//
// This file is distributed under the same license as the Scilab package.
// =============================================================================
// <-- CLI SHELL MODE -->
path = fullfile(SCI,"modules","optimization","tests","unit_tests");
stacksize("max");
//
filename = fullfile(path,"test1.mps");
huge = number_properties("huge");
P=readmps(filename,[-huge huge]);
assert_checkequal(typeof(P),"mps");
assert_checkequal(P.irobj,1);
assert_checkequal(P.namec,"COST ");
assert_checkequal(P.nameb,"RHS1 ");
assert_checkequal(P.namran," ");
assert_checkequal(P.nambnd,"BND1 ");
assert_checkequal(P.name,"TESTPROB");
assert_checkequal(P.rownames,["COST ";"LIM1 ";"LIM2 ";"MYEQN "]);
assert_checkequal(P.colnames,["XONE ","YTWO ","ZTHREE "]);
assert_checkequal(P.rowstat,[4;3;2;1]);
assert_checkequal(P.rowcode,[4,0;3,0;1,2;0,0]);
assert_checkequal(P.colcode,zeros(3,2));
assert_checkequal(P.rownmbs,[1;2;3;1;2;4;1;3;4]);
assert_checkequal(P.colpnts,[1,4,7,10]);
assert_checkequal(P.acoeff,[1;1;1;4;1;-1;9;1;1]);
assert_checkequal(P.rhs,[0;5;10;7]);
assert_checkequal(P.ranges,huge*ones(4,1));
assert_checkequal(P.bounds,[-huge,4;-1,1;-huge,huge]);
assert_checkequal(P.stavar,[1;3;0]);
disp(P)
MPS Object:
===========
irobj: 1
namec: COST
nameb: RHS1
namran:
nambnd: BND1
name: TESTPROB
rownames: 4-by-1 string matrix
colnames: 1-by-3 string matrix
rowstat: 4-by-1 constant matrix
rowcode: 4-by-2 constant matrix
colcode: 3-by-2 constant matrix
rownmbs: 9-by-1 constant matrix
colpnts: 1-by-4 constant matrix
acoeff: 9-by-1 constant matrix
rhs: 4-by-1 constant matrix
ranges: 4-by-1 constant matrix
bounds: 3-by-2 constant matrix
stavar: 3-by-1 constant matrix
refMsg = msprintf(_(" RDMPS1 ERROR: Number of nonzeros of matrix A exceeds MAXNZA."));
assert_checkerror("P=readmps(filename,[0 10^30],[4 3 8]);", refMsg);
P=readmps(filename,[0 10^30],[4 3 9]);
assert_checkequal(size(P.acoeff), [9 1]);
P=readmps(filename,[0 10^30],[4 3 10]);
assert_checkequal(size(P.acoeff), [10 1]);
//
filename = fullfile(path,"25FV47.SIF");
huge = number_properties("huge");
P=readmps(filename,[-huge huge]);
assert_checkequal(typeof(P),"mps");
assert_checkequal(P.irobj,1);
assert_checkequal(P.namec,"R0000 ");
assert_checkequal(P.nameb,".00001 ");
assert_checkequal(P.namran," ");
assert_checkequal(P.nambnd," ");
assert_checkequal(P.name,"25FV47 ");
assert_checkequal(size(P.rownames),[822,1]);
assert_checkequal(size(P.colnames), [1,1571]);
assert_checkequal(size(P.rowstat),[822,1]);
assert_checkequal(size(P.rowcode),[822,2]);
assert_checkequal(size(P.colcode),[1571,2]);
assert_checkequal(size(P.rownmbs),[11127,1]);
assert_checkequal(size(P.colpnts),[1,1572]);
assert_checkequal(size(P.acoeff),[11127,1]);
assert_checkequal(size(P.rhs),[822,1]);
assert_checkequal(size(P.ranges),[822,1]);
assert_checkequal(size(P.bounds),[1571,2]);
assert_checkequal(size(P.stavar),[1571,1]);
disp(P)
MPS Object:
===========
irobj: 1
namec: R0000
nameb: .00001
namran:
nambnd:
name: 25FV47
rownames: 822-by-1 string matrix
colnames: 1-by-1571 string matrix
rowstat: 822-by-1 constant matrix
rowcode: 822-by-2 constant matrix
colcode: 1571-by-2 constant matrix
rownmbs: 11127-by-1 constant matrix
colpnts: 1-by-1572 constant matrix
acoeff: 11127-by-1 constant matrix
rhs: 822-by-1 constant matrix
ranges: 822-by-1 constant matrix
bounds: 1571-by-2 constant matrix
stavar: 1571-by-1 constant matrix
|