entmoot icon indicating copy to clipboard operation
entmoot copied to clipboard

Type hinting for pyomo and gurobi models

Open TobyBoyne opened this issue 7 months ago • 0 comments

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.

TobyBoyne avatar Jul 03 '24 14:07 TobyBoyne