How to solve the nonlinear optimization problem.
2 次查看(过去 30 天)
显示 更早的评论
Hello friends,
How can I solve the attached nonlinear optimization problem.
0 个评论
采纳的回答
Alan Weiss
2020-6-7
This looks like a job for fmincon. Variables x (3-D) and t = x(4).
Objective function t = x(4).
Lower bound lb = [0,0,0,-Inf].
Linear constraint Aeq = [1 1 1 0], beq = 1.
Nonlinear constraint function as you have, with c(x) = a three-element vector F(x) - x(4). ceq = [].
I would take the initial point something like x0 = [1 1 1 30]/3.
Is that clear enough?
Alan Weiss
MATLAB mathematical toolbox documentation
3 个评论
Alan Weiss
2020-6-8
I'm sorry, but I do not understand your code. Maybe you did it right, but what you wrote doesn't make sense to me. It should look like this:
lb = [0,0,0,-Inf];
Aeq = [1 1 1 0];
beq = 1;
x0 = [1 1 1 30]/3;
fun = @ObjectiveFunction;
Nonlcon = @NLcon;
A = [];
b = [];
ub = [];
[X, FVAL] = fmincon(fun, x0, A, b, Aeq, beq, lb, ub, Nonlcon)
function f = ObjectiveFunction(x)
f = x(4);
end
function [C, Ceq] = NLcon(x)
C(1)= (0.3*((1-((0.5422)^x(1))*((0.4142)^x(2))*((0.6818)^x(3)))/(1+((0.5422)^x(1))*((0.4142)^x(2))*((0.6818)^x(3))))+0.7*((1-((0.1892)^x(1))*((0.0905)^x(2))*((0.5422)^x(3)))/(1+((0.1892)^x(1))*((0.0905)^x(2))*((0.5422)^x(3)))))-x(4);
C(2)= (0.3*((1-((0.1892)^x(1))*((0.5422)^x(2))*((0.2968)^x(3)))/(1+((0.1892)^x(1))*((0.5422)^x(2))*((0.2968)^x(3))))+0.7*((1-((0.0905)^x(1))*((0.4142)^x(2))*((0.0905)^x(3)))/(1+((0.0905)^x(1))*((0.4142)^x(2))*((0.0905)^x(3)))))-x(4);
C(3)= (0.3*((1-((0.4142)^x(1))*((0.8340)^x(2))*((0.5422)^x(3)))/(1+((0.4142)^x(1))*((0.8340)^x(2))*((0.5422)^x(3))))+0.7*((1-((0.0905)^x(1))*((0.0905)^x(2))*((0.1892)^x(3)))/(1+((0.0905)^x(1))*((0.0905)^x(2))*((0.1892)^x(3)))))-x(4);
Ceq= [];
end
That ran for me without error.
Alan Weiss
MATLAB mathematical toolbox documentation
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!