help-glpk
[Top][All Lists]

## Re: [Help-glpk] Modelling constaints

 From: john tass Subject: Re: [Help-glpk] Modelling constaints Date: Sat, 28 Mar 2015 00:56:16 +0200

Very good idea! Thank you very much.
I would like to add though, that because I want to get D = 0 in case A = 0 or ((U <= 0 AND K <= 0), I have to add the two constraints : D <= A , D <= E.
Am I correct?
Thanks again

2015-03-28 0:24 GMT+02:00 Norman Jessup :
Hello Ioannis.

If I understand your problem correctly, you can achieve the result you need using the "Big M" method, though I think you may need to introduce some new integer variables

```Let E in {0, 1} binary
M*E >= U
M*E> = K
```
Where M is some "large" positive constant, though in this particular case it just needs to be greater than 6.  This will force E to be positive if either U or K is positive.

D >= A + E - 1

This will require D to be positive if both A and E are positive.  Note that for this to work the objective must prefer to drive D to zero if possible, which typically turns out to be the case.  If not then you will need to add complementary constraints to drive D to zero if the conditions are not met.

On 28/03/2015 3:00 am, address@hidden wrote:
```Good evening to every one,
I have a problem in modelling the following situation:
Let U, K in {-6, .. , 6} integers
Let A in {0, 1} binary
Let D in {0, 1} binary
What I want to do  is to model the condition:
D = 1, iff (U > 0 OR K > 0) AND A = 1
Otherwise, D should equal 0.
I can not figure out how to model this situation.
Can any one give me an answear or even a hint? It would be very welcome.
Thanks a lot```
```--
Norman Jessup

```

_______________________________________________
Help-glpk mailing list