Optimization with known second-order function

1 view (last 30 days)
Dear all,
I have a known function, for example y(x1, x2, x3, x4) = a0 + a1*x1 + a2*x2 + a3*x3 + a4*x4 + a12*x1*x2 + a11*x1^2 + a22*x2^2 + a44*x4^2;
where the parameters a0, a1, a2, a3, a4, a12, a11, a22, a44 are known. The task is to find the values of x1, x2, x3 and x4 that minimize y. Then calculate that y min.
Constraints: h1<=x1<=k1, h2<=x2<=k2, h3<=x3<=k3, h4<=x4<=k4
Would you please show me the direction to solve the problem? Thank you very much.

Accepted Answer

Roger Stafford
Roger Stafford on 15 Feb 2014
This particular example is not a well-posed problem. If the parameter x3 is nonzero, there is no minimum value for y. By decreasing x3 indefinitely if a3 is positive or increasing it if a3 is negative, there is no lower limit to the values y can assume.
In general where there is no constraint on the variables, one can call on 'fminsearch' or 'fminunc' of the Optimization Toolbox to find minimum values in functions of more than one variable. Both of these functions require that you furnish an initial estimate for the variables to begin the iteration. Depending on this initial value you may come up with more than one possible solution.
The quadratic functions of the type you have mentioned can be minimized by setting each of the partial derivatives of the function equal to zero which yields a set of linear equations, and these can be solved using matlab's matrix division. (Note that in the example you gave, the partial derivative with respect to x3 is equal to a3 and the equation a3 = 0 is either unsolvable or an identity, which gives a clue as to the errant nature of that particular example.) (Second note: Having partial derivatives all zero does not guarantee a minimum value, but if the variables are unconstrained, any true minimum must have all partial derivatives equal to zero.)
  3 Comments
Roger Stafford
Roger Stafford on 15 Feb 2014
If there are no constraints on x3 in your example, even if x1 and x2 are constrained, it remains true that there can be no minimum value for y. As x3 approaches -sign(a3)*inf, y approaches minus infinity and thus there is no finite minimum.
In the general case of second order equations, with limits on some of the variables, you should look for the minimum at the points where all partial derivatives are zero, and also combinations of cases where some of the variables are at their limits and some derivatives are zero.
Nguyen
Nguyen on 15 Feb 2014
I tried to constrain all variables and use 'fmincon'.
A=[]; b=[]; Aeq=[]; beq=[];
lb= [h1 h2 h3 h4]; ub= [k1 k2 k3 k4];
v0 = [a b c d];
[v,fval] = fmincon(@objfun,v0,A,b,Aeq,beq,lb,ub);
but it showed that:
fmincon stopped because the predicted change in the objective function is less than the default value of the function tolerance and constraints are satisfied to within the default value of the constraint tolerance.
How can I solve this problem?
Again, thank you very much.

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!