Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hellow Mathcad Community
I need to solve a linear programming problem many times in a loop (updating some variables)...
unfortunately I don´t know how to do that..
Is there anyone who can help me?
thanks!
Please attach your worksheet so that we can see what you are trying to do.
Click at the upper right corner on "Use advanced editor" to do so.
As a first start perhaps it suffices to mention that you could turn a solve block into a function and call that from within a programmed loop.
I have attached an example of the mathcad (same as "mathcad help") and also the same example in a line-programming, but it doesn't work...
please if you could give some advices I'd be very greatfull
thanks
Hmm, kind of problem.
See attached file to get a general idea how a solve block could be parameterized and so turned into a function.
Unfortunately I was not able to do this with the example you had posted.
I am not sure about that, but It seems, that you cannot turn a solve block with Minimize/Maximize into a solve block (other than one of the optimization variables). Minimize and Maximize behave differently compared to Find, MinErr or OdeSolve. E.g. they can refer to functions outside of the solve block. Minimize and Maximize can be uses as stand alone function without "Given" if there are no constraints, just a function to maximize or minimize. If used hat way, you are able to turn it into a function with parameters.
Maybe someone else has a workaround which does the trick?
OK, now finally I got it to work with maximize, too. I knew it used to work back in the good old days, so why shouldn't it now.
When turning a solve block which is capped by maximize or minimize into a parameterized function it is essential that all used objective functions are dependent on those parameters, too. No matter if they use it or not.
Think thats covered briefly in the help, too 😉
Find attached a working worksheet - I have left the solve blocks with find remaning for whatever its worth.
Werner