# How can I significantly improve the speed of this linear programming problem in JuMP?

**URL:** <https://discourse.julialang.org/t/how-can-i-significantly-improve-the-speed-of-this-linear-programming-problem-in-jump/32125>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump, linear-programming\
**Created:** [December 10, 2019, 11:14pm UTC](https://discourse.julialang.org/t/how-can-i-significantly-improve-the-speed-of-this-linear-programming-problem-in-jump/32125 "2019-12-10T23:14:10Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![zxjroger](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zxjroger/32/11826_2.png) [@zxjroger](https://discourse.julialang.org/u/zxjroger)\
**Post date:** [December 13, 2019, 8:09pm UTC](https://discourse.julialang.org/t/how-can-i-significantly-improve-the-speed-of-this-linear-programming-problem-in-jump/32125/8 "2019-12-13T20:09:22Z")

</div>

Hi odow,

Your code indeed improves the speed a lot. I really appreciate it. However, there is a glitch in function `solve_lower_bound`. After I add the following code, the speed is basically the same as my original code, is there another way to write this code?

```julia
    if has_upper_bound(model_lb[:lambda_sum][i, j])
        delete_upper_bound(model_lb[:lambda_sum][i, j])
    end

    if has_lower_bound(model_lb[:lambda_sum][i, j])
        delete_lower_bound(model_lb[:lambda_sum][i, j])
    end

```

Without the above code, it solves 10 problem for N=500 in 9 seconds, after I add the above code, the time is nearly doubled. I am not sure why the new code will take so much time.

The reason I need the above code is as follows. For one iteration, it puts bounds on all `lambda_sum[i_lb, j_lb]` except for `lambda_sum[i, j]`. In the next iteration, say that we are going to solve for `W[i',j']`, so that there should be no bounds on `W[i',j']`. However, the bounds put on `W[i',j']` in the previous iteration are still there. Therefore, I add the following codes to clear bounds before the for-loop in function `solve_lower_bound`.

---

_[View the full topic](https://discourse.julialang.org/t/how-can-i-significantly-improve-the-speed-of-this-linear-programming-problem-in-jump/32125)._
