help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] glp_ios_heur_sol


From: Andrew Makhorin
Subject: Re: [Help-glpk] glp_ios_heur_sol
Date: Thu, 29 Oct 2009 17:32:17 +0300

> I would like to fix all variables of a MILP problem before launching
> optimization (to help the branch&cut solver with an upper bound, for  
> instance).
> Those values are taken either from a custom heuristic of my own or  
> from a previously launched MIP optimization.

> Anyway, I don?t understand how to do such a thing with GLPK 4.38.

> I would like to use glp_ios_heur_sol(), but it doesn?t seem to be the
> method I?m searching for (I don?t understand what is the ?primal  
> heuristic? that we have to launch before using glp_ios_heur_sol()).

Primal heuristic is a heuristic, which is able to determine an integer
feasible solution as a set of primal values of all variables (columns).

> But I don?t know how to do it differently.
> You gave an answer on thread Setting initial integer solution in  
> GLPSOL (see   
> http://www.nabble.com/Setting-initial-integer-solution-in-GLPSOL-to21005682.html#a21008418).

> If I?ve correctly understood, you said that one have to patch GLPK to
> do so ? Because there isn?t any parameter in glp_iocp structure  
> indicating that the current solution stored comes from a heuristically
> found solution.

> In fact, I want to call a glp_initial_sol(lpProb* prob, const double  
> values[]) which would fix all the MILP variables with the ?values?  
> array and check for feasibility. Is there any way to do it with GLPK  
> 4.38 ?

If you have an integer feasible solution, which you would like to
pass to the mip solver to provide an initial upper bound, you could
use the following code:

void foo(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;
}

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 = foo;
   parm.cb_info = ... ;
   ret = glp_intopt(mip, &parm);
   . . .
}

For more details about glpk api routines used here please see the
reference manual.





reply via email to

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