Skip to main content
1-Visitor
March 22, 2013
Question

how to solve linear programming problem many times in a loop?

  • March 22, 2013
  • 1 reply
  • 2260 views

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!

1 reply

25-Diamond I
March 22, 2013

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.

1-Visitor
March 22, 2013

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

25-Diamond I
March 23, 2013

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?