iiasa / iiasa/ixmp4

How should `constrained_to_indexsets=[]` be handled?

Open
#175 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14
Forks
8
PR merge metrics
No merged PRs in 30d

Description

@meksor reported in #157:

> Ok, so now when creating an equation like this:
> ```
> equation = platform.backend.optimization.equations.create(
> run_id=run.id,
> name="Equation",
> constrained_to_indexsets=[],
> )
> ```
> (Which I did not expect to work, but it does) equation.column_names throws an IndexError

This issue is to keep track of and eventually resolve this.

#164 is making `constrained_to_indexsets` optional. With that in mind, @danielhuppmann, what is our intended usage here?

Should the above work, and if so, how? By creating an `Equation` that is not constrained to any `IndexSet`?

Either way, we should make sure our tests capture the intended behavior.

Contributor guide

No contributing guide indexed for this repository

Research direction

Read the behavior reported in #157 and the optionality context in #164, then inspect the Equation entry point around column_names and constrained_to_indexsets. Determine the intended behavior for an empty list, and add tests that capture that decision without allowing column_names to raise an unexpected IndexError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.