My model has symbolic functions and ifelse discontinuities.
I turn the sign function into a smooth function where there is a smooth argument. When the smoothing parameter is 1e1 to 1e3, it can be solved well, but when the parameter is 1e4 or even 1e5, it is difficult to solve. What is the reason for this?
Now I’m thinking about using complementary relaxation to smooth the sign function, but that’s not ideal either.
Many of our solvers now directly handle ifthenelse and other nonsmooth or discontinuous functions. The methods used by these solvers are more accurate and reliable than smoothing the functions. To learn more, see our Modeling Guide for MPbased AMPL Solvers.
If you need more help, reply with an example of a model that you are trying to write.
I am using MA27 or MA57. May I know which solver to use
[

齐小龙

   
 Replied Message 
From  Robert Fourer via AMPL Discoursenotifications@ampl.discoursemail.com 
   
Date  08/04/2023 23:27 
To  qxl20161209qxl20161209@163.com 
Subject  [AMPL Discourse] [Support] On the solution of complementary The smoothing model ran into problemsrelaxation conditions 
 4er Team Member
August 4 
   
Many of our solvers now directly handle ifthenelse and other nonsmooth or discontinuous functions. The methods used by these solvers are more accurate and reliable than smoothing the functions. To learn more, see our Modeling Guide for MPbased AMPL Solvers.
If you need more help, reply with an example of a model that you are trying to write.
I need your help ,Sir
var z1{j in Sfe, k in Scp} = sqrt(Z[2,j,k]^2+seta)delta;
var z3{j in Sfe, k in Scp} = Sa*P[j,k]ka*Z[1,j,k]Finit;
var s1{j in Sfe, k in Scp} = 0.5*(z1[j,k]/sqrt(z1[j,k]^2+4*beta^2)+1);
var f1{j in Sfe, k in Scp} = ((Sa*P[j,k]ka*Z[1,j,k]Finitdelta)/((Sa*P[j,k]ka*Z[1,j,k]Finitdelta)^2+4*beta^2)^(1/2))*0.5*sqrt((z3[j,k]+Fssqrt((z3[j,k]Fs)^2+seta))^2+seta);
var f2{j in Sfe, k in Scp} = (Fc+(FsFc)*exp((Z[2,j,k]/Vs)^2))*(Z[2,j,k]delta)/((Z[2,j,k]delta)^2+4*beta^2)^0.5Fv*Z[2,j,k];
var Ff{j in Sfe, k in Scp} = f1[j,k]*(1s1[j,k])+f2[j,k]*s1[j,k];
This is Ff after smoothing ,but when beta = 1e8, it can not find optimal solvation…
Please help me
Sir ！！！！！！！！！！！！！！！！！
Since you have not provided a complete AMPL model, I cannot try solving it on my computer to see the trouble that Ipopt is having. However, I can make a good guess. When beta = 1e8, beta^2 = 1e16. That is such a small number that it is likely being ignored by Ipopt.
Of course, the model is mathematically correct for any value of beta > 0. But Ipopt’s algorithms must work with the limited precision that is available in computer arithmetic. As a result, when beta is very small, Ipopt is unable to compute correct results.
Do you get an acceptable solution when beta = 1e7 or even 1e6? Then maybe you could use that solution for your application. Alternatively you could try modeling F_f in a different way. To get advice about that, you would have to say which of v, v_s, F_c, F_v, F_s, F_a, and F_r are variables and which are parameters. (In AMPL terminology, if the value is given as part of the data, it’s a parameter; if the value is determined by the solver, it’s a variable.)
I tried some tests on your model with Ipopt and with another interiorpoint solver, Knitro. These tests confirmed what you have been seeing: when the value of beta gets too small, the problem becomes impossible to solve. In my tests, the failures started to occur when beta was around 5e4 for Ipopt, and when beta was around 4e5 for Knitro.
This limitation will affect any algorithm that requires the functions to be smooth. If the slope of some objective or constraint function changes too quickly, then a numerical implementation of the algorithm may fail. In your formulation, making beta smaller causes the slope of the constraint function to change more quickly; hence the solver fails when beta gets too small.
Thank you very much for your patient answer!I want to know if I use complementary relaxation conditions to solve, such as MPCC. That is to say, symbolic functions, absolute value functions, and if else functions are all expressed by introducing relaxation variables and adding constraints. Through simulation, it seems that this method also has problems. Is it because there are too many complementary relaxation conditions?
What solver should I use to directly deal with nonsmooth functions, can you recommend some solvers?
What is AMPL MP? Is it your new modeling platform?
There is no one solver that can be recommended for handling all nonsmooth functions. To suggest a solver for the function F_f in your model, it would be necessary to know which of v, v_s, F_c, F_v, F_s, F_a, and F_r are variables, and which are parameters. Can you provide this information?
MP is our new interface library for connecting AMPL to solvers. It enables AMPL models to use a more general range of expressions.
You get the benefit of MP automatically when you use a solver that has been built with the MP interface. Currently the MP interface is built into many mixedinteger solvers that work with AMPL, including Gurobi, Xpress, COPT, Mosek, HiGHS, and CBC.