cog-imperial / entmoot

Multiobjective black-box optimization using gradient-boosted trees
https://entmoot.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
56 stars 12 forks source link

Type hinting for pyomo and gurobi models #42

Open TobyBoyne opened 4 months ago

TobyBoyne commented 4 months ago

Currently, many key attributes (such as model._all_feat) are used throughout the codebase, but are not type hinted and are poorly documented. I propose creating subclasses of pyo.Model and gurobi.Model that have type hints (only to be used for type stubs, not functional). This would then be a natural place for the associated documentation as well.

An example of where this is important is in user-defined constraints. Users are expected to use model._all_feat to access the relevant variables, but we do not provide a user-friendly interface to do so. I will also note here that the underscore implies this is a private attribute, but we ask users to access it publicly.