@Override
    public long computeCostOfAllocation(BaseInterval<Integer> allocation) {
        long cost = 0;
        
        // next walk thgrought edges and compute for all new added occurrences
        for (ValuedInterval<Integer, IntervalMultimap.MultimapEdge<Occurrence>> valuedInterval :  this.solution.allocationsMultimap().valuesChangesInInterval(allocation)) {
            
            // add length of element times number of occurrences allocated there.
            cost += valuedInterval.getValues().size() * (valuedInterval.getEnd() - valuedInterval.getStart());
        }
        
        // remove amount countet for occurrence own
        if (allocatingOccurrence != null && allocatingOccurrence.getAllocation() != null) {
            cost -= Math.max(
                0,
                
                Math.min(
                    allocatingOccurrence.getAllocation().getEnd(),
                    allocation.getEnd()
                ) -
                Math.max(
                    allocatingOccurrence.getAllocation().getStart(),
                    allocation.getStart())
                );
        }
        
        return cost;
    }