[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-glpk] Addding an extra constraint to the problem-more calrific
From: |
Andrew Makhorin |
Subject: |
Re: [Help-glpk] Addding an extra constraint to the problem-more calrification |
Date: |
Sat, 17 Jul 2004 03:42:35 +0400 |
> I was working with problem lp (m constraints, n variables). Suppose at
>certain stage of primal simplex method I have a simplex tableau representing
>a feasible solution x* of the problem. Now I want to add
>one more constraint ax>=b which is satisfied by x*. The new problem
>lp' will have (m+1 constraints, n variables). At the end I want to have
>a simplex tableau which has the same feasible solution x* (basis will
>contain the previoius basic variables and the new slack veriables).
>
>From now on I want to work with lp' from that basis removing the problem
>lp.
>
>Can anyone tell me how it can be done quickly
>using some glpk callable routine?
Use the following call sequence:
i = lpx_add_rows(lp, 1);
lpx_set_row_bnds(lp, i, LPX_LO, <b>, 0.0);
len = ...; ind[...] = ...; val[...] = ...;
lpx_set_mat_row(lp, i, len, ind, val);
Once new row has been added, it becomes basic, so the current basis
remains valid. If you need to compute all basic solution components for
the current basis, call lpx_warm_up. If you need to re-optimize, call
lpx_simplex. In the latter case the solver starts from the current
basis, so re-optimization is performed very quickly.
Andrew Makhorin