Optimization Problem to solve the following question

1 次查看(过去 30 天)
Optimization Problem is :
Here, are constants.I want to use fmincon to solve this problem but I cannot handle a and x together. For a fixed value of a it is working... I have taken a as a constant but I want for variable a.
function [c,ceq] = nlcon(x,k2)
a = 0.5065;
c = c2 - a*log2(1+k2*x);
ceq = [];
function y= main(k1,k2,c1,c2)
objective = @(x) x;
% initial guess
x0 = 0;
% variable bounds
lb = 0;
ub = 10;
% show initial objective
%disp(['Initial Objective: ' num2str(objective(x0))])
% linear constraints
%A(1) = [];
A = -k1;
b=-c1;
Aeq = [];
beq = [];
% nonlinear constraints
nonlincon = @(x)nlcon(x,k2);
% optimize with fmincon
%[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN]
% = fmincon(FUN,X0,A,B,Aeq,Beq,LB,UB,NONLCON,OPTIONS)
y = fmincon(objective,x0,A,b,Aeq,beq,lb,ub,nonlincon);
%disp(['Final Objective: ' num2str(objective(tau))]);

回答(1 个)

John D'Errico
John D'Errico 2020-2-27
编辑:John D'Errico 2020-2-27
I'll assume the unknown constants are all positive. If not, then the same logic works, but will need to be repaired, based on the information we don't have.
If we know that k1*x >= c1, then x >= c1/k1. Remember that we want to minimize x. So x is no smaller than c1/k1. Of course, if k1 is negative, then this first constraint is an UPPER bound only on x.
Next, a is known to be positive, and in the interval [0,1]. Then from the second constraint, we have
1 + k2*x >= 2^(c2/a)
If a were exactly zero, then we cannot divide by a. But then the second constraint provides no information at all about x. So we can trivially assume then that a lives in the interval (0,1].
This leaves us with the conclusion that
k2*x >= 2^(c2/a) - 1
Is k2 also positive? Or negative? Regardess, this gives us a simple bound on x, either from above or below, depending on the sign of k2.
So just pick the smallest value of x that applies, dependent only on the signs of k1 and k2.
The point is, YOU DON'T NEED TO USE FMINCON HERE! YOU DON'T NEED TO USE ANY OPTIMIZER AT ALL! Using any optimizer to solve this problem is equivalent to using a Mack truck to carry a pea to Boston. Some simple algebra is entirely sufficient.

类别

Help CenterFile Exchange 中查找有关 Nonlinear Optimization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by