[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Database connectivity in MathProg
From: |
glpk xypron |
Subject: |
Re: [Help-glpk] Database connectivity in MathProg |
Date: |
Mon, 11 Feb 2008 21:30:05 +0100 |
Hello Andrew,
thank You for formalizing the syntax.
In my original message I proposed to put into the model file table declarations
and the table read and write statements and to put the table definitions into
the data file.
This will allow to use the same model with different data sets from separate
data sources, e.g. first using the model with a small data set from a CSV file
and then run in with data from an SQL data base by just changing the data file
and leaving the model untouched.
Could You, please, extend the syntax description to point out, where to place
the table declarations and definitions.
Best regards
Xypron
example:
File Model.mod
==============
set K dimen 2;
table T1;
table T2;
param p{K} >= 0;
param s;
var c{K} >=0;
table read T1;
maximize obj: sum((i, j) in K) p[i,j] * c[i,j];
s.t. c1: sum((i, j) in K) c[i,j] <= s;
solve;
table write T3;
end;
File Data1.dat
=============
data;
s := 10;
table T1 IN 'CSV' 'dist.csv' :
K <- [i ~ from, j ~ to] p[i,j];
table T2 OUT 'CSV' 'result.csv' :
{(i,j) in K} -> [i ~ from, j ~ to], p[i,j];
end;
File Data2.dat
=============
data;
s := 1000;
table T1 IN
'iODBC' 'DRIVER=MySQL;DSN=db;UID=glpkuser;PWD=pw' 'prices' :
K <- [i ~ from, j ~ to] p[i,j];
table T2 OUT
'iODBC' 'DRIVER=MySQL;DSN=db;UID=glpkuser;PWD=pw' 'production' :
{(i,j) in K} -> [i ~ from, j ~ to], p[i,j];
end;
> The syntax of the table statement in BNF is the following:
>
> * <table statement> ::= <input table statement>
> * <table statement> ::= <output table statement>
> *
> * <input table statement> ::=
> * table <table name> <alias> IN <string list> :
> * <input set> [ <column list> ] , <input list> ;
> * <alias> ::= <empty>
> * <alias> ::= <string literal>
> * <string list> ::= <expression 5>
> * <string list> ::= <string list> <expression 5>
> * <string list> ::= <string list> , <expression 5>
> * <input set> ::= <empty>
> * <input set> ::= <set name> <-
> * <column list> ::= <column name>
> * <column list> ::= <column list> , <column name>
> * <input list> ::= <input item>
> * <input list> ::= <input list> , <input item>
> * <input item> ::= <parameter name>
> * <input item> ::= <parameter name> ~ <column name>
> *
> * <output table statement> ::=
> * table <table name> <alias> <domain> OUT <string list> :
> * <output list> ;
> * <domain> ::= <indexing expression>
> * <output list> ::= <output item>
> * <output list> ::= <output list> , <output item>
> * <output item> ::= <expression 5>
> * <output item> ::= <expression 5> ~ <column name>
>
> Note: <expression 5> is an expression of level 5, which, while not
> enclosed in parenthesis, syntactically is numeric or symbolic
> expression.
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
- Re: [Help-glpk] Database connectivity in MathProg, (continued)
- Re: [Help-glpk] Database connectivity in MathProg, Andrew Makhorin, 2008/02/09
- Re: [Help-glpk] Database connectivity in MathProg, glpk xypron, 2008/02/09
- Re: [Help-glpk] Database connectivity in MathProg, Andrew Makhorin, 2008/02/09
- Re: [Help-glpk] Database connectivity in MathProg, glpk xypron, 2008/02/10
- Re: [Help-glpk] Database connectivity in MathProg, Andrew Makhorin, 2008/02/10
- Re: [Help-glpk] Database connectivity in MathProg, glpk xypron, 2008/02/10
- Re: [Help-glpk] Database connectivity in MathProg, Andrew Makhorin, 2008/02/10
- Re: [Help-glpk] Database connectivity in MathProg, glpk xypron, 2008/02/11
- Re: [Help-glpk] Database connectivity in MathProg, Andrew Makhorin, 2008/02/12
- Re: [Help-glpk] Database connectivity in MathProg, Andrew Makhorin, 2008/02/10
- Re: [Help-glpk] Database connectivity in MathProg,
glpk xypron <=
- Re: [Help-glpk] Database connectivity in MathProg, Andrew Makhorin, 2008/02/16
- Fwd: Re: [Help-glpk] Database connectivity in MathProg, glpk xypron, 2008/02/17
- Re: [Help-glpk] Database connectivity in MathProg, Andrew Makhorin, 2008/02/17
- Re: [Help-glpk] Database connectivity in MathProg, glpk xypron, 2008/02/17
- Re: [Help-glpk] Database connectivity in MathProg, Andrew Makhorin, 2008/02/10
- RE: [Help-glpk] Database connectivity in MathProg, Meketon, Marc, 2008/02/10
- Re: [Help-glpk] Database connectivity in MathProg, Andrew Makhorin, 2008/02/10