This is correct:
set A = 0..5;
set B = 6..11;
param G {A,B} default -1;
Alternatively it is also correct to define "param G {A,B};" and then specify "param G default -1 := ..." in the data file. Either way, if you display G right after you read it in, you will only see the non-default values:
ampl: display G;
G :=
0 8 10
0 10 19
0 11 9
1 8 2
1 10 14
1 11 4
3 8 12
3 10 6
3 11 8
;
The other values for G remain undefined until you give a command that forces the default values to be assigned. So for example if you explicitly request a display of all G[i,j] values then you will see the -1 defaults:
ampl: display {i in A, j in B} G[i,j];
G[i,j] [*,*]
: 6 7 8 9 10 11 :=
0 -1 -1 10 -1 19 9
1 -1 -1 2 -1 14 4
2 -1 -1 -1 -1 -1 -1
3 -1 -1 12 -1 6 8
4 -1 -1 -1 -1 -1 -1
5 -1 -1 -1 -1 -1 -1
;
A "solve;" will always force the default values to be assigned.
Bob Fourer
am...@googlegroups.com
=======