- 
                Notifications
    
You must be signed in to change notification settings  - Fork 3
 
Description
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 
SetCostcost 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.