Use the inequality function to express ranged inequality expressions

379 views
Skip to first unread message

Quang Minh Le

unread,
May 8, 2019, 3:52:50 PM5/8/19
to Pyomo Forum
Dear all,

I had an error "WARNING: DEPRECATED: Chained inequalities are deprecated. Use the inequality()
    function to express ranged inequality expressions." when I tried to solve the following equation. 

-----------------------
def _f_s(m):
if m.n - 2E6 >= 0:
return 1 - 0.056*(log(m.Rz))**0.64*log(m.Rm) + 0.289*(log(m.Rz))**0.53
else:
return (1 - 0.056*(log(m.Rz))**0.64*log(m.Rm) + 0.289*(log(m.Rz))**0.53)**(0.1*log(m.n)-0.465)

m.f_s = Expression(rule= _f_s)

-----------------------

I appreciate for your suggestions. Have a nice day.

Quang Minh 

Siirola, John D

unread,
May 9, 2019, 12:03:47 AM5/9/19
to pyomo...@googlegroups.com

You are running afoul of some operator overloading magic that we put into Pyomo a long time ago to support a ranged inequality syntax like “0 <= m.x <= 5”.  That syntax has been problematic and will be removed in the future.

 

In this case, is m.n a Var or mutable Param?  That would trigger the chained inequality logic.  You can make the warning “go away” by explicitly extracting the current value of m.n:

 

                if value(m.n) – 2E6 > 0:

 

Note that the Expression (m.f_s) will *not* change if m.n is later changed by either the user or a solver: rules are fired only when the model is constructed and are not callbacks.

 

john

--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/ddfe1dad-beea-469a-8cbd-0da7a4a47333%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Quang Minh Le

unread,
May 9, 2019, 8:43:49 AM5/9/19
to Pyomo Forum
Hello John,

Thank you for your reply. Your concern is correct when the m.n is the mutable parameter and it is changed later.
Could you take a look at my attached code and give a comment?
I appreciate it. 
Have a good day.

Quang Minh



To unsubscribe from this group and stop receiving emails from it, send an email to pyomo...@googlegroups.com.

Fatigue_damage_estimation.py

Quang Minh Le

unread,
May 23, 2019, 10:36:27 AM5/23/19
to Pyomo Forum
Dear Pyomo developers,

I am coming with some issues related to the mutable Parameters. Even though John mentioned that the expression is not executed if the mutable Param is changed later by the user. Regarding my problem, does anyone have suggestions on how my model is iteratively solved? 
Thank you.

Regards,
Minh

On Thursday, May 9, 2019 at 12:03:47 AM UTC-4, Siirola, John D wrote:

To unsubscribe from this group and stop receiving emails from it, send an email to pyomo...@googlegroups.com.

Fatigue_damage_estimation_post.py

Nicholson, Bethany L.

unread,
May 23, 2019, 10:42:56 AM5/23/19
to pyomo...@googlegroups.com

Minh,

 

I don’t see any “iterative solves” in the model you attached. In fact the only call to a solver is commented out. Did you attach the wrong model by mistake? Could you provide more detail on the problem you’re having?

 

Bethany

To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyomo-forum/80484a56-07a6-46e3-a565-c63f57242e3c%40googlegroups.com.

Quang Minh Le

unread,
May 23, 2019, 11:07:34 AM5/23/19
to Pyomo Forum
Hello Bethany,

I am sorry to mistakenly attach the wrong model. Please see the updated file. 
My model is iteratively executed to find the allowable cycling number N. The mutable parameters are used to estimate some pre-defined parameters to calculate the cycling numbers (lines 158 -161). 
If I implement the final result as the initial value for the cycling number, I could obtain the similar result and I supposed that there is nothing wrong to the equations. Only thing is that I cannot iteratively execute the model. 
Could you check and give me some suggestions? 
Thank you.

Minh
Fatigue_damage_estimation_solver_post.py
Reply all
Reply to author
Forward
0 new messages