Algorithm Overview
In very general terms, the cost engine algorithm costs a variety of alternative process routings for a given part, and picks the one with the lowest cost. The candidate routings are derived from process templates and template pruning CSL modules (see Process Template Expansion and Pruning). For process groups that support material stocks, the cost engine actually costs a variety of routing/ stock combinations, and picks the best one. It derives the candidate stocks from the material stock selection CSL module (see Material Stock Selection).
For each candidate process routing (or process routing/material stock combination), the algorithm, broadly speaking, proceeds in four stages:
1 Feasibility and machine selection: Evaluates the routing’s feasibility. Eliminates the routing from consideration if it is infeasible; otherwise, picks a machine for each feasible node of the routing. See Feasibility and Machine Selection for details.
2 Operation assignment: Descends the GCD hierarchy, choosing an operation sequence for each GCD, and additionally finding a parent process or parent operation for each operation in the chosen sequence (thus establishing the process-operation hierarchy), as well as finding a tool for each operation in the chosen sequence that requires one. See Operation Assignment for details.
3 Operation costing: Ascends the process-operation hierarchy, evaluating the cost of each operation along the way (possibly relying on the results of evaluating the cost of descendent operations). See Process and Operation Taxonomy for details.
4 Process costing: Traverses the process routing, evaluating the cost of each process along the way (possibly relying on the results of evaluating operation costs). The cost engine then aggregates the costs across processes, yielding a fully-burdened, per-part cost. See Process Costing for details.
Once each routing (or routing/stock combination) has been considered, the cost engine selects the one with the lowest fully-burdened cost. If all candidate routing/stock combinations have been eliminated from consideration, the part fails to cost.
Pseudo code for this high-level algorithm might take the following form:
 
Template Pruning
for each pruned, licensed process routing {
 
Material Stock Selection
for each selected material stock {
 
Stage 1: Feasibility and Machine Selection
Stage 2: Operation Assignment
Stage 3: Operation Costing
Stage 4: Process Costing
}
 
}
Select Optimal Routing and Stock