[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] about dual value
From: |
xypron |
Subject: |
Re: [Help-glpk] about dual value |
Date: |
Fri, 12 Jun 2009 13:08:07 -0700 (PDT) |
Hello Cen
cen zhihao-2 wrote:
>
> After having solved the mip problem succefully (optimal solution : x = x'
> and y = y'),
> I want to have the dual value of b with relaxing problem to continuous one
> and keep
> the solution at (x', y').
>
> Is there a function if GLPK giving this informaion? Or someone can help me
> to calculate these
> values.
>
I am currently trying to integrate this feature into GLPSOL.
Below is the coding I use for this purpose.
Best regards
Xypron
switch (sol)
{ case GLP_SOL:
break;
case GLP_IPT:
case GLP_MIP:
xprintf("Solving LP relaxation with fixed integers...\n");
for (j = 1; j <= n; j++)
{
kind = glp_get_col_kind(prob, j);
switch (kind)
{ case GLP_IV:
case GLP_BV:
switch (sol)
{
case GLP_IPT:
x = glp_ipt_col_prim(prob, j);
break;
default:
x = glp_mip_col_val(prob, j);
break;
}
glp_set_col_bnds(prob, j, GLP_FX, x, x);
}
}
glp_init_smcp(&parm);
parm.msg_lev = GLP_MSG_ALL;
parm.meth = GLP_DUALP;
ret = glp_simplex(prob, &parm);
break;
default:
xassert(sol!=sol);
}
for (j = 1; j <= m; j++)
{
dual = glp_get_row_dual(prob, j);
x = glp_get_row_prim(prob, j);
if (fabs(x) < 1e-9) x = 0.0;
// add code to save values here
}
--
View this message in context:
http://www.nabble.com/about-dual-value-tp23998514p24005367.html
Sent from the Gnu - GLPK - Help mailing list archive at Nabble.com.