[Top][All Lists]

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

[Help-glpk] Java interface to GLPK - accessing result values

From: Robbie Morrison
Subject: [Help-glpk] Java interface to GLPK - accessing result values
Date: Tue, 10 Feb 2009 20:56:15 +0100
User-agent: Thunderbird (X11/20080306)

Hello Hartwig

First, I didn't have a chance to look at your attached
files.  But hopefully this post is on the right track!

You could try writing a custom interface class to sit
between the GLPK API recovery calls and the rest of
your program.  I use one for my C++ energy system
simulation, named class 'SolverIf'.  This kind of
abstraction also enables one to include some smarts,
both when building the problem (integrity tests, say)
and when recovering the results (bundled into vectors,
say).  (Some of the intelligence I first coded in is no
longer needed because the GLPK APIs have become smarter
themselves over time.)

One advantage (for me) is that the problem size need
not be specified in advance -- you just keep plying the
'SolverIf' object with data.  Perhaps you don't need
this flexibility.

I also put in some calls in to control the information
GLPK streams to the terminal in a convenient fashion.

You many wish to write classes to read in data and, on
completion, write out data at various levels of
resolution.  I use my own data model, which was
originally going to be XML based, but ended up being
textual (partly because text is easier to hand-edit).

You are welcome to my C++ source files for 'SolverIf'.
They are well documented and cleanly coded and might
provide some clues for a similar design in Java.

I would suggest some insight into object-oriented
design if you wish to head down this route.

Good luck, 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 IMAP client]

> ------------------------------------------------------------
> To:         <address@hidden>
> Subject:     [Help-glpk] Java interface to GLPK - accessing result values
> Message-ID: <address@hidden>
> From:       "Prof. Hartwig Baumgaertel" <address@hidden>
> Date:        Tue, 10 Feb 2009 16:13:34 +0100
> ------------------------------------------------------------
> Hi all,
> I plan to use GLPK by a Java application. I'm happy
> about the SWIG-based Java API - many thanks to Xypron.
> My application will use a predefined (MIP) model but
> dynamically created data. There are several
> possibilities to feed the data to the problem object,
> so far so good.  (For sake of simplicity I use a data
> file in my example, too.).
> My question is about the step after solving the
> model. I want to further use the result values (values
> of decision variables after successful model solve) in
> my Java application.  I created a solution which avoids
> files and databases.
> I would like to know how you experts look to this
> approach, and would appreciate any suggestions and
> improvements.
> I have no idea if it is trivial, stupid or the intended
> way to do this.  I also have no idea if there are
> pitfalls regarding memory usage, efficiency etc.
> Thank you in advance!
> Hartwig

reply via email to

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