What is the binary variables relaxation equvalent in cvx?


(morteza) #1

hello.i have a constraint as follow:
2x<=p<=10x;
where the x and p are binary and continiuos variables,respectively.
i want to find binary variable relaxe eguvalent and replace it,please help me.
tanks alot.


(Mark L. Stone) #2

The constraints as written are linear constraints which comply with CVX’s rules and will be accepted by CVX.

I have no idea what you’re trying to do. You need to provide more information and context if you want help. As stated, with no further context, your constraints mean that either p == 0 (within tolerance) or 2 <= p <= 10, depending on whether x = 0 or 1.

I don’t see how you would model such a semi-continuous constraint on p in CVX without use of binary variable. However, you could formulate and solve two separate problems in CVX which each only use continuous variables. The first problem would fix p at 0. The second problem would have the constraint 2 <= p <= 10 .The optimum solution to your original problem would be the better (i.e., having lower optimal objective value if minimization) of the solutions of the two separate problems.


(morteza) #3

hello, the main problem that you point it,as follow:
minimize((a0p1(t).^2+a1p1(t)+a2I1(t))+(b0p2(t)+b1I1(t))+1.2abs(I1(t)-I1(t-1))+0.5abs(I2(t)-I2(t-1)))
subject to
2
I1(t)<=p1(t)<=40I1(t);
6
I2(t)<=p2(t)<=35*I2(t);
where p1(t),p2(t) are continious variables and I1(t),I2(t) are binary variables. t is the time.
please help me. thank you.


(Mark L. Stone) #4

This is not a well-formulated problem unless t takes on only one specific value. Otherwise, the objective function is not well-defined. How many values can t take? If the objective function is supposed to be summed over all but the first possible value of t, or some such, then you need to make that clear.

I presume the constraints are supposed to apply for each of a finite number of possible values of t.


(morteza) #5

hello.t is the time that its values are from 1,…to,24.(1day). and p is power generated of plan.


(Mark L. Stone) #6

In light of your answer and per my previous post, your objective function doesn’t make any sense.

Anyhow, if there are 24 sets of 2 double-sided inequality constraints, avoiding binary variables by “brute force” solving separate optimization problems for each combination of binary variable values won’t be viable. So I don’t see how you are going to avoid binary variables. So you’ll need the version of CVX and solver which can accept binary variables.

You could relax binary variables to
0 <= l1 <= 1
0 <= l2 <= 1
But that won’t be equivalent to the original problem. It will provide a lower bound on the optimal objective of the original problem, though. If it turns out that the optimal l1 and l2 of the relaxed problem are 0 or 1 in all components, then the solution to the relaxed problem is feasible and optimal for the original problem.