Integrality Tolerance
Integrality Tolerance in MIP: How Close Is βInteger Enoughβ?
Integrality tolerance decides when a variable value is considered βintegerβ by a solver.
It balances numerical stability with discrete accuracyβand itβs separate from the optimality gap.
This calculator exposes the integrality tolerance as a setting: try different values in the ILP/MILP calculator and watch when solutions flip from βinteger-feasibleβ to βnot integerβ in the branch-and-bound steps.
On this page
- Quick takeaway
- What is integrality tolerance?
- How solvers use integrality tolerance internally
- Questions people ask about integrality tolerance
- Typical default values and recommended ranges
- What happens if you tighten or loosen the tolerance?
- Integrality tolerance vs optimality gap (donβt mix them)
- Worked examples (and what to look for)
- Common mistakes & safe adjustment rules
- What to do next
Quick takeaway:
Integrality tolerance is the numerical threshold used to decide whether an apparently fractional variable value
should be treated as integer. If |x β round(x)| β€ tol, the solver counts x as integer.
Common solver defaults are 1e-5 (Gurobi, CPLEX) and 1e-6 (HiGHS); teaching tools often use a stricter value such as 1e-9.
Changing it affects which solutions are considered integer-feasible, but it does not change the definition of
the optimality gap.
What is integrality tolerance?
It is how close to a whole number a value must be for the solver to accept it as an integer; with a tolerance of 1e-6, for example, 2.0000004 counts as 2.
Definition
Plain-English definition with the actual test
Solvers rarely get exact integers like 1.0000000000 due to floating-point arithmetic. Instead, they use a test:
|x - round(x)| β€ tol β treat x as integer
Here tol is the integrality tolerance.
If the difference between x and the nearest integer is below tol, the solver considers the variable βinteger enoughβ
for feasibility and branching decisions.
How solvers use integrality tolerance internally
Mechanics
Three main places tolerance shows up
- Feasibility checks: deciding whether a candidate solution satisfies integer constraints.
- Branching decisions: determining which variables are βfractional enoughβ to branch on.
- Reporting: printing βx β {0,1}β in solution summaries even when values are stored as floating-point approximations.
In the ILP/MILP calculator, the βIntegrality tolβ setting directly controls this test.
Questions people ask about integrality tolerance
People ask
What is a good integrality tolerance value?
Usually the solver’s default: 1e-5 in Gurobi (IntFeasTol) and CPLEX (EpInt), and 1e-6 in HiGHS (mip_feasibility_tolerance). Change it only if you see a specific numerical problem.
Smaller values are stricter (fewer βnearly integerβ values accepted), but can be more sensitive to numerical noise. Larger values are more forgiving but can accept visibly fractional values as βinteger.β
People ask
Does integrality tolerance affect the optimality gap?
Not directly. The optimality gap compares objective values of the incumbent and best bound (see optimality gap in MIP).
Integrality tolerance affects which solutions count as integer-feasible, which indirectly influences which incumbents are possible, but the formula for gap itself is separate.
People ask
Can changing integrality tolerance make the solver faster?
Sometimesβbut usually only subtly.
Looser tolerance can prevent over-branching on tiny numerical deviations. However, if you loosen it too much, you may accept solutions that are visually non-integer or violate discrete logic. Itβs almost always better to fix scaling/bounds first before tweaking tolerance.
Typical default values and recommended ranges
Defaults
What major solvers use (approximate ranges)
| Solver (indicative) | Typical integrality tolerance | Notes |
|---|---|---|
| Gurobi | 1e-5 default (IntFeasTol; allowed range 1e-9 to 0.1) | Gurobi’s documentation says tolerances rarely need adjustment; its IntegralityFocus setting is the suggested alternative to tightening IntFeasTol. |
| CPLEX | 1e-5 default (EpInt / mip.tolerances.integrality) | Adjustable but rarely needs manual tuning. |
| HiGHS (open source) | 1e-6 default (mip_feasibility_tolerance) | Other open-source solvers use their own defaults; check each solver’s option list. |
1e-9, emphasizing clarity in small teaching examples.
For large industrial models, people usually keep the solver default (1e-5 or 1e-6), because a much tighter tolerance can run into floating-point noise.
What happens if you tighten or loosen the tolerance?
Tightening it makes integer results stricter but can slow the solver or cause numerical trouble; loosening it speeds things up but may accept values that are not quite whole numbers.
Effects
Tightening integrality tolerance (e.g., from 1e-6 to 1e-9)
- Fewer values will be treated as βinteger enough.β
- The solver may need to branch more to drive variables closer to exact integers.
- You reduce the risk of accepting solutions with visible fractional parts.
Effects
Loosening integrality tolerance (e.g., from 1e-6 to 1e-4)
- More values (like 0.00009 or 0.99991) will count as integer.
- You might see slightly faster solves if the model was over-branching due to tiny violations.
- You risk treating noticeably fractional values as binaries/integers if the model is poorly scaled.
Safe rule: treat tolerance as a numerical safeguard, not a knob for βfixingβ modeling issues. If youβre tempted to set a very large tolerance, fix scaling and bounds instead.
Integrality tolerance vs optimality gap (donβt mix them)
Conceptual separation
Two different questions entirely
| Concept | What it controls | Where it appears |
|---|---|---|
| Integrality tolerance | How close a variable must be to an integer to count as integer-feasible. | Feasibility checks, branching, printed solution values. |
| Optimality gap | How far the incumbentβs objective may be from the true optimum. | Stopping criteria, solver logs, and quality certificates. |
For the gap itself, see optimality gap in MIP.
Worked examples (and what to look for)
Worked example
Example: variable at 0.9999998 with tolerance 1e-6 vs 1e-9
|x - round(x)| = |0.9999998 - 1| = 2e-7
- With
tol = 1e-6,2e-7 β€ 1e-6β treated as integer (OK). - With
tol = 1e-9,2e-7 > 1e-9β not integer; solver will try to improve integrality.
In the ILP/MILP calculator, you can adjust the integrality tolerance and see when a solution is accepted or rejected as integer-feasible in the branch-and-bound steps.
Common mistakes & safe adjustment rules
Mistakes
Mistake: using integrality tolerance to βhideβ modeling or scaling issues
If your variable values are off by 0.01 or 0.1 from integers, the issue is almost never toleranceβitβs:
- Bad scaling (huge/small coefficients),
- Loose or inconsistent bounds,
- Incorrect or missing constraints.
Fix those first; only then consider fine-tuning tolerance.
Mistakes
Mistake: assuming tighter tolerance always improves solution quality
Overly tight tolerance can cause:
- Longer runtimes (more branching to achieve strict integrality),
- False βinfeasibleβ or βno incumbentβ outcomes in numerically delicate models.
If your model is well-scaled and your solver is stable, defaults are usually good enough.
What to do next
Next steps
Experiment safely with the ILP/MILP calculator
- Load a small ILP example in the ILP/MILP calculator.
- Solve with the default integrality tolerance and note the solution values.
- Tighten the tolerance (e.g., 1e-9) and observe whether more branching or different node behavior occurs.
- Loosen it (e.g., 1e-4) and see when solutions with visible fractional parts start to be accepted.
Connect what you see to LP relaxation bound and optimality gap to build intuition about numerical vs structural issues.
Disclaimer
This explanation of integrality tolerance and the associated calculator settings is provided for educational and informational purposes only. Actual MIP solver behavior depends on many numerical and implementation details beyond this overview. Do not rely solely on these settings or this article for high-stakes optimization decisions without verifying behavior in your target solver and consulting its official documentation.
Methodology: How This Guide Works
This guide explains integrality tolerance in integer programming using the standard textbook treatment found in operations-research courses (for example Hillier & Lieberman, Introduction to Operations Research, and Taha, Operations Research: An Introduction). Each step is written so you can repeat it by hand, and the worked examples use the same steps as the CalcTypes ILP solver, so you can reproduce them there.
Assumptions and Limitations
Assumptions
- A value within the tolerance of a whole number (for example 1e-9) is accepted as an integer.
- The model is scaled sensibly, with coefficients of similar magnitude.
- The objective and every constraint are linear, and all coefficients are known constants.
Limitations
- A loose tolerance can accept values that are not truly integer; a very tight one can slow solving.
- Software uses floating-point arithmetic, so tiny rounding differences from hand calculations are normal.
- Recommended defaults differ between solvers.
Sources
- Gurobi Documentation β MIP Parameters (IntFeasTol, MIPGap)
- IBM ILOG CPLEX Optimization Studio β Integrality tolerance (epint)
- HiGHS documentation β List of options (mip_feasibility_tolerance)
- Google OR-Tools β MIP concepts and solver parameters
- Nemhauser & Wolsey β Integer and Combinatorial Optimization (MIT Press listing)
Disclaimer
Please read before relying on this page. This page on Integrality Tolerance explains optimisation methods for study. Worked examples use simplified models; real problems usually need extra constraints and careful validation. Check methods against your course, and validate any model before using it for real decisions.
Your responsibility. Results are estimates for general information and education only, and nothing here is professional advice. You use this page at your own risk; to the fullest extent permitted by law, CalcTypes, its authors and reviewers accept no liability for loss, injury or damage arising from reliance on it. Spotted an error? Use βReport an issueβ or our contact page. Full terms: Disclaimer Β· Terms of use.