[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-glpk] Re: Intermediate solutions
From: |
Andrew Makhorin |
Subject: |
[Help-glpk] Re: Intermediate solutions |
Date: |
Tue, 24 Jun 2003 08:03:50 +0400 |
>* Are these non-optimal solutions of the problem? or can they violate any
>problem constrain or bound? are they feasible solutions?
Each line printed after the message "Integer optimization begins..."
correspond to best integer feasible solution known at the current point.
"Integer feasible" means the solution satisfies to all constraints and
all integer variables have integral values.
>* If they are solutions of the problem, how can I access to these
>MIP non-optimal solutions?
You cannot do that on api level. However you can add your code directly
in the b&b driver as explained below.
Get into the module glplpx6c.c which is a b&b driver (lpx_integer) and
find the following fragment (lines 466-475 in glpk 4.0):
case MIP_V_BINGO:
/* better integer feasible solution has been found */
/* copy components of this solution to the original problem
object */
{ int k;
mip->i_stat = LPX_I_FEAS;
for (k = 1; k <= tree->orig_m + tree->orig_n; k++)
mip->mipx[k] = tree->best[k];
}
break;
This fragment is executed whenever the b&b solver discovers a new integer
feasible solution which is better than the currently known one.
You should add your code immediately before the break statement. At that
point 'mip' is a pointer to your problem object passed to the routine
lpx_integer. Using that pointer you can access components of the current
mip solution (which is integer feasible) with the following routines:
lpx_get_num_rows - obtain number of auxiliary variables (rows);
lpx_get_num_cols - obtain number of structural variables (columns);
lpx_get_mip_obj - obtain value of the objective function;
lpx_get_mip_row - obtain value of i-th auxiliary variable (row);
lpx_get_mip_col - obtain value of j-th structural variable (column).
Note that you must not change the problem object within the b&b driver.
- [Help-glpk] Re: Intermediate solutions,
Andrew Makhorin <=