code: private void addSwitchConstraints(ReconfigurationProblem rp) {
          
          // Switches capacity limitation
          List<Task> tasksList = new ArrayList<>();
          List<IntVar> heightsList = new ArrayList<>();
          
          for(Switch sw : net.getSwitches()) {
  
  
              // Only if the capacity is limited
              if (sw.getCapacity() != Integer.MAX_VALUE) {
  
                  for (VM vm : rp.getVMs()) {
                      VMTransition a = rp.getVMAction(vm);
  
                      if (a != null && a instanceof RelocatableVM) {
  
                          if (a.getDSlice().getHoster().isInstantiated()) {
  
                              if (a.getCSlice().getHoster().getValue() != a.getDSlice().getHoster().getValue()) {
  
                                  Node src = source.getMapping().getVMLocation(vm);
                                  Node dst = rp.getNode(a.getDSlice().getHoster().getValue());
  
                                  if (!Collections.disjoint(net.getConnectedLinks(sw), net.getRouting().getPath(src, dst))) {
                                      tasksList.add(new Task(a.getStart(), a.getDuration(), a.getEnd()));
                                      heightsList.add(((RelocatableVM) a).getBandwidth());
                                  }
                              }
                          }
                      }
                  }
  
                  if (!tasksList.isEmpty()) {
                      // Post the cumulative constraint for the current switch
                      csp.post(csp.cumulative(
                              tasksList.toArray(new Task[tasksList.size()]),
                              heightsList.toArray(new IntVar[heightsList.size()]),
                              csp.intVar(sw.getCapacity()),
                              true
                      ));
  
                      tasksList.clear();
                      heightsList.clear();
                  }
              }
          }
      }
docs: Add the cumulative constraints for each blocking switch (having limited capacity)
  
  @param rp the reconfiguration problem