code: package org.optsol.project_scheduling.mrcpsp.ooe.constraints;
  
  import com.google.ortools.linearsolver.MPConstraint;
  import com.google.ortools.linearsolver.MPSolver;
  import com.google.ortools.linearsolver.MPVariable;
  import java.util.Collection;
  import java.util.HashSet;
  import java.util.Set;
  import org.optsol.jdecor.core.AbstractConstraintManager;
  import org.optsol.jdecor.core.AbstractVariableManager;
  import org.optsol.jdecor.ortools.AbstractOrtoolsConstraintManager;
  import org.optsol.project_scheduling.mrcpsp.constants.shared.events.IConstants_E;
  import org.optsol.project_scheduling.mrcpsp.constants.sub.IConstants_A;
  import org.optsol.project_scheduling.mrcpsp.constants.sub.IConstants_M_i;
  import org.optsol.project_scheduling.mrcpsp.constants.sub.IConstants_N;
  import org.optsol.project_scheduling.mrcpsp.constants.sub.IConstants_w_imk;
  import org.optsol.project_scheduling.mrcpsp.ooe.variables.DecisionVars_Ooe;
  
  public class OOE_j_NonrenewableCapacityConsumption<CONST
      extends IConstants_E & IConstants_A & IConstants_N & IConstants_M_i & IConstants_w_imk>
      extends AbstractOrtoolsConstraintManager<CONST> {
  
    public OOE_j_NonrenewableCapacityConsumption() {
      super("i", "e", "k");
    }
  
    @Override
    protected Collection<ConstraintKey> createKeys(CONST constants) {
      Set<ConstraintKey> indexes = new HashSet<>();
      for (int i : constants.get_A()) {
        for (int e : constants.get_E()) {
          if (e != constants.get_card_A()) {
            for (int k : constants.get_N()) {
              indexes.add(new ConstraintKey(i, e, k));
            }
          }
        }
      }
      return indexes;
    }
  
    @Override
    protected void configureConstraint(
        MPConstraint constraint,
        CONST constants,
        AbstractVariableManager<MPSolver, MPVariable> variables,
        AbstractConstraintManager<MPSolver, CONST, MPVariable, MPConstraint>.ConstraintKey constraintKey)
        throws Exception {
  
      int i = constraintKey.get("i");
      int e = constraintKey.get("e");
      int k = constraintKey.get("k");
  
      constraint.setUb(0.0);
  
      constraint.setCoefficient(variables.getVar(DecisionVars_Ooe.r, i, k), -1.0);
  
      for (int m : constants.get_M_i(i)) {
        constraint.setCoefficient(
            variables.getVar(DecisionVars_Ooe.z, i, m, e),
            constants.get_w_imk(i, m, k));
      }
    }
  }
  