Message Boards Message Boards

0
|
7847 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Define a variable using constraints?

Posted 4 years ago

I have an optimization problem where I in the objective function want to add a * param1 that if an event a is fulfilled so that a = 1 then we have 1 * param1. a is defined as binary.

The condition is that the sum of 4 units of a variable b are active simoultaneously at time t. However, I seem to formulate the constraint in a way that causes it to say that either all 4 units of b are active or none of them are, but what I want to formulate is a constraint that forces a to take the value 1 if 4 units of b are active, not that there are 4 or 0 units.

Could someone help me formulate such a constraint, or another solution that can help me achieve this?

I tried: 4 * a[u,t] = (sum for all u) b[u,t], which means that I also cause variable b to be 0 or 4,

and the same but with the <= instead, but in this case even it the sum of b at time t is 4, variable a does not necessarilly take on the value of 1, but that is what I want it to do.

Any help is appreciated :)

POSTED BY: Jan Banan
2 Replies

Suppose your four units are {a1,a2,a3,a4} and they are 0-1 variables. Call the parameter k; it is also a 0-1 variable. Then an appropriate set of constraints might be

{0<=k<=1,4*k>=a1+a2+a3+a4,k<=a1,k<=a2,k<=a3,k<=a4}
POSTED BY: Daniel Lichtblau

What exactly do you want to do? It would be helpful if you gave some examples of input, output.

POSTED BY: Hans Dolhaine
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract