[#cluster_linearize-SFLDefaultCostModel]
= xref:cluster_linearize.adoc[cluster&lowbar;linearize]::SFLDefaultCostModel
:relfileprefix: ../
:mrdocs:

A default cost model for SFL for SetType&equals;BitSet&lt;64&gt;, based on benchmarks&period;

== Synopsis

Declared in `&lt;cluster&lowbar;linearize&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class SFLDefaultCostModel;
----

== Description

The numbers here were obtained in February 2026 by&colon;

* For a variety of machines&colon;
* Running a fixed collection of &#126;385000 clusters found through random generation and fuzzing, optimizing for difficulty of linearization&period;
* Linearize each &#126;3000 times, with different random seeds&period; Sometimes without input linearization, sometimes with a bad one&period;
* Gather cycle counts for each of the operations included in this cost model, broken down by their parameters&period;
* Correct the data by subtracting the runtime of obtaining the cycle count&period;
* Drop the 5% top and bottom samples from each cycle count dataset, and compute the average of the remaining samples&period;
* For each operation, fit a least&hyphen;squares linear function approximation through the samples&period;
* Rescale all machine expressions to make their total time match, as we only care about relative cost of each operation&period;
* Take the per&hyphen;operation average of operation expressions across all machines, to construct expressions for an average machine&period;
* Approximate the result with integer coefficients&period; Each cost unit corresponds to somewhere between 0&period;5 ns and 2&period;5 ns, depending on the hardware&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:cluster_linearize/SFLDefaultCostModel/ActivateBegin.adoc[`ActivateBegin`] 
| Marks the start of activating a dependency&period;
| xref:cluster_linearize/SFLDefaultCostModel/ActivateEnd.adoc[`ActivateEnd`] 
| Accounts for the cost of activating a dependency&period;
| xref:cluster_linearize/SFLDefaultCostModel/DeactivateBegin.adoc[`DeactivateBegin`] 
| Marks the start of deactivating a dependency&period;
| xref:cluster_linearize/SFLDefaultCostModel/DeactivateEnd.adoc[`DeactivateEnd`] 
| Accounts for the cost of deactivating a dependency&period;
| xref:cluster_linearize/SFLDefaultCostModel/GetCost.adoc[`GetCost`] 
| Returns the accumulated cost&period;
| xref:cluster_linearize/SFLDefaultCostModel/GetLinearizationBegin.adoc[`GetLinearizationBegin`] 
| Marks the start of extracting the linearization&period;
| xref:cluster_linearize/SFLDefaultCostModel/GetLinearizationEnd.adoc[`GetLinearizationEnd`] 
| Marks the end of extracting the linearization (cost already charged in InitializeEnd)&period;
| xref:cluster_linearize/SFLDefaultCostModel/InitializeBegin.adoc[`InitializeBegin`] 
| Marks the start of the initialization phase&period;
| xref:cluster_linearize/SFLDefaultCostModel/InitializeEnd.adoc[`InitializeEnd`] 
| Accounts for the cost of initialization and of the final linearization&period;
| xref:cluster_linearize/SFLDefaultCostModel/MakeTopologicalBegin.adoc[`MakeTopologicalBegin`] 
| Marks the start of making the linearization topological&period;
| xref:cluster_linearize/SFLDefaultCostModel/MakeTopologicalEnd.adoc[`MakeTopologicalEnd`] 
| Accounts for the cost of making the linearization topological&period;
| xref:cluster_linearize/SFLDefaultCostModel/MergeChunksBegin.adoc[`MergeChunksBegin`] 
| Marks the start of merging chunks&period;
| xref:cluster_linearize/SFLDefaultCostModel/MergeChunksEnd.adoc[`MergeChunksEnd`] 
| Accounts for the per&hyphen;step cost of merging chunks&period;
| xref:cluster_linearize/SFLDefaultCostModel/MergeChunksMid.adoc[`MergeChunksMid`] 
| Accounts for the per&hyphen;transaction cost of merging chunks&period;
| xref:cluster_linearize/SFLDefaultCostModel/MinimizeStepBegin.adoc[`MinimizeStepBegin`] 
| Marks the start of a single minimization step&period;
| xref:cluster_linearize/SFLDefaultCostModel/MinimizeStepEnd.adoc[`MinimizeStepEnd`] 
| Accounts for the cost of finishing a minimization step&period;
| xref:cluster_linearize/SFLDefaultCostModel/MinimizeStepMid.adoc[`MinimizeStepMid`] 
| Accounts for the per&hyphen;transaction cost of a minimization step&period;
| xref:cluster_linearize/SFLDefaultCostModel/PickChunkToOptimizeBegin.adoc[`PickChunkToOptimizeBegin`] 
| Marks the start of picking a chunk to optimize&period;
| xref:cluster_linearize/SFLDefaultCostModel/PickChunkToOptimizeEnd.adoc[`PickChunkToOptimizeEnd`] 
| Accounts for the cost of picking a chunk to optimize&period;
| xref:cluster_linearize/SFLDefaultCostModel/PickDependencyToSplitBegin.adoc[`PickDependencyToSplitBegin`] 
| Marks the start of picking a dependency to split&period;
| xref:cluster_linearize/SFLDefaultCostModel/PickDependencyToSplitEnd.adoc[`PickDependencyToSplitEnd`] 
| Accounts for the cost of picking a dependency to split&period;
| xref:cluster_linearize/SFLDefaultCostModel/PickMergeCandidateBegin.adoc[`PickMergeCandidateBegin`] 
| Marks the start of picking a merge candidate&period;
| xref:cluster_linearize/SFLDefaultCostModel/PickMergeCandidateEnd.adoc[`PickMergeCandidateEnd`] 
| Accounts for the cost of picking a merge candidate&period;
| xref:cluster_linearize/SFLDefaultCostModel/StartMinimizingBegin.adoc[`StartMinimizingBegin`] 
| Marks the start of a minimization pass&period;
| xref:cluster_linearize/SFLDefaultCostModel/StartMinimizingEnd.adoc[`StartMinimizingEnd`] 
| Accounts for the cost of starting a minimization pass&period;
| xref:cluster_linearize/SFLDefaultCostModel/StartOptimizingBegin.adoc[`StartOptimizingBegin`] 
| Marks the start of setting up an optimization round&period;
| xref:cluster_linearize/SFLDefaultCostModel/StartOptimizingEnd.adoc[`StartOptimizingEnd`] 
| Accounts for the cost of setting up an optimization round&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
