[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Problems with Connecting GLPK to Excel
From: |
aly |
Subject: |
Re: [Help-glpk] Problems with Connecting GLPK to Excel |
Date: |
Thu, 29 Jul 2010 04:33:50 -0400 (EDT) |
Hello Xypron,
Well, it works PERFETLY!!! Thanks a lot for that!
The only problem now in the same context happens when writing values back for
some of the non-existent records. Those non-existent records are non-existent
because the corresponding parameters are zero (and I don't input records that
have corresponding zero parameter values). However, the corresponding variables
for some of those records could be non-zero. An example is the delivery
quantity in a certain period. It could be non-zero even though the demand for
that period is zero. That is because such delivery quantity will be stored to
satisfy the demand in later periods for instance.
So, there is no record corresponding to that period with zero demand in the
table before solving the model (note that the table I'm dealing with here has a
field for the index "periods", another for the parameter "demand" and a third
for the variable "delivered quantity") and so, an error happens when the solver
tries to update the variable value for that period as it doesn’t find its
corresponding record.
I hope it is clear!
Any ideas on the best way to deal with that?
Best,
Aly
----- Original Message -----
From: "glpk xypron" <address@hidden>
To: address@hidden, "xypron glpk" <address@hidden>
Cc: address@hidden
Sent: Tuesday, July 27, 2010 4:54:48 PM GMT -05:00 US/Canada Eastern
Subject: Re: [Help-glpk] Problems with Connecting GLPK to Excel
Hello Aly,
the model below shows the correct syntax.
READONLY=FALSE is only needed for Excel not for Access.
In the table OUT statement a domain specifies over which
entries you iterate.
The last SQL statement is executed once per domain
entry.
All question marks in this last SQL statement are replaced
by the variables given after the colon.
Best regards
Xypron
set TF := { 'tf1', 'tf2', 'tf3' };
set P := { 'p1', 'p2', 'p3'};
set T := { 't1', 't2'};
param iq{TF, P, T} := Uniform01();
solve;
table t {j in TF, p in P, t in T} OUT 'ODBC'
'FileDSN=.\d2.dsn'
'UPDATE TransformerTypeStoragePeriodProducts'
' SET StorageQuantity = ?'
' WHERE TransformerTypeID = ?'
' AND PeriodID = ?'
' AND ProductID = ?' :
iq[j, p, t], j, t, p;
end;
-------- Original-Nachricht --------
> Datum: Tue, 27 Jul 2010 07:22:00 -0400 (EDT)
> Betreff: Re: [Help-glpk] Problems with Connecting GLPK to Excel
> Hi Xypron,
>
> Well, I have really tried a lot, but still with no luck.
>
> The following SQL syntax works fine in Access:
>
> UPDATE TransformerTypeStoragePeriodProducts SET StorageQuantity = 5
> WHERE TransformerTypeID = 1
> AND PeriodID = 1
> AND ProductID = 1;
>
> Then, when I try to have this in GLPK:
>
> table iq_jptyyy {j in TF, p in P, t in T} OUT 'ODBC'
> 'FileDSN=.\d2.dsn;READONLY=FALSE'
>
> 'UPDATE TransformerTypeStoragePeriodProducts'
> 'SET StorageQuantity = iq[j, p, t]'
>
> 'WHERE TransformerTypeID = j'
> 'AND PeriodID = t'
> 'AND ProductID = p';
>
> I get a syntax error saying that a semi colon is missing where expected.
>
> So, I tried this:
>
> table iq_jptyyy {j in TF, p in P, t in T} OUT 'ODBC'
> 'FileDSN=.\d2.dsn;READONLY=FALSE'
>
> 'UPDATE TransformerTypeStoragePeriodProducts'
> 'SET StorageQuantity = iq[j, p, t]'
>
> 'WHERE TransformerTypeID = j'
> 'AND PeriodID = t'
> 'AND ProductID = p':
> j ~ TransformerTypeID, p ~ ProductID, t ~ PeriodID, iq[j, p, t] ~
> StorageQuantity;
>
> And that one (and other similar ones) fails to write and the driver
> reports the error 733: "error on writing data to table iq_jptyyy, model
> postsolving error". One of the other ones for instance that gave the same
> error and
> didn't work for instance is:
>
> table iq_jptyyy {j in TF, p in P, t in T} OUT 'ODBC'
> 'FileDSN=.\d2.dsn;READONLY=FALSE'
>
> 'UPDATE TransformerTypeStoragePeriodProducts'
> 'SET StorageQuantity = iq[j, p, t]':
> j ~ TransformerTypeID, p ~ ProductID, t ~ PeriodID, iq[j, p, t] ~
> StorageQuantity;
>
>
>
> Any ideas?
>
> Thanks a lot for the continuous support, patience and help!! I certainly
> appreciate it!!
>
> Best,
>
> Aly
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
--
PhD Student
Rm. 407 Main Building
H. Milton Stewart School of Industrial and Systems Engineering
Georgia Institute of Technology
765 Ferst Dr., NW
Atlanta, Georgia 30332-0205, USA