Dear Support,

I dont know why is this interpreted as a logical constraint (it seems, this is the case):

subject to CONVEXITY {i in conv_bid_sets} :

(sum {j in start_index[i]…end_index[i] }

(X[j])<1+eps);

In the .mod file I have

param: start_index end_index :=

1 1 2

2 3 4

3 6 7

4 8 9

5 10 11

6 12 13

aggrEU_1.dat (753 Bytes)

Uploading: aggrEU_1.mod…

Thank You

1 Like

Hi @David_Csercsik,

Since the entire constraint is between parenthesis there is no left/right hand side of the constraint and in that case it is considered to be logical. The following should work:

```
subject to CONVEXITY {i in conv_bid_sets}:
sum {j in start_index[i]..end_index[i]} X[j] < (1+eps);
```

Hi, @fdabrandao

I see, and thank You,…

So if I understand right, equality constraints are logical, right?

I have:

# balance

subject to BALANCE {t in 1…T, dp_index in 1…num_DP} :

(sum {i in order_numbers: DP[i] == dp_index && period[i] = t}

(X[i]*quantity[i])=0);

I was probably mislead by this…

Hi @David_Csercsik,

Equality constraints are regular constraints as they have left and right hand sides, that constraint there is logical because of the parenthesis too:

If you want a constraint that ensure that the total sum is 0, you can do that as follows:

```
subject to BALANCE {t in 1…T, dp_index in 1…num_DP} :
sum {i in order_numbers: DP[i] == dp_index && period[i] = t} X[i]*quantity[i] = 0;
```

`sum {i in order_numbers: DP[i] == dp_index && period[i] = t} X[i]*quantity[i] `

is the left hand side, and `0`

is the right hand side.

As an example of logical constraints you can see for instance the following N-Queens example where the three constraints are logical:

```
param n integer > 0; # N-queens
var Row {1..n} integer >= 1 <= n;
s.t. row_attacks: alldiff ({j in 1..n} Row[j]);
s.t. diag_attacks: alldiff ({j in 1..n} Row[j]+j);
s.t. rdiag_attacks: alldiff ({j in 1..n} Row[j]-j);
```

Ok I see, and thank You again. The strange thing is that it kinda worked with the parentheses as well as intended… (at least it seemed so).

Strict comparisons are interpreted as logical constraints because they cannot be satisfied algebraically exactly (you always need some eps.) Suggest formulating as <= 1-eps, then it’s algebraic.