Hello Forum,

I am attempting to apply conditional/logical operators in my constraints and am receiving errors. I exemplify two separate applications where I am having issues doing so.

First, I am trying to model a heat exchanger type system. One of my variables being solved is maxCoolingDelivered which represents how much cooling should be deployed by the heat exchanger. It is defined as an integer, and I had enforced that this should be between 0 and 100 inclusive as below:

**subject to maxCoolingDeliveredBounded1{t in TIME, z in ZONE}: 0 <= maxCoolingDelivered[t,z];**

**subject to maxCoolingDeliveredBounded2{t in TIME, z in ZONE}: 100 >= maxCoolingDelivered[t,z];**

I experienced no errors and solutions were provided.

Now I would like AMPL to consider maxCoolingDelivered to take a value as an integer between 0 and 90 inclusive or 100 (so it cannot take 91 through 99 inclusive). I attempted to use

**subject to maxCoolingDeliveredBounded1{t in TIME, z in ZONE}: (0 <= maxCoolingDelivered[t,z] <=90) or (maxCoolingDelivered[t,z] = 100);**

However, the error I see is below.

Gurobi 9.5.2: nonconvex=2

timelim=450

mipgap=0.005

Gurobi 9.5.2: logical constraint _slogcon[1] is not an indicator constraint

due to bad comparison with _svar[8608].

Second, in a separate model, I’d like to model a fan to run if there are any requests to do so. FanStartStopCommandDesired is a binary variable indexed over time and zone, and HVACFanStartStopCommand is a binary variable indexed over time and HVAC. I tried

**subject to FanStartStopRequestedSentToHVAC { t in TIME, z in ZONE, h in HVAC: if FanCommandRequested[t,1]=1 or FanCommandRequested[t,2]=1 or FanCommandRequested[t,3]=1}: HVACRunCommand[t,1] = 1;**

which gave me an error of

syntax error

context: subject to FanStartStopRequestedSentToHVAC { t in TIME, z in ZONE, h in HVAC: if FanCommandRequested[t,1]=1 or FanCommandRequested[t,2]=1 or >>> FanCommandRequested[t,3]=1} <<< : HVACRunCommand[t,1] = 1;

And then I tried

**subject to FanStartStopRequestedSentToHVAC { t in TIME, z in ZONE, h in HVAC}: HVACRunCommand[t,1] = FanCommandRequested[t,1] or FanCommandRequested[t,2] or FanCommandRequested[t,3];**

Where I was told simply that the problem is infeasible. This leads me to believe that perhaps I applied the logical operator or’s correctly.

Can you advise if I am applying the use of conditional/logical expressions correctly in these constraints?

Thank you very much for your input.