help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] CSV FILES PROBLEM


From: Noli Sicad
Subject: Re: [Help-glpk] CSV FILES PROBLEM
Date: Tue, 21 Apr 2009 12:31:04 +1000

No need to declare Table

> table Ti;

And no table read as well

> table read ti;


Just put tables after set and variables before the objective function.

Here is example that is working:
~~~~~~~~~~~~~~~

var x {p in 1..Numyear, i in CROPTYPE, j in 1..Maxyear + p-1: i !=
'Bareland'}>= 0;

#####   Tables     ##################
table Crop IN "CSV" "Croptype.csv" "CROPTYPE" : CROPTYPE <- [CROPTYPE];
set K dimen 2;
table Area1 IN "CSV" "Area.csv" :  K <- [Croptype, Ageclass], Area ~Area;
set J dimen 2;
table Overhead1 IN "CSV" "Overhead.csv":  J <- [Croptype, Name],
Overhead ~Overhead;
set PR dimen 3;
table Prod IN "CSV" "Products.csv" "Products": PR <-
[PRODUCT,Croptype,Ageclass], Products ~Products;
set T dimen 3;
table Thin IN "CSV" "Thinnings.csv" "Thinnings": T <-
[Name,Croptype,Ageclass], Thinnings ~Thinnings;
set P dimen 2;
table Plant IN "CSV" "Plant.csv": P <- [Name,Croptype], Plants ~Plants;
set Y dimen 2;
table Yield1 IN "CSV" "Yield.csv" "Yield" : Y <- [Croptype,Ageclass],
Yield ~Yield;

####################      Objective Function      #######################
maximize Totalprofit:

~~~~~~~
You don't need to use the sets K, J, T, P, Y in your constraints after
the table has been read using "table ... IN ..."

Noli



On 4/17/09, address@hidden <address@hidden> wrote:
> HI
>
> I got a sample code from the group and try with no succes. i declared the
> table in just after the sets and then i say to read the file but it shows a
> error
>
> colon missing where expected
> context: set i;set j; set s dimen 2; table Ti
>
> and this is my model
> set I;
> set J;
> set s dimen 2;
> table Ti;
> param a{i in I};
> param b{j in J};
> param d{i in I, j in J};
> param f;
> param c{i in I, j in J} := f * d[i,j] / 1000;
> var x{i in I, j in J} >= 0;
> table read ti;
> minimize cost: sum{i in I, j in J} c[i,j] * x[i,j];
> s.t. supply{i in I}: sum{j in J} x[i,j] <= a[i];
> s.t. demand{j in J}: sum{i in I} x[i,j] >= b[j];
> ---------------------------------------------------------------------
> data;
> :
> :
> table Ti IN 'csv' 'c:\pruebatab.csv':
> s <- [FROM,TO] d~DISTANCE c~COST;
> :
> end;-- glpk xypron wrote :




reply via email to

[Prev in Thread] Current Thread [Next in Thread]