When using simbiology, I have a species that calls a function that uses a linear programming solver (glpk) and when I use it, the dosing stops working

3 次查看(过去 30 天)
The ultimate goal is to make a hybrid dynamic model and a steady-state model. So, at each step, the model runs, one of the species will be the input to the steady-state model that runs using LP, but doesn't affect
I have a species that calls a repeated assignmet and I made a custom MATLAB function that uses linear programming (glpk). I even set it so that the actual function doesn't affect the model. However, I think the glpk is messing up with the ODE solver. When I don't call the LP solver, the model runs as expected.
  • Are there setting that I can adjust to limit this? I already tried disabling absolute tolerance scaling.
  • Would there be another LP solver that wouldn't interfere?
  • Does MATLAB have a built in LP solver?
I'm using Matlab and Simbiology 2020b on Windows 10

采纳的回答

Christopher Nogiec
Christopher Nogiec 2023-10-20
The LP solver slowed down the process. So, when called, It used up the time to run the simulation, without letting the actual time finish. Changing "MaximumWallClock" to Inf resolved the issue.

更多回答(1 个)

Rick Paxson
Rick Paxson 2023-10-4
编辑:Rick Paxson 2023-10-4
I suspect the issue might be with how glpk is getting called. In particular I wonder if it is called synchronously such that the repeated assingment "blocks" execution of the ODE solver until its done. If that is not the case then there would be an issue as the ODE solver would be out of sync with the results from glpk. I am making a bunch of assumptions here so maybe learning more about how this is set up would help.
In the meantime, the optimization toolbox has a LP solver (linprog is the command).
Let me know if this helps.
  3 个评论
Christopher Nogiec
Christopher Nogiec 2023-10-12
编辑:Christopher Nogiec 2023-10-14
Thank you for offerring to look at the code.
I've attached the model and supporting scripts. It's not the best code, it's just a quick proof of concept.
In the model, under the FBA compartment is the repeated function affecting glycogen which calls the LP solver. This is the reaction that you can set to in/active and see where the model falls apart.
You'll also see I don't actually pass variables from the repeated function to the model. That was step two, but I was trying to isolate the problem, so currently it just runs the LP solver at every time point?
Let me know if I'm missing any code or if something isn't running.
Thank you

请先登录,再进行评论。

社区

更多回答在  SimBiology Community

类别

Help CenterFile Exchange 中查找有关 Extend Modeling Environment 的更多信息

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by