set_mip_gap

Specifies the MIP gap value.

void set_mip_gap(lprec *lp, REAL mip_gap);

Return Value

set_mip_gap has no return value.

Parameters

lp

Pointer to previously created lp model. See return value of make_lp, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS

mip_gap

The MIP gap.

Remarks

The set_mip_gap function sets the MIP gap that specifies a tolerance for the branch and bound algorithm. This tolerance is the difference between the best-found solution yet and the current solution. If the difference is smaller than this tolerance then the solution (and all the sub-solutions) is rejected. This can result in faster solving times, but results in a solution which is not the perfect solution. So be careful with this tolerance.
The default mip_gap value is 1e-9

Example

#include <stdio.h>
#include <stdlib.h>
#include "lpkit.h"

int main(void)
{
  lprec *lp;

  /* Create a new LP model */
  lp = make_lp(0, 0);
  if(lp == NULL) {
    fprintf(stderr, "Unable to create new LP model\n");
    return(1);
  }

  set_mip_gap(lp, 1.0e-8); /* sets mip_gap to 1e-8 */

  delete_lp(lp);
  return(0);
}

lp_solve API reference

See Also make_lp, copy_lp, read_lp, read_lp_file, read_LP, read_mps, read_MPS, get_mip_gap, get_epsd, set_epsd, set_infinite, get_infinite, set_epsilon, get_epsilon, set_epsb, get_epsb, set_epsel, get_epsel, get_epspivot, set_epspivot, set_epsperturb, get_epsperturb