MATLAB: Discontinuous Objective Function – unable to use fmincon

fminconoptimizationOptimization Toolbox

Related to a previous question I asked on Optimization with a vector of penalty functions
I need to minimise the objective function which is the sum of a series of quadratics [a unique set of coefficients for each x(i)]:
N = size(coeffLocal,1);
y = zeros(N,1);
xHat = zeros(size(x));
for i = 1:N
if x(i)
xHat(i) = (x(i)-muLocal(i,1))/muLocal(i,2);
y(i) = coeffLocal(i,1) * (xHat(i))^2 + coeffLocal(i,2) * xHat(i) + ...
coeffLocal(i,3);
end
end
f = sum(y);
This optimization is S.T. equality and inequality constraints within bounds.
I am using fmincon because I cannot cast my problem in a form suitable for quadprog.
My call to fmincon is
[tradeWeightsMC,fValMC,exitFlagMC,outputMC] = fmincon(@objFun,...
abs(WeightsLP),A,0,AEq,delta,lowerBounds,upperBounds);
where the weightsLP is the result of a prior linear programming step based on a fixed vector of costs/penalties which I improve upon with my new objective function.
It seems fmincon always returns the local minimum I supply as an initial starting point – in the example above it will return abs(WeightsLP) – but I can calculate a better solution myself. Giving fmincon this solution results in fmincon returning this!
I believe the cause to be that I have the condition that the only contributors to the value of my objective function are the non-zero terms in x – i.e. the
if x(i)
condition above as this will cause a discontinuity.
I have tried all suitable fmincon algorithms and all possibilities within the optimisation toolbox that I believe are relevant. Has anyone managed to solve a problem of this sort before?
I don't have access to the globaloptimization toolbox but even then sending multiple initial solutiuons to fmincon seems an unlikely solution as the problem is probably the discontinuity in my objective function.
I would be very grateful for any pointers.
Many thanks, Oliver

Best Answer

If the constraints are separable into 1D constraints, then so is the optimization problem. The 1D problem, though discontinuous, is much easier to solve.