Problem in @NLobjective

Hi everyone!
I’m a new Julia user.
I am using Julia 1.2 and JuMP v0.20.0 for some optimization problems.
I have a constrained nonlinear optimization and I would like to define a nonlinear objective function composed by two parts: one is a sum of vector components (each multiplied by a different coefficient), while the other one should be insert in the objective function only if some optimization variables (xNL[[Nvar*(i-1)+1]]) assume a value above a certain tolerance (>1e-4).
I think the expression “>” is not supported in @NLobjective, is there some way to obtain the NLobjective function I need?
I attach a photo which shows part of my JuMP model and the relative error.
Thanks in advance for help!

You cannot use > in a sum like this. To model this properly, you will need to add binary variables, transforming your problem into a mixed-integer nonlinear program (i.e., very hard to solve), and you won’t be able to use Ipopt. Are you sure you want to have a hard 0-1 jump?

A slightly relaxed approach could be to use a sigmoid centered at 1e-4.

p.s., You should read the first post of: Please read: make it easier to help you. In particular, it’s much easier to help if you post the text of your code, rather than a photo.

thank you very much for the answer! I used the sigmoid and it works!
I’m sorry for posting the screenshot, next time I’ll text my code following the ten points shown in the post!
Thanks again!