[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Write solution on database
From: |
Heinrich Schuchardt |
Subject: |
Re: [Help-glpk] Write solution on database |
Date: |
Mon, 23 Feb 2015 23:27:17 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 |
Hello Diana,
glpk-java/examples/java/GlpkSwing.java shows what needs to be done.
Run glpk/examples/tsp.mod and press the terminate button.
You will see an output like
...
+ 7505: mip = 6.859000000e+03 >= 6.729000000e+03 1.9% (143; 254)
SEARCH TERMINATED BY APPLICATION
Optimal tour has length 6859
>From node To node Distance
1 14 479
...
In the program a GlpkCallbackListener is registered with
GlpkCallback.addListener()
In the callback routine of the listener
GLPK.glp_ios_terminate(tree);
signals that no further nodes shall be evaluated.
In the callback routine you will have to evaluate the elapsed runtime to
decide when to call glp_ios_terminate().
To determine that a feasible solution has been found you could use the
following code in the callback routine:
int reason = GLPK.glp_ios_reason(tree);
if (reason == GLPKConstants.GLP_IBINGO) {
// We have a better integer feasible solution.
}
Do not set tm_lim with glp_iocp.setTm_lim().
Best regards
Heinrich
On 23.02.2015 20:24, Diana Acosta wrote:
> Hi everybody,
>
> I´m working with GLPK for Java and I implemented a MIP problem using GNU
> MathProg. I have the issue that the time used to obtain a optimal
> solution it´s more longer that I need; for this reason I decide use the
> structure glp_iocp to set the time limit of search; this work fine; but
> I have a problem because my model works with database, I used
> specifically mysql server and an interface with phpmyadmin, and when the
> search stop because the time limit was exceed, I have a feasible
> solution because I know the value of the objective function for MIP
> solution, but the solution, the values of the variables, isn't write on
> the database because this limit stop totally the model (file .mod)
> before can write on database, and there is where I need the answer.
> So I wanna ask if anybody can help me with a function of a structure of
> GLPK, that I can use to write the answer on database or with any form to
> do this,
>
> Thank you so much :)
>
>
> --
> Diana Acosta Rueda