I am facing difficulty to write linear inequality constraint given below. Here Φ, 48 element long vector, is decision variable where as P and μ are vectors of 48 elements each and λ is a constant. I shall appreciate any help.
λ * P μ * Φ

 採用された回答

Walter Roberson
Walter Roberson 2017 年 6 月 21 日

0 投票

lambda .* P <= mu * phi so
lambda .* P / mu <= phi
With lambda, P, and mu all being constants, this does not need to be written as a linear constraint. Instead, it can be written as lower bound: phi >= lambda .* P / mu so
x0 = .... %starting point
A = []; b = [];
Aeq = []; beq = [];
LB = lamda .* P ./ mu; UB = inf(1,48);
fmincon( fun, x0, A, b, Aeq, beq, LB, UB )
If you prefer to implement it as a linear constraint (perhaps because you are using a different minimizer) then
A = -eye(48); B = lambda .* P ./ mu;

6 件のコメント

KSSV
KSSV 2017 年 6 月 21 日
Ohh...was my answer is not related to the contest of question?
Walter Roberson
Walter Roberson 2017 年 6 月 21 日
No, there was an fmincon tag, so this is about creating appropriate A, b matrices for the various MATLAB optimizers.
Saifullah Khalid
Saifullah Khalid 2017 年 6 月 21 日
sir, thanks for response, I am actually trying to optimize using fmincon. But, I have other constraints also where LB = 0 and UB = 1; so if take LB = lamda .* P ./ mu; it goes beyond UB in many cases. Your second option would be good for me. Secondly, shouldn't B would also be negative like A? I am sorry about being stuck in basics.
A = -eye(48); B = - lambda .* P ./ mu;
Walter Roberson
Walter Roberson 2017 年 6 月 21 日
Good point, it should be negative.
You can use
LB = max(0, lamda .* P ./ mu);
UB = ones(1,48);
if any(LB > UB); error('Non-feasible lower bound'); end
Saifullah Khalid
Saifullah Khalid 2017 年 6 月 21 日
I am grateful for prompt support, it solved my problem. I have used the the last suggested approach of UB and LB given above.
Saifullah Khalid
Saifullah Khalid 2017 年 6 月 21 日
Once more a little query, after running optimization, the value of phi (optimized) is set to all 1s, meaning 100% resource utilization which is not practically true. For example, if we have a cloud with 48 servers and 30 processing tasks to be executed, they would be assigned to any of the 30 servers whose phi may be between 0 to 1 but for rest of the servers, phi should not be 1. If you can kindly comments on this? Is my understanding correct?

サインインしてコメントする。

その他の回答 (1 件)

KSSV
KSSV 2017 年 6 月 21 日
編集済み: KSSV 2017 年 6 月 21 日

0 投票

% take some random data for test
lambda = rand ;
P = rand(48,1) ;
mu = rand(48,1) ;
phi = rand(48,1) ;
% inequality
idx = lambda*P<=mu.*phi ;
%%check result
R = [lambda*P(idx) mu(idx).*phi(idx)]

1 件のコメント

Saifullah Khalid
Saifullah Khalid 2017 年 6 月 21 日
sir, thanks for response, I am actually trying to optimize using fmincon, the guide says constraints should be Ax-b < 0. I am not sure I can use this as it is?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeNonlinear Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by