Hi Luis.
You need to make a change to the data so that each entry for "r" has the
appropriate "i" and "j". Below is an example using your data:
set I;
/* Las i muestras */
set J;
/* los j instrumentos */
param r{i in I, j in J};
/* cada una de las muestras de los retornos */
var x {j in J};
/* el portafolio */
minimize obj: sum{i in I, j in J} r[i,j]*x[j];
/* La funcion objetivo */
s.t. porc_total: sum {j in J} x[j] = 1;
data;
set I := 1 2 3 4 5 6;
set J := 1 2 3;
param : r :=
1 1 0.04300620
1 2 0.06094491
1 3 0.8793238
2 1 0.08306441
2 2 0.05640739
2 3 0.6835024
3 1 0.05271815
3 2 0.08390957
3 3 1.2346929
4 1 0.09064139
4 2 0.08094768
4 3 1.1428601
5 1 0.09523738
5 2 0.05262512
5 3 0.6908464
6 1 0.02364452
6 2 0.06848395
6 3 1.3471945
;
end;
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
luisjaime
Sent: Wednesday, October 14, 2015 7:59 PM
To: [email protected]
Subject: [Help-glpk] How I include a table of 1000 records
Good day for all people in this list:
I've the next model:
set I;
/* Las i muestras */
set J;
/* los j instrumentos */
param r{i in I, j in J};
/* cada una de las muestras de los retornos */
var x {j in J};
/* el portafolio */
minimize obj: sum{i in I, j in J} r[i,j]*x[j];
/* La función objetivo */
s.t. porc_total: sum {j in J} x[j] = 1;
data;
set I := 1 2 3 4 5 6;
set J := 1 2 3;
param r: 1 2 3:=
1 0.04300620 0.06094491 0.8793238
2 0.08306441 0.05640739 0.6835024
3 0.05271815 0.08390957 1.2346929
4 0.09064139 0.08094768 1.1428601
5 0.09523738 0.05262512 0.6908464
6 0.02364452 0.06848395 1.3471945 ;
end;
this run ok, but, how I do for include 1000 records? It's imposible write set
I:= 1 2 3 .... 999 1000; there are a short form? I tried with
"set I:=1..1000;" form, but glpsol don't understand. And, if I will
like read from a csv file, How I can do it? Of course I've ready a file with
the records.
I have readed the gmpl.pdf but if there are examples, all are related for the
specific item in the guide but haven't examples complete showing situations
like mine, exception the tsp problem.
Thanks a lot!
luis jaime
_______________________________________________
Help-glpk mailing list
[email protected]<mailto:[email protected]>
https://lists.gnu.org/mailman/listinfo/help-glpk
________________________________
This e-mail and any attachments may be confidential or legally privileged. If
you received this message in error or are not the intended recipient, you
should destroy the e-mail message and any attachments or copies, and you are
prohibited from retaining, distributing, disclosing or using any information
contained herein. Please inform us of the erroneous delivery by return e-mail.
Thank you for your cooperation.
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk