# How to make if in the objective function

**URL:** https://discourse.julialang.org/t/how-to-make-if-in-the-objective-function/46859
**Category:** Optimization (Mathematical)
**Created:** [September 18, 2020, 5:13pm UTC](https://discourse.julialang.org/t/how-to-make-if-in-the-objective-function/46859 "2020-09-18T17:13:26Z")
**Posts on this page:** 1
**Showing post:** 9

<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: [September 18, 2020, 7:57pm UTC](https://discourse.julialang.org/t/how-to-make-if-in-the-objective-function/46859/9 "2020-09-18T19:57:46Z")

</div>

Please refrain from posting the same question multiple times:

> [@Why the results of my model remain the same even if the objective value changes?](https://discourse.julialang.org/t/why-the-results-of-my-model-remain-the-same-even-if-the-objective-value-changes/46817):
>
> I am struggling with modeling so much, for me what is logical is not so in the model. The next thing is how to force the system to change results by changing the objective value, so let me explain. I see we can only have one objective value and that is OK. So my guessing is that the system will try to Min (or Max) the value of the objective function by changing the variable(s), is that correct? In my objective function I have 2 parts: @variable(premex, PRODAMOUNT[op\_k in keys(\_ORDER\_P…

---

_[View the full topic](https://discourse.julialang.org/t/how-to-make-if-in-the-objective-function/46859)._
