Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combining nonconvex MILP operator and uncertainty #606

Open
johanlofberg opened this issue Mar 23, 2019 · 0 comments
Open

Combining nonconvex MILP operator and uncertainty #606

johanlofberg opened this issue Mar 23, 2019 · 0 comments

Comments

@johanlofberg
Copy link
Member

% Nominal case without any uncertainty
x = sdpvar(2,1);
Model = [-3 <= x <= 3, norm(x - [0.1;0.2],1) >= 1];
optimize(Model, x'*x)
clf
plot(Model);hold on;plot(value(x(1)),value(x(2)),'*')

% Add uncertainty, fails due to infeasibility
x = sdpvar(2,1);
w = sdpvar(2,1);
Model = [-3 <= x <= 3, norm(x + w - [0.1;0.2],1) >= 1];
Model = [Model, -0.5 <= w <= 0.5,uncertain(w)]
optimize(Model, x'*x)
clf
plot(Model);hold on;plot(value(x(1)),value(x(2)),'*')

% Manual derivation of nonconvex constraint 
% and it works as expected
x = sdpvar(2,1);
w = sdpvar(2,1);
d = binvar(4,1);
q = x + w - [0.1;0.2];
M = 10;
Model = [-3 <= x <= 3, q(1) + q(2) >= 1-M*(1-d(1)),
                       q(1) - q(2) >= 1-M*(1-d(2)),
                      -q(1) + q(2) >= 1-M*(1-d(3)),
                      -q(1) - q(2) >= 1-M*(1-d(4)),
                      sum(d)==1]
Model = [Model, -0.5 <= w <= 0.5,uncertain(w)]
optimize(Model, x'*x)
clf
plot(Model,x);hold on;plot(value(x(1)),value(x(2)),'*')

% Semimanual, represent the polytope
A = [1 1;-1 1;1 -1;-1 -1];
b = [1;1;1;1];
x = sdpvar(2,1);
w = sdpvar(2,1);
d = binvar(4,1);
q = A*(x + w - [0.1;0.2]) - 1;
Model = [-3 <= x <= 3, implies(d,q>=0),sum(d)==1];
Model = [Model, -0.5 <= w <= 0.5,uncertain(w)]
optimize(Model, x'*x)
clf
plot(Model,x);hold on;plot(value(x(1)),value(x(2)),'*')


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant