Skip to content

Fix: Preserve domain information when writing GDX files#4

Merged
jd-foster merged 1 commit into
jump-dev:mainfrom
MartinBonde:fix-domain-preservation
Mar 16, 2026
Merged

Fix: Preserve domain information when writing GDX files#4
jd-foster merged 1 commit into
jump-dev:mainfrom
MartinBonde:fix-domain-preservation

Conversation

@MartinBonde

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes Domains are not preserved when writing GDX files #3: Domain information was lost when writing GDX files via write_gdx, causing round-tripped symbols to lose their domain associations (e.g. [i] becoming [*])
  • Added gdx_symbol_set_domain_x C binding wrapping gdxSymbolSetDomainX from the GDX API
  • Each write function (_write_set, _write_parameter, _write_variable, _write_equation) now calls gdxSymbolSetDomainX after gdx_data_write_done to store the relaxed domain information
  • Added 5 test cases verifying domain preservation for parameters, variables, equations, multi-dimensional symbols, and GAMS-generated file round-trips

Test plan

  • All 115 tests pass (109 existing + 6 new assertions across 5 new testsets)
  • Verified parameter domain preserved on round-trip
  • Verified variable domain preserved on round-trip
  • Verified equation domain preserved on round-trip
  • Verified multi-dimensional domain preserved on round-trip
  • Verified GAMS-generated file domain preserved on round-trip
  • Existing tests unaffected

Fixes jump-dev#3. The write functions were not calling gdxSymbolSetDomainX after writing symbol data, causing domain information to be lost on round-trip. Added gdx_symbol_set_domain_x C binding and call it after gdx_data_write_done for each symbol.
@jd-foster jd-foster merged commit 20d5e69 into jump-dev:main Mar 16, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Domains are not preserved when writing GDX files

2 participants