srtree-2.0.0.0: A general library to work with Symbolic Regression expression trees.
Copyright(c) Fabricio Olivetti 2021 - 2024
LicenseBSD3
Maintainerfabricio.olivetti@gmail.com
Stabilityexperimental
Portability
Safe HaskellSafe-Inferred
LanguageHaskell2010

Algorithm.EqSat

Description

Equality Saturation for SRTree Heavily based on hegg (https:/github.comalt-romes/hegg by alt-romes)

Synopsis

Documentation

type Scheduler a = State (IntMap Int) a #

The Scheduler stores a map with the banned iterations of a certain rule . TODO: make it more customizable.

fromJust :: Maybe a -> a #

eqSat :: Fix SRTree -> [Rule] -> CostFun -> Int -> EGraphST (Fix SRTree) #

runs equality saturation from an expression tree, a given set of rules, and a cost function. Returns the tree with the smallest cost.

getBest :: EClassId -> EGraphST (Fix SRTree) #

gets the best expression given the default cost function

recalculateBest :: CostFun -> EClassId -> EGraphST (Fix SRTree) #

recalculates the costs with a new cost function

runEqSat :: CostFun -> [Rule] -> Int -> EGraphST (Bool, Int) #

run equality saturation for a number of iterations

matchWithScheduler :: DB -> Int -> Int -> Rule -> Scheduler [(Rule, (Map ClassOrVar ClassOrVar, ClassOrVar))] #

matches the rules given a scheduler