[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] problem with glp_ios_heur_sol
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] problem with glp_ios_heur_sol |
Date: |
Mon, 05 Aug 2013 18:06:36 +0400 |
> I am now having a problem with using glp_ios_heur_sol() to provide an
> initial integer feasible solution by heuristic.
> To do so I did as follows:
>
> void callback(glp_tree *tree, void *info)
>
> { if (glp_ios_reason(tree) == GLP_IHEUR &&
> glp_ios_curr_node(tree) = 1)
> { /* lp relaxation to the root subproblem has been just
> solved */
> glp_ios_heur_sol(tree, <array of x[j] found by heuristic>);
> }
> return;
> }
> And then in the main function:
> int main(...)
> { glp_prob *mip;
> glp_iocp parm;
> . . .
> <apply your own heuristic to find all x[j], j = 1,...,n>
> . . .
> glp_init_iocp(&parm);
> parm.cb_func = callback;
> parm.cb_info = ... ;
> ret = glp_intopt(mip, &parm);
> . . .
> }
> Although the array x[] is set correctly (I am sure after carefully
> checked), the result is still incorrect. Is anyone has successfully
> applied this can share something?
You may try to add after a call to glp_ios_heur_sol the following call:
glp_print_mip(glp_ios_get_prob(tree), "filename.txt");
It prints the current integer feasible solution to a text file, and it
should be your solution if glp_ios_heur_sol accepted it. Note that
glp_ios_heur_sol doesn't check integer feasibility, so make sure that
the heuristic solution you provide is feasible (see the feasibility
conditions printed at the bottom of the text file).
- Re: [Help-glpk] problem with glp_ios_heur_sol, (continued)
- Re: [Help-glpk] problem with glp_ios_heur_sol, Giorgio Sartor, 2013/08/05
- Re: [Help-glpk] problem with glp_ios_heur_sol, Le Dinh Danh, 2013/08/05
- Re: [Help-glpk] problem with glp_ios_heur_sol, Giorgio Sartor, 2013/08/05
- Re: [Help-glpk] problem with glp_ios_heur_sol, Le Dinh Danh, 2013/08/06
- Re: [Help-glpk] problem with glp_ios_heur_sol, Giorgio Sartor, 2013/08/06
- Re: [Help-glpk] problem with glp_ios_heur_sol, Giorgio Sartor, 2013/08/06
- Message not available
- Message not available
- Message not available
- Re: [Help-glpk] problem with glp_ios_heur_sol, Giorgio Sartor, 2013/08/06
- Re: [Help-glpk] problem with glp_ios_heur_sol, Le Dinh Danh, 2013/08/06
- Re: [Help-glpk] SOLVED : problem with glp_ios_heur_sol, Giorgio Sartor, 2013/08/06
- Re: [Help-glpk] problem with glp_ios_heur_sol, Michael Hennebry, 2013/08/06
- Re: [Help-glpk] problem with glp_ios_heur_sol,
Andrew Makhorin <=