BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
JVenter4Absa
Calcite | Level 5

Hi all

 

To make matters simple, I have two equations of the form f(x) and g(x), and I would like to solve for the value of x that results in f(x) = g(x). I'm using PROC OPTMODEL where the objective is to minimize z(x)=f(x)-g(x) by changing the variable x. Obviously, the value of x that produces z(x) = 0 gives the perfect solution. However, suppose that I am satisfied if z(x) is less than or equal to some value epsilon, i.e., PROC OPTMODEL can terminate and give me the value of x as soon as z(x) <= epsilon (epsilon can be something like 0.005). How can I specify this in my PROC OPTMODEL options? My PROC OPTMODEL statement uses "min z_x = abs (f_x - g_x); solve with nlp / algorithm=interiorpoint maxiter=30;"

P.S. I note that after about 5 to 10 iterations, PROC OPTMODEL gets to a point where z(x) is really small (e.g., z(x) = 0.00001234...), but then it continues in an attempt to minimize z(x). For this reason, I've incorporated a "maxiter=30" option in the PROC OPTMODEL code.

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
Try
min z_x = abs (f_x - g_x);
-->
min z_x = (f_x - g_x)**2;

Which is a smooth function could get its derivatives, while abs() could not.

View solution in original post

2 REPLIES 2
Ksharp
Super User
Try
min z_x = abs (f_x - g_x);
-->
min z_x = (f_x - g_x)**2;

Which is a smooth function could get its derivatives, while abs() could not.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Discussion stats
  • 2 replies
  • 1461 views
  • 1 like
  • 2 in conversation