Skip to content

Fix scalar variable registration with multiple dispatch#5

Merged
guimarqu merged 1 commit intomainfrom
bugfix/register_single_var
Aug 25, 2025
Merged

Fix scalar variable registration with multiple dispatch#5
guimarqu merged 1 commit intomainfrom
bugfix/register_single_var

Conversation

@guimarqu
Copy link
Member

@guimarqu guimarqu commented Aug 21, 2025

Summary

  • Replace ugly conditional logic with clean multiple dispatch for scalar variable registration
  • Scalar variables now stored directly as VariableRef instead of containers requiring [()]

Example

# Before (ugly):
reform_model[:x][()]

# After (clean):  
reform_model[:x]

closes #1

Replace ugly conditional logic with clean multiple dispatch pattern.
Scalar variables are now stored directly as VariableRef instead of
requiring container access with [()].

- Add _register_variable_object! methods for scalar vs indexed variables
- Update tests to use clean access pattern
- Remove TODO comments about ugly access
@guimarqu guimarqu merged commit ec56b2c into main Aug 25, 2025
1 check passed
@guimarqu guimarqu deleted the bugfix/register_single_var branch August 25, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix variable indexing behavior for scalar variables in reformulated models

1 participant

Comments