Hi, I am trying to solve a unit commitment problem in MATLAB using intlinprog. I have set up a optimization variable to keep track of the state of the units and was able to solve the Unit Commitment problem by itself. However, I now have to modifiy the code with my own algorithm for the operation of battery storage, the operation of which is dependent on the change in the number of units committed from hour to hour. So I decided to compare the optimization variable which keeps track of the state of the units and ran into the following error: Conversion to logical from optim.problemdef.OptimizationConstraint is not possible. Any advice on how I can go around this problem. And the optimization variable which keeps track of the state of the units is necessary as it part of the optimization problem.