cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Having problem with constrained minimization

ptc-4379858
1-Visitor

Having problem with constrained minimization

I am trying to solve a constrained minimization problem here. I traced values of constraints and objective function during iterations and found that the values are not changing at all. Even if I supply the correct solution as an initial guess, MathCAD keeps iterating. Please help.

ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:ptc-4379858)

You have a couple of problems. As Werner notes, one is that the eta function is implemented as a solve block, so that solve block has to be executed for every iteration of the minimize solve block. To make matters worse, you call the eta function inside summations in the Q function, and those are loops. You then call the Q function inside a summation, i.e. another loop, in the Err function. So you have an iterative solve block inside a loop, wihch is inside another loop, which is called by an iterative solve block. Fortunately, it is possible to rewrite the Q and Err functions to massively reduce the number of times the eta function has to be called.

Your other problem is that your problem looks like it's very badly conditioned. I think your objective function is very flat, so the solver wanders around a lot trying to find the minimum. This means a lot of iterations, but worse is that it makes it very sensitive to the guess values.

The attached worksheet converges to a solution in a reasonable time (although it's not fast!). To get a better solution you will have to play with the guess values and convergence tolerance though.

View solution in original post

3 REPLIES 3
Werner_E
25-Diamond I
(To:ptc-4379858)

Sanjay Joshi schrieb:

I am trying to solve a constrained minimization problem here. I traced values of constraints and objective function during iterations and found that the values are not changing at all. Even if I supply the correct solution as an initial guess, MathCAD keeps iterating. Please help.

I guess the problem is, that Mathcad runs out of memory after a rather long time, right?.

I am not sure, but i could imagine that this is due to the fact, that in your last Minimize solve block the constraint fuctions C and the errorfunction err makes use of the function Eta, which itself is implemented as a solve block. That way the first solve block gets called very, very often which could be the cause for that over consumption of time and memory.

I guess it would help If you would find a way to define Eta differently (which would be hard as you cannot symbolically solve for it).

Sorry, no solution.

RichardJ
19-Tanzanite
(To:ptc-4379858)

You have a couple of problems. As Werner notes, one is that the eta function is implemented as a solve block, so that solve block has to be executed for every iteration of the minimize solve block. To make matters worse, you call the eta function inside summations in the Q function, and those are loops. You then call the Q function inside a summation, i.e. another loop, in the Err function. So you have an iterative solve block inside a loop, wihch is inside another loop, which is called by an iterative solve block. Fortunately, it is possible to rewrite the Q and Err functions to massively reduce the number of times the eta function has to be called.

Your other problem is that your problem looks like it's very badly conditioned. I think your objective function is very flat, so the solver wanders around a lot trying to find the minimum. This means a lot of iterations, but worse is that it makes it very sensitive to the guess values.

The attached worksheet converges to a solution in a reasonable time (although it's not fast!). To get a better solution you will have to play with the guess values and convergence tolerance though.

Thanks a lot, Richard. Your reorganization of the calculations does bring down solution time significantly. However the main issue is, as you mentioned, the flatness of the objective function and the resulting sensitivity. I am implementing the procedure given in an old paper; I am trying to do it exactly the way the author proposed it.

Thanks again for your help.

Regards,

Sanjay

Announcements

Top Tags