help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] [Fwd: glp_ios_heur in Java: format of heuristic solution]


From: Andrew Makhorin
Subject: [Help-glpk] [Fwd: glp_ios_heur in Java: format of heuristic solution]
Date: Mon, 20 Feb 2012 23:05:31 +0300

-------- Forwarded Message --------
From: Simon B <address@hidden>
To: address@hidden
Subject: glp_ios_heur in Java: format of heuristic solution
Date: Mon, 20 Feb 2012 18:48:39 +0000

Hi there,

I'm using GLPK 4.47 in Java. My aim is to provide a heuristic solution
which is stored in a double array "soln", with the coefficient of the
first column being stored at index 1.

When I use the code as given below, the optimiser happily accepts the
suggested solution and terminates with an infeasible solution. As I
understand from the documentation, it doesn't check feasibility of the
solution provided internally, so I guess the problem is that I provide
the heuristic solution in a wrong format which is misinterpreted by the
GLPK. In particular, I wonder whether the provided heuristic solution
must take the pre-processing stage (reduction of colums, etc) into
account?



          GlpkCallbackListener myCallback = new GlpkCallbackListener() {
            @Override
            public void callback(glp_tree tree) {
                System.out.println("We were called by library...");
                if(GLPK.glp_ios_reason(tree) == GLPKConstants.GLP_IHEUR)
{
                    System.out.println("...and it asked for heuristic
solution!");
                    SWIGTYPE_p_double swigSoln =
GLPK.new_doubleArray(soln.length);
                    
                    for(int i = 1; i < soln.length; i++) {
                        GLPK.doubleArray_setitem(swigSoln, i, soln[i]);
                    }
                    
                    GLPK.glp_ios_heur_sol(tree, swigSoln);
                }
            }


Thanks for your help.

Simon




reply via email to

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