false logical variable

1,185 views
Skip to first unread message

Salamino15

unread,
Dec 28, 2013, 1:02:03 AM12/28/13
to yal...@googlegroups.com
Hi,

I have an error in my code... Please help me find out what's wrong!!

One of the constraints evaluates to a FALSE LOGICAL variable. Your model is infeasible

The constraints are:

constraints = [(transpose(A) * B * (A * bus_phase)) - (bus_power + load_change + gen_change) == 0, ... other constraints]

A is                  20 X 14 double
B is                  20 X 20 double
bus_phase is    14 X 1   double
bus_power is    14 X 1   double
gen_change is  14 X 1   double
load_change is 14 X 1   sdpvar (decision variable)

Thanks!

Johan Löfberg

unread,
Dec 28, 2013, 9:57:08 AM12/28/13
to yal...@googlegroups.com
Your data makes the constraint nonsense, something like

0*x + 1 == 0


Salamino15

unread,
Dec 31, 2013, 1:10:12 AM12/31/13
to yal...@googlegroups.com
Thank you Johan. Solved it :)

I'm getting another error though: Solver not applicable (fmincon-geometric)...When I use CPLEX, it gives the same error too..

Would you please check my constraints and objective function.. it's a maximization... and the functions used in the objective function are elaborated below

%% Constraints %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

constraints = [((transpose(A) * B * (A * bus_phase)) - (bus_power + gen_change + load_change)) == 0,
                    load_power     <= load_power + load_change     <= 0,                  
                    0                    <= gen_power    + gen_change   <= gen_power,     
                   -45                  <=    A * bus_phase                   <= 45,                 
                   -line_capacity   <=    B * A * bus_phase             <= line_capacity]; 

%% Objective function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
obj = 0;
for g = 1:gens
   obj = obj + cost (g,gen(g)) - cost (g,gen(g)+gen_change(g));
end
for  l = 1:10
     obj = obj - ( comp (l,power(l)) - comp (l,(power(l)-change(l)) );
end

options = sdpsettings('verbose',1, 'solver','cplex');
sol = solvesdp(constraint,-obj,options);

>> functions

function curtailment_comp = comp(level, power)
    switch level
    case 3
        curtailment_comp = 20 * (power^(1/2));
    case 4
        curtailment_comp = 4 * (power^(1/2));
    case 5
        curtailment_comp = 4 * (power^(1/4));
    end
end

function gen_cost = cost(level, power)
    switch level
    case 1
        gen_cost = 0.002 * (power * power') + 0.15 * power;
    case 2
        gen_cost = 0.02 * (power * power') + 0.1 * power;
    end
end

Salamino15

unread,
Dec 31, 2013, 1:22:43 AM12/31/13
to yal...@googlegroups.com
Sorry, there was a typo in the last message.. here's the new one :)
----------------------------------------------

Thank you Johan. Solved it :)

I'm getting another error though: Solver not applicable (fmincon-geometric)...When I use CPLEX, it gives the same error too..

Would you please check my constraints and objective function.. it's a maximization... I'm trying to find the optimal load_change
The functions used in the objective function are elaborated below

%% Constraints %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

constraints = [((transpose(A) * B * (A * bus_phase)) - (bus_power + gen_change + load_change)) == 0,
                    load_power     <= load_power + load_change     <= 0,                  
                    0                    <= gen_power    + gen_change   <= gen_power,     
                   -45                  <=    A * bus_phase                   <= 45,                 
                   -line_capacity   <=    B * A * bus_phase             <= line_capacity]; 

%% Objective function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
obj = 0;
for g = 1:gens
   obj = obj + cost (g,gen(g)) - cost (g,gen(g)+gen_change(g));
end
for  l = 1:10
     obj = obj - ( comp (l,power(l)) - comp (l,(power(l)-load_change(l)) );
end

Johan Löfberg

unread,
Dec 31, 2013, 3:17:28 AM12/31/13
to yal...@googlegroups.com
You are creating a nasty nonconvex objective with the fractional powers of terms entering both with positive and negative signs in the objective. What kind of problem did you hope this would be? It is not GP representable, and it is not SOCP representable either (and then you would you use cpower instead)

Salamino15

unread,
Jan 3, 2014, 2:37:53 PM1/3/14
to yal...@googlegroups.com
Well, all the constraints should be linear while the objective function is convex (summation and subtraction of concave and convex functions). I used the cpower operator now and no other errors popped up. But now the problem is infeasible! I know it should be solved :( Any idea what else might be wrong??

Johan Löfberg

unread,
Jan 3, 2014, 2:42:45 PM1/3/14
to yal...@googlegroups.com
Yes, now I see you only subtracted the concave parts.

Well, to see why it is infeasibile, you remove constraints until you understand which ocnstraint generates infeasibility, and draw conclusions from there.

If you know it is feasible, then you should be able to create a solution by hand. Use the command assign to assign that solution, and then check which constraint is infeasible.
Reply all
Reply to author
Forward
0 new messages