Optimization with boundaries constraints

Hello,
I am trying to solve the x that will minimize the following equation:
eq = @(x) norm(r_column-(G*x+d))^2;
Where G is 933x933, d is 933x1 and x should be 933x1, r_column is 933x1
I have the following constraints: xmin = ones(933,1)*(-30); xmax = ones(933,1)*(30);
However, if I try to solve it like this: x = fminbnd(eq,xmin,xmax);
I get an error.
I hope someone can help me, thanks in advance!
Loïc

Answers (1)

Torsten
Torsten on 15 Dec 2016
Try "lsqlin".
Best wishes
Torsten.

5 Comments

I used : x = lsqlin(-G,d-r_column,ones(2,933),[30;-30]); However the matrix x still has some values outside [-30 30]. Did I do something wrong?
Thanks for responding!
I am not sure that you set your bounds correctly as 933-long vectors of -30 and 30. Can you show us your real lsqlin call, based on a copy-paste from your code?
Alan Weiss
MATLAB mathematical toolbox documentation
That was a copy of my code, but I changed it to this now:
z = [eye(933) ; eye(933)]; b = [ ones(933,1)*30 ; ones(933,1)*(-30)]; x = lsqlin(-G,d-r_column,z,b);
This just gives me an x with all -30, but that problem may be due to my model.
z = [eye(933) ; -eye(933)];
b = [ ones(933,1)*30 ; ones(933,1)*30];
x = lsqlin(-G,d-r_column,z,b);
Best wishes
Torsten.
It is advisable to use the 7th/8th argument to express simple bounds, rather than to use inequality constraint matrices.
e=ones(933,1)*30;
x = lsqlin(-G,d-r_column,[],[],[],[],-e,+e);

Sign in to comment.

Asked:

on 15 Dec 2016

Edited:

on 15 Dec 2016

Community Treasure Hunt

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

Start Hunting!