Skip to content

Fix readYAMLmodel ignoring the actual value of objective_coefficient - #703

Merged
edkerk merged 1 commit into
develop3from
fix/readyamlmodel-objective-coefficient-value
Aug 28, 2026
Merged

Fix readYAMLmodel ignoring the actual value of objective_coefficient#703
edkerk merged 1 commit into
develop3from
fix/readyamlmodel-objective-coefficient-value

Conversation

@edkerk

@edkerk edkerk commented Aug 28, 2026

Copy link
Copy Markdown
Member

Fixes SysBioChalmers/raven-gecko-parity#14.

model.c(pos,1)=1 ran unconditionally whenever a reaction declared
objective_coefficient, never reading the key's own parsed value
(tline_value). Any model with a weighted or negative objective coefficient
had it silently coerced to 1 on import, with no error or warning. Invisible
on models whose objective_coefficient happens to already be 1.0.

Parses the value directly (str2double(tline_value)) instead, matching how
every other numeric field in this same read loop is handled. Reactions that
never declare the key are unaffected: model.c is never otherwise initialised
in this function, so MATLAB's numeric auto-extend already fills every untouched
position with 0.

model.c(pos,1)=1 ran unconditionally whenever a reaction declared
objective_coefficient, never reading the key's own parsed value
(tline_value). Any model with a weighted or negative objective
coefficient had it silently coerced to 1 on import, with no error or
warning. Invisible on models whose own objective_coefficient happens
to already be 1.0.

Parses the value directly (str2double(tline_value)) instead, matching
how every other numeric field in this same read loop is handled.
Reactions that never declare the key are unaffected: model.c is never
otherwise initialised in this function, so MATLAB's own numeric
auto-extend already fills every untouched position with 0.
@github-actions

Copy link
Copy Markdown

Function test results

300 tests   274 ✅  1m 2s ⏱️
 25 suites   26 💤
  1 files      0 ❌

Results for commit be40bfe.

@edkerk
edkerk merged commit a171943 into develop3 Aug 28, 2026
4 checks passed
@edkerk
edkerk deleted the fix/readyamlmodel-objective-coefficient-value branch August 28, 2026 07:08
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.

1 participant