please, I want someone to help me with MATLAB code for solving the non linear constrained equation as given below

1 visualización (últimos 30 días)
Objective function Max f= 5/3 x_1^(3/44) x_2^(4/7) x_3^(3/40) x_4^(2/9) x_5^(1/6)
Constraints
17x_1+20x_2+10x_3+0.4x_4+1.5x_5≤240
x_4 ≤ 30
x_5≤ 100

Respuesta aceptada

William Rose
William Rose el 9 de Ag. de 2022
Editada: William Rose el 9 de Ag. de 2022
[edit: added lines to display -f(x) and constraint 1 at the solution point.]
Please carefully read the help for fmincon(). The name is short for "function minimization with constraints". Minimize the negative of your function. fmincon() can do exactly what you want, including the constraints. The examples in the help doc will be useful.
%vector x is what you want to find
fun = @(x)-5/3*x(1)^(3/44)*x(2)^(4/7)*x(3)^(3/40)*x(4)^(2/9)*x(5)^(1/6);
x0=[1,1,1,1,1]; %initial guess for the solution
%express first constraint in the form A*x<=b:
A=[17,20,10,0.4,1.5]; b=240;
%express constraints 2 and 3 by defining vectors lb and ub:
lb=[-Inf,-Inf,-Inf,-Inf,-Inf]; %no lower blound constraints
ub=[Inf,Inf,Inf,30,100]; %upper bounds on x(4),x(5)
x=fmincon(fun,x0,A,b,[],[],lb,ub);
Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance.
disp(x) %value of x at the solution
1.0376 7.3919 1.9404 30.0000 28.7462
disp(-fun(x)); %value of the function you wanted to maximize
20.5263
disp(A*x') %check constraint 1
240.0000
Note that constraint 1 is met exactly, constraint 2 is met exactly, and constraint 3 is not approached. Good luck.
  4 comentarios
Ezra Dzarma
Ezra Dzarma el 9 de Ag. de 2022
Please, the question posted is a research question, I have been looking for a solution for a long time, I think there is nothing wrong in the response of prof Rose. Please, sorry in case you are offended Thank

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by