Question about 2 output optimization

12 views (last 30 days)
Kokalz
Kokalz on 24 Sep 2014
Commented: Kokalz on 7 Oct 2014
Hi guys!
I'm struggling to formulate a typical optimization problem into something than can be solved by MATLAB and was hoping you could assist me with this. I do have optimization toolbox available on my machine, so can use any function offered by the toolbox.
I have a software simulating a very complex non-linear model, that takes a set of inputs and gives me 2 outputs. In this case I am running a batch of simulations, only changing 3 input parameters, so I basically have a matrix of 3 input values and a matrix of output values. My aim is to correlate 1-st output parameter to match real-life data as closely as possible, while keeping the 2nd output parameter equal to a certain value. In other words I am trying to minimize error between real-life data and simulated data (what would be a typical error function for such case?), while imposing an equality constraint on the second output. I obviously cannot write the whole simulation in terms of single f(x) function to minimize.
Any thoughts on how to write such optimization problem and what function is typically used for something like this ?
Thank you for any help!

Accepted Answer

Alan Weiss
Alan Weiss on 24 Sep 2014
This sounds straightforward to solve in Optimization Toolbox. You have a nonlinear equality constraint (the value of the second output) and want to minimize the difference between the first output and some data that you already have (maybe the sum of squares of the differences of the components if it is multidimensional).
You can easily formulate this for fmincon. To save computation time, use the technique described here for the case when your nonlinear constraint and objective function are given by the same computation.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
  9 Comments
Alan Weiss
Alan Weiss on 6 Oct 2014
If it is impossible for MATLAB to communicate with your simulation, then I do not see how you can profitably use MATLAB optimization functions. The functions query various values of the control variables (x) and use the resulting objective function values to guide a search for the lowest objective function consistent with constraints.
But an idea just popped into my head. I suppose that you might write a grid of control variable values, evaluate the objective and constraints on this grid, and then construct an interpolating function that fmincon could evaluate. For an example using this technique, see Pattern Search Climbs Mt. Washington. The objective function, terrainfun, is just a call to interp2. You could do the same with the nonlinear constraint.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Kokalz
Kokalz on 7 Oct 2014
That's exactly what I was looking for! I'll give it a go. Huge thank you for your help!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!