Fix readYAMLmodel ignoring the actual value of objective_coefficient - #703
Merged
Merged
Conversation
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.
Function test results300 tests 274 ✅ 1m 2s ⏱️ Results for commit be40bfe. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes SysBioChalmers/raven-gecko-parity#14.
model.c(pos,1)=1ran unconditionally whenever a reaction declaredobjective_coefficient, never reading the key's own parsed value(
tline_value). Any model with a weighted or negative objective coefficienthad it silently coerced to
1on import, with no error or warning. Invisibleon models whose
objective_coefficienthappens to already be1.0.Parses the value directly (
str2double(tline_value)) instead, matching howevery other numeric field in this same read loop is handled. Reactions that
never declare the key are unaffected:
model.cis never otherwise initialisedin this function, so MATLAB's numeric auto-extend already fills every untouched
position with
0.