# CPLEX error message: CPLEX 20.1.0.0: logical constraint \_slogcon\[1\] is not an indicator constraint

**URL:** <https://discuss.ampl.com/t/cplex-error-message-cplex-20-1-0-0-logical-constraint-slogcon-1-is-not-an-indicator-constraint/652>\
**Category:** Support\
**Tags:** solvers, errors-and-messages\
**Created:** [July 20, 2023, 2:47pm UTC](https://discuss.ampl.com/t/cplex-error-message-cplex-20-1-0-0-logical-constraint-slogcon-1-is-not-an-indicator-constraint/652 "2023-07-20T14:47:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Csercsik](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/david_csercsik/32/347_2.png) [@David\_Csercsik](https://discuss.ampl.com/u/David_Csercsik)\
**Post date:** [July 20, 2023, 2:47pm UTC](https://discuss.ampl.com/t/cplex-error-message-cplex-20-1-0-0-logical-constraint-slogcon-1-is-not-an-indicator-constraint/652/1 "2023-07-20T14:47:46Z")

</div>

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](https://discuss.ampl.com/uploads/short-url/hqxES0NP3gbnnPO2V9AFJlfRucB.dat) (753 Bytes)  
Uploading: aggrEU\_1.mod…

Thank You

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [July 20, 2023, 2:53pm UTC](https://discuss.ampl.com/t/cplex-error-message-cplex-20-1-0-0-logical-constraint-slogcon-1-is-not-an-indicator-constraint/652/2 "2023-07-20T14:53:46Z")

</div>

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:

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

```

---

<div class="post-metadata">

**Author:** ![David\_Csercsik](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/david_csercsik/32/347_2.png) [@David\_Csercsik](https://discuss.ampl.com/u/David_Csercsik)\
**Post date:** [July 20, 2023, 3:04pm UTC](https://discuss.ampl.com/t/cplex-error-message-cplex-20-1-0-0-logical-constraint-slogcon-1-is-not-an-indicator-constraint/652/3 "2023-07-20T15:04:30Z")

</div>

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..

---

<div class="post-metadata">

**Author:** ![fdabrandao](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/fdabrandao/32/63_2.png) [@fdabrandao](https://discuss.ampl.com/u/fdabrandao)\
**Post date:** [July 20, 2023, 3:10pm UTC](https://discuss.ampl.com/t/cplex-error-message-cplex-20-1-0-0-logical-constraint-slogcon-1-is-not-an-indicator-constraint/652/4 "2023-07-20T15:10:15Z")

</div>

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:

```auto
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:

```auto
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);

```

---

<div class="post-metadata">

**Author:** ![David\_Csercsik](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/david_csercsik/32/347_2.png) [@David\_Csercsik](https://discuss.ampl.com/u/David_Csercsik)\
**Post date:** [July 20, 2023, 3:14pm UTC](https://discuss.ampl.com/t/cplex-error-message-cplex-20-1-0-0-logical-constraint-slogcon-1-is-not-an-indicator-constraint/652/5 "2023-07-20T15:14:14Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Gleb\_Belov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.ampl.com/gleb_belov/32/51_2.png) [@Gleb\_Belov](https://discuss.ampl.com/u/Gleb_Belov)\
**Post date:** [July 21, 2023, 11:48am UTC](https://discuss.ampl.com/t/cplex-error-message-cplex-20-1-0-0-logical-constraint-slogcon-1-is-not-an-indicator-constraint/652/6 "2023-07-21T11:48:21Z")

</div>

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.
