Problem with optimization problem when using constraints

3 views (last 30 days)
Hi, I have a problem to minimize and I'm trying to use fmincon. I have an objective function where I run a simulation in another program and compare results to create an error.
The problem comes when I add constratints. If I use fminsearch (which doesn't use constraints) I have a parameter with an initial value of 0.2 and I track every step in the program as I plot every change from the objective function called from fmincon. I can see the parameter is changed initially to 0.19 or something of the like when using fminsearch (10% change). When I set constraints with fmincon this value is changed to something like 0.20000001 maybe. Then it says it has found the solution for the tolerance and constraints given. As far as I know I'm setting everything alright and I don't know why this is happening. I have 11 parameters to optimize and some are varied 5% initially and other nothing at all. As far as I know all the constraints are well placed simply with the ub,lb parameter in fmincon.
So the question is, is this normal? Why some parameters are barely changed? It's the initial iteration, the algorithm needs to get an idea of the system so it should change them all, not some. What's wrong? I can only think it's the constraints but I have checked it several times. My lower bound is always lower than the initial parameter value and my upper higher. I call fmincon as:
p = fmincon(@funObj,handles.p0,[],[],[],[],handles.pmin,handles.pmax);
where handles.pmin and handles.pmax are the lower and upper bound respectively. The values are:
Initial guess: [300e-9,100e-9,500e-9,1e-6,130,5.2,0.2e-3,0.04,0.06,0.002,0.2]
Lower bound: [0.5e-9,0.25e-9,0.5e-9,0.01e-6,80,4.5,0.02e-3,0.01,0.01,0.0001,0.05]
Upper bound: [0.1030e-4,0.1010e-4,0.1050e-4,0.11e-4,200,10,1e-3,0.2,0.2,0.02,0.9]

Answers (1)

Alan Weiss
Alan Weiss on 11 Jun 2015
As explained in Optimizing a Simulation or ODE, solvers such as fmincon take small steps to estimate derivatives, and the size of these steps can be too small for a simulation to give reliable estimates. The solution is to set an option so that the solver takes larger finite-differencing steps. See Suggestions for Finite Differences for details.
Alan Weiss
MATLAB mathematical toolbox documentation

Community Treasure Hunt

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

Start Hunting!