# Successive optimization in JuMP

**URL:** <https://discourse.julialang.org/t/successive-optimization-in-jump/64056>\
**Category:** Optimization (Mathematical)\
**Tags:** jump, optimization\
**Created:** [July 4, 2021, 11:41pm UTC](https://discourse.julialang.org/t/successive-optimization-in-jump/64056 "2021-07-04T23:41:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [July 5, 2021, 12:20am UTC](https://discourse.julialang.org/t/successive-optimization-in-jump/64056/2 "2021-07-05T00:20:43Z")

</div>

I thought I recognized this problem:

> [@Updating expressions for indicator constraints in JuMP](https://discourse.julialang.org/t/updating-expressions-for-indicator-constraints-in-jump/59059):
>
> Hello, I am trying to implement a constraint with a conditional statement that I am making piecewise affine by introducing binary variables and using the big M method. I know that JuMP supports indicator constraints but I have not been able to find any relevant examples for more complicated use cases such as this one. My question may seem long, but I wanted to give enough information so that it is clear. When I run my code and look at how the expressions are being built, it does not look like t…

> Is there a better way of using the while loop with these conditions

A while loop like this is fine. You could also define

```Julia
iter = 1
tol = Inf
while abs(tol) > ftol && iter <= maxiter
    iter += 1
    # ...
    tol = adj_trials[iter] - adj_trials[iter-1]
end

```

> how the final solution could be made less sensitive to the initial?

I haven’t run your code, but my guess is that there are lots of local optima. Are you finding different `x` solutions with the same objective values? Or are the objective values different as well?

What does `adj` represent in reality?

---

_[View the full topic](https://discourse.julialang.org/t/successive-optimization-in-jump/64056)._
