How to set the constraints of L0- norm in linear programming?
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
wei zhang
am 19 Aug. 2020
Kommentiert: wei zhang
am 20 Aug. 2020
(sorry, I miss the objective function before. I have edited it well)
I am trying to set the L0-norm constraints, which give a constrain on the element of the variables.
e.g. I have 3 variables, x1 x2 x3. and I have some "normal" constraints, like below.
x1>0;
x1<0.3;
x2>0;
x1<0.4;
x3>0;
x1<0.5;
The object function to get the mininum is
fx = - (x1+x2+x3);
But I have a L0- norm like constrains. That is the maxinum amount of the chosen variable from x1,x2,x3 is 2.
|x1|0 + |x2|0+|x3|0 <=2 (sorry I don't know how to input the corner mark).
So the answer should be [0,0.3,0.4] ,that is, x2 and x3 chosen. How to make this constrains in Matlab? Could I use Mixed-integer linear programming (MILP) to achieve it? Could anyone give me some suggestions on it? That will be very appreciated.
0 Kommentare
Akzeptierte Antwort
Bruno Luong
am 20 Aug. 2020
Bearbeitet: Bruno Luong
am 20 Aug. 2020
Brute-force method
% Original LP problem
f = -ones(1,3);
A=[-eye(3);
eye(3)];
b = [0 0 0 0.3 0.4 0.5]';
fvalmin = Inf;
for i=1:3
% Add constraint x(i)==0, meaning l0-norm is <= 2
Aeq = zeros(1,3);
Aeq(i) = 1;
beq = 0;
[xi,fvali] = linprog(f,A,b,Aeq,beq);
% Select the solution that returns minimal cost
if fvali < fvalmin
x = xi;
fvalmin = fvali;
end
end
x
1 Kommentar
Weitere Antworten (2)
Bruno Luong
am 19 Aug. 2020
Well the brute force method is to solve 3 LP problems assuming
- x1 = 0
- x2 = 0
- x3 = 0
and see which returns a solution.
1 Kommentar
wei zhang
am 20 Aug. 2020
4 Kommentare
Bruno Luong
am 20 Aug. 2020
Agree, but I put "<=" instead of "<". In all optimization it requires close inequalities, never open inequalities.
Siehe auch
Kategorien
Mehr zu Linear Programming and Mixed-Integer Linear Programming finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!