Correction: the documentation explains about slices on page 48, not 58. Att,
*Thiago H. Neves* (31) 98608-0666 Em ter, 2 de abr de 2019 às 08:24, Thiago Neves <[email protected]> escreveu: > Hi, Yuri! > > You can define a data block like this: > > > > > > > > > > *data;param F :=[0,0,1] := 1[0,1,0] := 2[1,0,0] := 3;end;* > > If F is a sparse parameter, I suggest you to define it with defaults, so > you don't have to put all the data. > > Example: > > > > > > > *param M, default 2;param F{0..M, 0..M, 0..M}, default 0;var x > >=0;minimize cost: sum{m1 in 1..M, m2 in 1..M, m3 in 1..M} x*F[m1, m2, m3];* > > About your comment on gmpl documentation: > > > *"MathProg documentation http://gusek.sourceforge.net/gmpl.pdf > <http://gusek.sourceforge.net/gmpl.pdf> doesn't explain how to do this. It > talks mostly about how to define sets, and seems to focus on 2-dimensional > data."* > > *Actually, it explains about slices (the lines I used on F data block), > page 58, and about how to define parameters with slices, page 50.* > > Att, > > *Thiago H. Neves* > > > > Em ter, 2 de abr de 2019 às 04:03, Yuri <[email protected]> escreveu: > >> I need to have a large tabulated parameter matrix, like this: >> >> param m=7; >> param F{1..m, 1..m, 1..m}; # tabulated function >> I would like to define these numeric values in a data block (data; ...; >> end;) in a separate file. >> >> MathProg documentation http://gusek.sourceforge.net/gmpl.pdf doesn't >> explain how to do this. It talks mostly about how to define sets, and >> seems to focus on 2-dimensional data. >> >> How to define values of F[i1,i2,i3]? >> >> My simple attempt: >> >> data; >> F[0,0,0] = 0.0083987; >> F[0,0,1] = 0.01222470; >> F[0,0,2] = 0.05272440; >> >> ... >> >> end; >> >> failed: >> my.data:2: syntax error in data section >> >> >> Thank you, >> >> Yuri >> >> >> >> _______________________________________________ >> Help-glpk mailing list >> [email protected] >> https://lists.gnu.org/mailman/listinfo/help-glpk >> >
_______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
