Rev | Line | |
---|
[37] | 1 | function [F,changed] = convertlogics(F) |
---|
| 2 | %CONVERTLOGICS Internal function to convert logic constraints to mixed integer constraints |
---|
| 3 | |
---|
| 4 | % Author Johan Löfberg |
---|
| 5 | % $Id: convertlogics.m,v 1.9 2006/09/20 12:43:45 joloef Exp $ |
---|
| 6 | |
---|
| 7 | changed = 0; |
---|
| 8 | if length(F)>0 |
---|
| 9 | extvariables = yalmip('logicextvariables'); |
---|
| 10 | if ~isempty(extvariables) |
---|
| 11 | for i = 1:length(F) |
---|
| 12 | if is(F(i),'elementwise') |
---|
| 13 | Fi = sdpvar(F(i)); |
---|
| 14 | Fv =getvariables(Fi); |
---|
| 15 | if length(Fv)==1 |
---|
| 16 | xb = getbase(Fi); |
---|
| 17 | if isequal(xb,[0 1]) |
---|
| 18 | if ismember(Fv,extvariables) |
---|
| 19 | F(i) = set(Fi >= 1); |
---|
| 20 | end |
---|
| 21 | end |
---|
| 22 | end |
---|
| 23 | end |
---|
| 24 | end |
---|
| 25 | end |
---|
| 26 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.