code: public double computeAvailability(Solution bestSol, Topology topology, SuitableOptions cloudCharacteristics) {
  
        visited = new HashSet<String>();
  
        TopologyElement initialElement = topology.getInitialElement();
  
        visited.add(initialElement.getName());
  
        String cloudUsedInitialElement = bestSol.getCloudOfferNameForModule(initialElement.getName());
        double instancesUsedInitialElement = -1;
        try {
           instancesUsedInitialElement = bestSol.getCloudInstancesForModule(initialElement.getName());
        } catch (Exception E) {// nothing to do
        }
        double availabilityInitialElementInstance = cloudCharacteristics
              .getCloudCharacteristics(initialElement.getName(), cloudUsedInitialElement).getAvailability();
  
        double unavailabilityInitialElement = Math.pow((1.0 - availabilityInitialElementInstance),
              instancesUsedInitialElement);
        double availabilityInitialElement = 1.0 - unavailabilityInitialElement;
  
        double systemAvailability = availabilityInitialElement;
  
        for (TopologyElementCalled c : topology.getInitialElement().getDependences()) {
           systemAvailability = systemAvailability
                 * calculateAvailabilityRecursive(c, bestSol, topology, cloudCharacteristics);
        }
  
        if (log.isDebugEnabled()) {
           log.debug("Finished calculation of availability of solution: " + bestSol.toString());
        }
        // after computing, save the availability info in properties.availability
        properties.setAvailability(systemAvailability);
  
        return systemAvailability;
     }
docs: @param bestSol
  @param topology
  @param cloudCharacteristics
  @return The calculated availability of the system.
  
  This method will be recursive. The availablity of the system will
  be the product of the availability of its first module and the
  modules it requests. It will not work if there are cycles in the
  topology