help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] [Fwd: Re: MySQL Driver Error]


From: Andrew Makhorin
Subject: [Help-glpk] [Fwd: Re: MySQL Driver Error]
Date: Sun, 18 Sep 2011 20:01:34 +0400

-------- Forwarded Message --------
From: Eric Moore <address@hidden>
To: Robbie Morrison <address@hidden>
Cc: GLPK help list <address@hidden>, Xypron <address@hidden>
Subject: Re: [Help-glpk] MySQL Driver Error
Date: Sun, 18 Sep 2011 10:56:16 -0400

Robbie,
 
I took a shot at beefing up the explanation.  Have a look below and let
me know if this is helpful.
 
 
********Update to the Online Documentation******************************
 
GLPK Windows 7 executable 

If you are using 64-bit Windows 7 and attempting to use the glpsol
executable to pull input data from a MySQL database, solve a problem
contained in your .MOD file and then write the solution back to your
MySQL dtabse, the following setup has been confirmed to work (last
confirmed in September 2011 using GLPK 4.47):

      * 64-bit MySQL Community Server 5.5.16 for WIndows (x86, 64 bit) -
        download from http://www.mysql.com/downloads/mysql/
      * 64-bit MySQL ODBC Connector 5.1.8 for Windows (x86, 64 bit) —
        download from http://dev.mysql.com/downloads/connector/odbc/ 
      * 64-bit GLPK executable — see obtaining Windows executables

The following MathProg code indicates one way of reading a set from a
MySQL database into your model.

/* Import finished goods set from MySQL database */

table t IN "iODBC"

   'DSN=glpk;UID=glpk;PWD=glpk'

   'export_finished_good' :

   FIN <- [ FinishedGood ];

In the above code, "export_finished_good" is the name of the table in
the MySQL database.  "FIN" is the set in glpk that you want to populate
with data from the MySQL database.  "FinishedGood" is the name of the
field in the "export_finished_good" table in the MySQL database that you
want to read data from to populate the "FIN" set in glpk.

The following MathProg code indicates one way of reading an array of
data from a MySQL database into your model.

/* Import Finished Good Demand from MySQL database */

table t IN "iODBC"

   'DSN=glpk;UID=glpk;PWD=glpk'

   'export_finished_good_demand' :

   [ FinishedGood, PERIOD ], FinDem ~ DEMAND;

In the above code, we are reading in the demand for a particular good in
each period.  'export_finished_good_demand' is the table in the MySQL
database that we are reading data from.  We use this data to populate
the array in glpk called FinDem which is dimensioned by "FIN" and "TIM"
which are two sets that represent the finished goods and the time
periods for the model.  "FinishedGood" is the field name in the database
table that contains the list of finished goods.  "PERIOD" is the field
name in the database table that contains the list of time periods for
the model.  "DEMAND" is the field name in the database tablet that
contains the demand for each finished good in each time period.  This
data is imported into a glpk array defined as FinDem{FIN, TIM}.

****************************************************************************************

See if this makes sense to you.  Feel free to shorten it if you need to.
I wanted to give you a good explanation of what I was doing so that you
can decide how best to explain it in the online documentation.  I may
have gotten some of the glpk terminology incorrect, but I think you'll
understand what I am doing.  For example, I'm not sure if "array" is the
proper term in glpk.

I pretty much have the "Out" function working to write data back to the
database, but at the moment I can only write sets back to the database.
I need finalize the code to write back things like inventory levels that
are dimensioned by finished goods and time periods.

I hope this is helpful for you.

Thanks for all your help.

Eric

 

 

 

 

 

 

On Sat, Sep 17, 2011 at 1:31 PM, Robbie Morrison <address@hidden>
wrote:
        
        Hi again Eric, Xypron
        
        ------------------------------------------------------------
        To:           Robbie Morrison <address@hidden>
        Subject:      Re: [Help-glpk] MySQL Driver Error
        Message-ID:
        
        <CAOHcWzQX0Tw+Sj7J6FMqrmowVFS8B8nb5oamMXCbj35Fd
        address@hidden>
        From:         Eric Moore <address@hidden>
        Date:         Sat, 17 Sep 2011 12:52:25 -0400
        ------------------------------------------------------------
        
        > Robbie,
        >
        > Thanks a lot. I got this to work beautifully last
        > night.  Here is what I have running.
        >
        > Windows 7
        > 64bit MySQL
        > 64bit MySQL ODBC Connector downloaded from Oracle
        > GLPK 4.47 64bit version
        >
        > If is used the 32 bit version of GLPK, I would get an
        > error stating that the there was an architecture
        > mismatch.  When I switched to the 64 bit version of
        > GLPK, everything worked.
        >
        > The code below worked nicely for me.
        >
        > table t IN "iODBC"
        >    'DSN=SupplyChainOptimization;UID=test;PWD=test'
        >    'export_fmatdloc' :
        >    fmatdloc <- [ fmatdloc ];
        >
        > Thanks again for all your work on this software.  It's
        > exciting stuff.
        >
        > Thanks,
        > Eric
        
        
        Just added a new subsection to the GLPK wikibook:
        
         http://en.wikibooks.org/wiki/GLPK/ODBC#GLPK_Windows_7_executable
        
        If either of you have a chance to check and/or improve
        the text, that would be great (given I don't use
        Windows or databases or MathProg).
        
        Thanks too for your kind comment, Eric.
        
        regards, Robbie
        
        ---
        Robbie Morrison
        PhD student -- policy-oriented energy system simulation
        Technical University of Berlin (TU-Berlin), Germany
        University email (redirected) : address@hidden
        Webmail (preferred)           : address@hidden
        [from Webmail client]
        
        
        





reply via email to

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