SpineOpt.jl
SpineOpt.jl copied to clipboard
Add higher level switches to include/exclude constraints from the formulation
Right now, even if many constraints have indices which are a null set, the SpineOpt code to figure that out takes a long time to execute. For example, if a model has no values specified for candidate_connections
- then there are a slew of constraints that don't need to be generated. However, right now, the SpineOpt code will spend a relatively long time figuring out that the indices for a number of the related constraints are empty. If we instead implemented some higher level switches to turn constraints off at a high level, this would increase model building performance. Some users have even resorted to commenting constraints out to achieve this - which shouldn't be necessary.
I think there are two main options regarding implementation:
- Create a method parameter corresponding to each constraint or group of related/dependent constraints that control whether the constraints are added to the formulation or not.
- Implment some higher level smarts that look at whether certain parameters have values or not in the model and smartly work out what constraints are not needed
The method parameter version is possibly cleaner and more exhaustive as not all constraints are triggered via a parameter value
In addition we should see if there are ways to improve the performance if related parameters that trigger constraints are not specified for certain entities... e.g. filter by entities with the related parameter specified at a higher level in the index function.
This is related to https://github.com/spine-tools/SpineOpt.jl/issues/855
We should use method parameters to ensure that the user gets the intended behavior. The new SpineOpt data structure proposal includes method parameters - for example investments would be triggered by investment_method (where one method is 'not_allowed'). I wouldn't call them constraint level triggers though. One method choice could affect more than one constraint.