# How to find single solution for this system of linear inequalities?

**URL:** https://discourse.julialang.org/t/how-to-find-single-solution-for-this-system-of-linear-inequalities/83149
**Category:** Optimization (Mathematical)
**Created:** [June 21, 2022, 9:24pm UTC](https://discourse.julialang.org/t/how-to-find-single-solution-for-this-system-of-linear-inequalities/83149 "2022-06-21T21:24:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Bobberson3108](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bobberson3108/32/37350_2.png) [@Bobberson3108](https://discourse.julialang.org/u/Bobberson3108)
#### Post date: [June 21, 2022, 9:24pm UTC](https://discourse.julialang.org/t/how-to-find-single-solution-for-this-system-of-linear-inequalities/83149/1 "2022-06-21T21:24:58Z")

</div>

I’m trying to solve a set of modular inequalities using JuMP by replacing the modulus with variables m and n. I’ve tried multiple different solvers but they’re all much too slow. I just want to find any singular solution for x within the constraints.

```julia
using JuMP
@variables(model, begin
        0<=x<=2^48 - 1, Int
        0<=n[1:9]<=82595524, Int
        0<=m[1:9]<=2^48-1, Int
    end)
@constraints(model, begin
        1966080 <= x - 3407872*n[1] - 281474976710656*m[1] <= 2031615
        3014667 <= 25214903917x - 3407872*n[2] - 281474976710656*m[2] <= 3080202
        277361452731 <= 281474976710656*m[3] + 3407872*n[3] - 205749139540585x <= 277361518266
        11718083172670 <= 281474976710656*m[4] + 3407872*n[4] - 233752471717045x <= 11718083238205
        49720480812293 <= 281474976710656*m[5] + 3407872*n[5] - 55986898099985x <= 49720480877828
        102626409177792 <= 281474976710656*m[6] + 3407872*n[6] - 120950523281469x <= 102626409243327
        25707281851743 <= 281474976710656*m[7] + 3407872*n[7] - 76790647859193x <= 25707281917278
        25979476925714 <= 281474976710656*m[8] + 3407872*n[8] - 61282721086213x <= 25979476991249
        137139455518281 <= 281474976710656*m[9] + 3407872*n[9] - 128954768138017x <= 137139455583816
    end)

```

Is there a more efficient way to solve this or a specific solver which would be best for this sort of problem?

---

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [June 21, 2022, 10:23pm UTC](https://discourse.julialang.org/t/how-to-find-single-solution-for-this-system-of-linear-inequalities/83149/2 "2022-06-21T22:23:27Z")

</div>

JuMP is probably the wrong tool for the job here. Most MILP solvers use `Float64` arithmetic, so even if you could solve this, you’re probably going to encounter approximation errors. (For example, solvers allow something like `1.000001` to be “integer”, they don’t work with exact integers.)

Where do the numbers come from, and why are they so large?

---

<div class="post-metadata">

### Author: ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)
#### Post date: [June 22, 2022, 1:59am UTC](https://discourse.julialang.org/t/how-to-find-single-solution-for-this-system-of-linear-inequalities/83149/3 "2022-06-22T01:59:26Z")

</div>

> [@Bobberson3108](#):
>
> `281474976710656`

This is `2^48`, so looks like you’re trying to do some arithmetic mod `2^48` explicitly?
