# set_epsilon

Specifies the epsilon that is used to determine whether a floating-point number is in fact an integer.

void set_epsilon(lprec *lp, REAL epsilon);

Return Value

set_epsilon has no return value.

Parameters

lp

epsilon

The epsilon that is used to determine whether a floating-point number is in fact an integer.

Remarks

The set_epsilon function specifies the epsilon that is used to determine whether a floating-point number is in fact an integer. This is only used when there is at least one integer variable and the branch and bound algorithm is used to make variables integer.
Integer variables are internally in the algorithm also stored as floating point. Therefore a tolerance is needed to determine if a value is to be considered as integer or not. If the absolute value of the variable minus the closed integer value is less than epsilon, it is considered as integer. For example if a variable has the value 0.9999999 and epsilon is 0.000001 then it is considered integer because abs(0.9999999 - 1) = 0.0000001 and this is less than 0.000001
The default value for epsilon is 1e-6
So by changing epsilon you determine how close a value must approximate the nearest integer. Changing this epsilon value to for example 0.001 will generally result in faster solving times, but your solution is less integer.
So it is a compromise.

Example

``````#include <stdio.h>
#include <stdlib.h>
#include "lp_lib.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_epsilon(lp, 1.0e-3); /* sets epsilon to 0.001 */

delete_lp(lp);
return(0);
}
``````