You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on adding support to the Python bindings for custom cost models, so that you could define them in pure Python.
I was wondering if it might be appropriate to provide a way to register custom cost models with an EGraph and then be able to use them with the builtin extract command.
Currently, the set_cost cost model in the experimental repo has to define a new extract command that effectively duplicates the existing one but changes the cost model provided. It doesn't currently support the extract report as well.
So if I wanted to allow others in Python to define custom cost models, I would have to support exposing the Extractor object directly, creating a larger API surface area than might be neccessary.
Instead, what if we:
(egglog core): Allowed user to register custom cost models on an egraph from Rust, attaching a name to them.
(egglog core): Allow you to change the "default" cost model used in the EGraph.
(egglog core): Change the extract command to use the default cost model, unless the name of another cost model is specified.
(egglog experimental): Remove the additional extract command and replace it with registering the SetCost cost model and setting it as default
This would work similarly to how custom schedulers are supported, registering them from rust then referencing them in the egglog program.
I moved this issue to experimental. Now with the structured output PR, we could add custom custom model registration only to experimental to work with that custom command.
Activity
saulshanabrook commentedon Sep 5, 2025
I moved this issue to experimental. Now with the structured output PR, we could add custom custom model registration only to experimental to work with that custom command.
Merge pull request #25 from RockingMat/poly-factor