How to solve the nonlinear optimization problem.
조회 수: 1 (최근 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!