4

Given an optimization problem with two optimization variables (x_in(t), x_out(t)). For any time-step, when x_in is non-zero, x_out must be zero (and vice versa). Written as a constraint:

x_in(t)*x_out(t)=0

How can such a constraint be included in Matlab's linprog function?

1
  • 3
    linprog stands for LINEAR programing. This constraint is NOT linear (it's quadratic)... Commented Apr 3, 2013 at 8:22

1 Answer 1

5

Since the problem is not entirely linear, I do not believe you can solve it as-is using the linprog function. However, you should be able to reformulate the problem as a mixed integer linear programming problem. Then you would be able to use for example this extension from Matlab Central to solve the problem.

Assuming that x_in(t) and x_out(t) are non-negative variables with upper bounds x_in_max and x_out_max, respectively, then you can add the variables y_in(t) and y_out(t) to your optimization problem and include the following constraints:

(1) y_in(t) and y_out(t) are binary, i.e. 0 or 1
(2) x_in(t)  <= x_in_max  * y_in(t)
(3) x_out(t) <= x_out_max * y_out(t)
(4) y_in(t) + y_out(t) = 1

Given that y_in and y_out are binary variables, constraints (2) and (3) relate the x_ and y_ variables with each other and ensure that the x_ variables remain within bounds (fix bounds on the x_ variables can thus and should be removed from the problem formulation). Constraint (4) ensures that either the _in or the _out event occurs, but not both at the same time.

Sign up to request clarification or add additional context in comments.

2 Comments

I believe (4) should be y_in(t) + y_out(t) <= 1, to be equivalent to the OP formulation (both y_in(t) and y_out(t) can be equal to 0 at the same time)
Thanks, @NicolasGrebille. This is not the way I interpret the problem formulation above, but if it is indeed a possibility that x_in(t) and x_out(t) are zero at the same time, just change constraint (4) to the inequality formulation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.