Hello Yingjie, glp_set_row_bnds() can be applied to the row with the objective function and is respected by the optimizer.
The bounds refer to the objective function without any constants. E.g. in minimize obj: 2x + 3y + 5; the bound set with glp_set_row_bounds relates to (2x + 3y). You have to switch off the presolver. smcp->presolve = GLP_OFF; iocp->presolve = GLP_OFF; Build a row index with glp_create_index(lp); Find the relevant row with row = glp_find_row(lp, "obj"); Set the upper or lower bound like this glp_set_row_bnds(lp, row, GLP_UP, 0., 319.); Solve the LP relaxation with ret = glp_simplex(lp, smcp); This is necessary because the presolver is switched off. Afterwards solve the MIP with ret = glp_intopt(lp, iocp); Best regards Heinrich Schuchardt On 11/24/2016 07:23 PM, Heinrich Schuchardt wrote: > Hello Yingjie, > > when doing minimization a lower bound could help to fathom some nodes in > the search tree. But typically the lower bound is approaching the > solution asymptotically so the bound would have to quite tight to have a > sizable effect. An upper bound probably will not reduce the solution time. > > You also could supply a heuristic solution in the callback function to > set a lower bound. > > You can add a row with the same coefficients as the objective function > and give it bounds with glp_set_row_bnds. > > Maybe glp_set_row_bnds can simple be applied to the row with the > objective. I have not tried. > > Best regards > > Heinrich Schuchardt > > On 11/22/2016 02:45 AM, Yingjie Lan wrote: >> Hi there, >> >> I am trying to use the glpk C API to set an upper and lower bound for >> the mip solver, hoping to speed up the optimization. After searching the >> document, I still have no clue. Can anybody point me to the right >> direction? If the C API can't do so, how about the GLPK MPL? >> >> Many thanks! >> >> Yingjie _______________________________________________ Help-glpk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-glpk
