Class AlgorithmImpl
- Direct Known Subclasses:
AdaptiveMonteCarloAlgorithm
,ExhaustiveLatticeAlgorithm
,MonteCarloAlgorithm
Algorithm
that uses an exhaustive
algorithm. The algorithm constructs the full lattice in memory, and uses a
greedy algorithm which, at each step, chooses the aggregate which offers
the greatest benefit over the current set of aggregates.
Cost
If there are N
levels, then the lattice has size
2N
. Let's suppose that the algorithm creates
M
aggregates before each aggregate sees only a marginal benefit.
Then the running time is M * 2N
.
The cost and memory usage of the algorithm is prohibitive for all but very small schemas. For example, for a schema with 20 levels and 40 aggregate tables, this requires memory for a lattice of 1 million potential aggregates, and 40 million steps to evaluate choose the actual set of aggregate tables.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.pentaho.aggdes.algorithm.Algorithm
Algorithm.CostBenefit, Algorithm.ParameterEnum
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancels a run.protected boolean
Checks whether this algorithm has been canceled or has exceeded its maximum running time.createAggregate
(Schema schema, List<Attribute> attributeList) Creates an Aggregate.static String
getBaseName
(Class<? extends Component> aClass) getName()
Returns a name for this component.Declares the parameters that this component accepts.protected void
Called by theAlgorithm.run(org.pentaho.aggdes.model.Schema, java.util.Map<org.pentaho.aggdes.model.Parameter, java.lang.Object>, org.pentaho.aggdes.algorithm.Progress)
method, resets the 'canceled' flag and sets the start time for timeout purposes.protected ResultImpl
runAlgorithm
(Lattice lattice, double costLimit, double minCostBenefitRatio, int aggregateLimit) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.pentaho.aggdes.algorithm.Algorithm
computeAggregateCosts, run
-
Field Details
-
parameterList
-
schema
-
-
Constructor Details
-
AlgorithmImpl
protected AlgorithmImpl()Creates an AggregateTableAdvisorImpl
-
-
Method Details
-
cancel
public void cancel()Description copied from interface:Algorithm
Cancels a run.Call this method from another thread.
Some algorithms are able to return a result if they are canceled before they run to completion; if so, the
Algorithm.run(org.pentaho.aggdes.model.Schema, java.util.Map<org.pentaho.aggdes.model.Parameter, java.lang.Object>, org.pentaho.aggdes.algorithm.Progress)
method will return that result; otherwiseAlgorithm.run(org.pentaho.aggdes.model.Schema, java.util.Map<org.pentaho.aggdes.model.Parameter, java.lang.Object>, org.pentaho.aggdes.algorithm.Progress)
returns null. -
getName
Description copied from interface:Component
Returns a name for this component. -
getBaseName
-
getParameters
Description copied from interface:Component
Declares the parameters that this component accepts.- Specified by:
getParameters
in interfaceComponent
- Returns:
- list of parameters that this component accepts
-
onStart
Called by theAlgorithm.run(org.pentaho.aggdes.model.Schema, java.util.Map<org.pentaho.aggdes.model.Parameter, java.lang.Object>, org.pentaho.aggdes.algorithm.Progress)
method, resets the 'canceled' flag and sets the start time for timeout purposes.- Parameters:
parameterValues
- Parametersprogress
- Progress callback
-
checkCancelTimeout
protected boolean checkCancelTimeout()Checks whether this algorithm has been canceled or has exceeded its maximum running time.Algorithm must call this method regularly and terminate if it returns true.
- Returns:
- whether algorithm needs to terminate due to either cancelation or timeout
-
createAggregate
Description copied from interface:Algorithm
Creates an Aggregate.- Specified by:
createAggregate
in interfaceAlgorithm
- Parameters:
schema
- Schema objectattributeList
- List of attributes- Returns:
- Aggregate
-
runAlgorithm
protected ResultImpl runAlgorithm(Lattice lattice, double costLimit, double minCostBenefitRatio, int aggregateLimit)
-