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
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
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 "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_epsilon(lp, 1.0e-3); /* sets epsilon to 0.001 */
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_epsilon, set_infinite,
get_infinite, set_epsb,
get_epsb, set_epsd,
get_epsd, set_epsel, get_epsel, get_epspivot, set_epspivot, set_epsperturb, get_epsperturb, set_mip_gap, get_mip_gap
|