MATLAB: Optimization of a multivariable function

optimization

Hello, I have this following problem: I want to minimize the function f=1054.4372-351.0852.*x(2)-72.9064.*x(3)+1416.2477.*x(1).^2-349.3091.*x(1).*x(2)+81.2973.*x(1).*x(4)+815.8691.*x(2).^2-1076.9907.*x(1).^3+952.576.*x(1).^2.*x(2)+578.7052.*x(1).*x(2).^2-113.2848.*x(1).*x(3).^2-57.5303.*x(1).*x(3).*x(4)-121.6719.*x(1).*x(4).^2-1131.8391.*x(2).^3+107.4973.*x(2).^2.*x(4)+64.6476.*x(2).*x(3).*x(4)+91.0026.*x(3).*x(4).^2-134.1675.*x(4).^3;
on the following Intervals: x1=1:1:100; x2=0.1:0.1:10; x3=1:10:1000; x4=1:1:100; is there any Matlab's Optimization tool to solve this problem? if yes, please discribe me how I should process? Thanks Maty

Best Answer

The standard MATLAB optimizers are continuous optimizers, not discrete variable optimizers.
So write,
x1r = 1:1:100; x2r = 0.1:0.1:10; x3r = 1:10:1000; x4r = 1:1:100;
[x1,x2,x3,x4] = ndgrid(x1r, x2r, x3r, xr4);
f = 1054.4372 - 351.0852 .* x2 - 72.9064 .* x3 + 1416.2477 .* x1 .^2 - 349.3091 .* x1 .* x2 + 81.2973 .* x1 .* x4 + 815.8691 .* x2 .^2 - 1076.9907 . *x1 .^3 + 952.576 .* x1 .^2 .* x2 + 578.7052 .* x1 .* x2 .^2 - 113.2848 .* x1 .* x3 .^2 - 57.5303 .* x1 .* x3 .* x4 - 121.6719 .* x1 .* x4 .^2 - 1131.8391 .* x2 .^3 + 107.4973 .* x2 .^2 .* x4 + 64.6476 .* x2 .* x3 .* x4 + 91.0026 .* x3 .* x4 .^2 - 134.1675 .* x4 .^3;
(minfval, minidx) = min(f(:));
minimal = [minfval, x1(minidx), x2(minidx), ...
x3(minidx), x4(minidx)];