Class CostOptimization.Builder
java.lang.Object
software.amazon.smithy.rulesengine.logic.bdd.CostOptimization.Builder
- All Implemented Interfaces:
SmithyBuilder<CostOptimization>
- Enclosing class:
- CostOptimization
public static final class CostOptimization.Builder
extends Object
implements SmithyBuilder<CostOptimization>
Builder for
CostOptimization.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates an immutable object that is created from the properties that have been set on the builder.Sets the control flow graph (required).costModel(ConditionCostModel costModel) Sets the cost model for conditions.maxAllowedGrowth(double maxAllowedGrowth) Sets the maximum allowed node growth as a fraction (default 0.08 or 8%).maxRounds(int maxRounds) Sets the maximum number of optimization rounds (default 30).topK(int topK) Sets the number of hot positions to probe per round (default 50).trueProbability(ToDoubleFunction<Condition> trueProbability) Sets the function that returns the probability a condition evaluates to true.
-
Method Details
-
cfg
Sets the control flow graph (required).- Parameters:
cfg- the CFG- Returns:
- the builder
-
costModel
Sets the cost model for conditions.- Parameters:
costModel- the cost model- Returns:
- the builder
-
trueProbability
Sets the function that returns the probability a condition evaluates to true.- Parameters:
trueProbability- function returning probability in [0.0, 1.0] (null for uniform 0.5)- Returns:
- the builder
-
maxAllowedGrowth
Sets the maximum allowed node growth as a fraction (default 0.08 or 8%).- Parameters:
maxAllowedGrowth- maximum growth (0.0 = no growth, 0.1 = 10% growth)- Returns:
- the builder
-
maxRounds
Sets the maximum number of optimization rounds (default 30).- Parameters:
maxRounds- maximum rounds- Returns:
- the builder
-
topK
Sets the number of hot positions to probe per round (default 50)."Hot" positions are conditions ranked by
reachProbability × cost. These are conditions that are both frequently evaluated and expensive, making them the best candidates for reordering to reduce expected cost.- Parameters:
topK- number of hot positions to consider moving each round- Returns:
- the builder
-
build
Description copied from interface:SmithyBuilderCreates an immutable object that is created from the properties that have been set on the builder.- Specified by:
buildin interfaceSmithyBuilder<CostOptimization>- Returns:
- an instance of T
-