return new VariantEvaluation(thisVariantDescription, thisActionEvaluation, predictedCost, predictedCost/horizon, predictedBenefit, maxTransitionTime);
return new VariantEvaluation(thisVariantDescription, thisActionEvaluation, predictedCost, predictedCost/horizon, predictedBenefit, predictedBenefit/horizon, maxTransitionTime);
   private VariantEvaluation createCorrectiveVariantEvaluation(AssetID assetID, AssetStateDimension asd, StateDimensionEstimation currentStateDimensionEstimation, ActionDescription thisVariantDescription, ActionEvaluation thisActionEvaluation, boolean isActive, CostBenefitKnob knob) {        double predictedCost = 0.0; // total predicted cost        double predictedBenefit = 0.0;        long maxTransitionTime = 0L;        long horizon = knob.getHorizon();        Vector startStateVector = asd.getPossibleStates();        Iterator startStateIterator = startStateVector.iterator();        while (startStateIterator.hasNext()) {            AssetState startState = (AssetState) startStateIterator.next();            String startStateName = startState.getName();            double startStateProb;            double startStateBenefit;            double intermediateStateBenefit;            double endStateBenefit;            long transitionTime;            ActionCost oneTimeCost;            ActionCost continuingCost;            try {                startStateProb = currentStateDimensionEstimation.getProbability(startStateName);                AssetTransitionWithCost atwc = thisVariantDescription.getTransitionForState(startState);                if (atwc != null) { // the TechSpecs define a transition by this Variant for this state                    if (logger.isDebugEnabled()) logger.debug("Found a transition for: "+ thisVariantDescription.name() + " for start state " + startStateName+" is "+atwc.toString());                    startStateBenefit = computeStateBenefit(startState, knob);                    intermediateStateBenefit = computeStateBenefit(atwc.getIntermediateValue(), knob);                    endStateBenefit = computeStateBenefit(atwc.getEndValue(), knob);                    if (!isActive) { // dlw 10/7/04                         // this is the case where the action has to startup                        transitionTime = (atwc.getOneTimeCost()!=null)?atwc.getOneTimeCost().getTimeCost():0L; // assume for now that 1-time costs are all expressed in terms of time (and maybe other factors also)                    }                    else {                        // this is the case where the action is already active, so transition doesn't happen (handled as an instantaneous transition)                        transitionTime = 0;                    }                    oneTimeCost = atwc.getOneTimeCost();                    continuingCost = atwc.getContinuingCost();                    if (horizon >= transitionTime)  { // the normal case                        double stateBenefit = 0.5 * endStateBenefit * (horizon - transitionTime) // time-depreciated benefit of being in the end state                                            + 0.5 * transitionTime * intermediateStateBenefit * (1 + (horizon-transitionTime)/horizon) // time-depreciated benefoit of being in the intermediate (transition) state                                            - 0.5 * horizon * startStateBenefit; // the benefit of doing nothing                        predictedBenefit = predictedBenefit + startStateProb * stateBenefit;                        if (logger.isDebugEnabled()) logger.debug("**** stateBenefit for: " + startStateName + " is: " + stateBenefit + " with prob: " + startStateProb);                        predictedCost = predictedCost + startStateProb*(transitionTime                                * aggregateCost(oneTimeCost) + (horizon-transitionTime)*aggregateCost(continuingCost));                        }                    else  { // transition takes longer than the planning horizon, so action transition will not complete                        double stateBenefit = horizon*intermediateStateBenefit;                        predictedBenefit = predictedBenefit + startStateProb * stateBenefit;                        if (logger.isDebugEnabled()) logger.debug("**** stateBenefit for: " + startStateName + " is: " + stateBenefit + " with prob: " + startStateProb);                        predictedCost = predictedCost + startStateProb*(horizon*aggregateCost(oneTimeCost));                        }                    if (logger.isDebugEnabled()) logger.debug("**** Cumlative Benefit: " + predictedBenefit);                    maxTransitionTime = Math.max(maxTransitionTime, transitionTime);                    }               }            catch (BelievabilityException e) {                // Should be impossible to get here if the ActionDescription is correctly populated                throw new RuntimeException("Could not find an AssetState that the ActionDescription said it had");                }        }        return new VariantEvaluation(thisVariantDescription, thisActionEvaluation, predictedCost, predictedCost/horizon, predictedBenefit, maxTransitionTime);    }