Suppress output from Forward Tool?
- Brian Umberger
- Posts: 48
- Joined: Tue Aug 28, 2007 2:03 pm
Suppress output from Forward Tool?
Hi All,
I am working on an optimization study making use of the Matlab interface to the API. When my script loads the model and initializes it, there is some information written to the screen (truncated for brevity):
--------------------------------------------------
Loaded model Arm26_Optimize.osim
Finished addToSystem for Bodies.
Calling addToSystem for Joint ...
-
-
-
--------------------------------------------------
Computing the value of my objective function requires running a forward simulation, which I am doing using the Forward Tool. When the Forward Tool runs, some additional information is written to the screen (again, truncated):
--------------------------------------------------
MODEL: arm26_optimize
ANALYSES (0)
BODIES (3)
body[0] = ground (mass: 0) (inertia: 0 0 0 0 0 0 0 0 0)
-
-
-
--------------------------------------------------
While it is all useful information, is there any way to suppress this output? I am especially interested in suppressing the output from the Forward Tool, as that runs hundreds of times during a single optimization, filling the screen with the same thing over-and-over.
In trying to solve this issue I found out how to control the writing of the simulation results files (tool.setPrintResultFiles(true/false)), but not the information that goes to the screen. In the Doxygen I found setVerboseLevel under Tool, but I could not get that to work with the Forward Tool (seems it may not be intended to, based on methodsview(ForwardTool)).
So, my primary questions are whether I can suppress the output from the Forward Tool in Matlab, and if not, what alternative are there for running forward simulations from within Matlab?
Thanks in advance for any suggestions!
Brian
I am working on an optimization study making use of the Matlab interface to the API. When my script loads the model and initializes it, there is some information written to the screen (truncated for brevity):
--------------------------------------------------
Loaded model Arm26_Optimize.osim
Finished addToSystem for Bodies.
Calling addToSystem for Joint ...
-
-
-
--------------------------------------------------
Computing the value of my objective function requires running a forward simulation, which I am doing using the Forward Tool. When the Forward Tool runs, some additional information is written to the screen (again, truncated):
--------------------------------------------------
MODEL: arm26_optimize
ANALYSES (0)
BODIES (3)
body[0] = ground (mass: 0) (inertia: 0 0 0 0 0 0 0 0 0)
-
-
-
--------------------------------------------------
While it is all useful information, is there any way to suppress this output? I am especially interested in suppressing the output from the Forward Tool, as that runs hundreds of times during a single optimization, filling the screen with the same thing over-and-over.
In trying to solve this issue I found out how to control the writing of the simulation results files (tool.setPrintResultFiles(true/false)), but not the information that goes to the screen. In the Doxygen I found setVerboseLevel under Tool, but I could not get that to work with the Forward Tool (seems it may not be intended to, based on methodsview(ForwardTool)).
So, my primary questions are whether I can suppress the output from the Forward Tool in Matlab, and if not, what alternative are there for running forward simulations from within Matlab?
Thanks in advance for any suggestions!
Brian
- Brian Umberger
- Posts: 48
- Joined: Tue Aug 28, 2007 2:03 pm
Re: Suppress output from Forward Tool?
A quick update on my question. I am still not sure about changing the verbosity of the Forward Tool, but based on some further digging, there appear to be at least two other ways to run forward simulations programmatically from within Matlab. I was able to do this for my problem using the native Matlab integrators, following the very cool dynamic walker example. The only problem was that when I tried this approach for a model with contact, the integration was really slow. It is also possible to create a "manager" to run the simulation, though I've not come across any Matlab examples that demonstrate this. This is the route I am pursuing now, though any and all feedback or suggestions are certainly welcome.
Cheers,
Brian
Cheers,
Brian
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
Re: Suppress output from Forward Tool?
Hi, Brian. I'm not sure if this will help, but you might try using one of Matlab's stiff integrators (I think the names end in "s"). Our contact formulation tends to make the problems stiff.
Regards,
Sherm
Regards,
Sherm
- Brian Umberger
- Posts: 48
- Joined: Tue Aug 28, 2007 2:03 pm
Re: Suppress output from Forward Tool?
Hi Sherm,
Thanks for the suggestion. I randomly tried a couple of the different Matlab integrators, but I will do a more systematic study of the various integrators, as well as the integrator settings.
It looks like with the Manager approach I can indicate which simmath integrator to use. Are one or more of the integrators that come with OpenSim better at handling stiff problems, such as with ground contact in a musculoskeletal model?
Thanks,
Brian
Thanks for the suggestion. I randomly tried a couple of the different Matlab integrators, but I will do a more systematic study of the various integrators, as well as the integrator settings.
It looks like with the Manager approach I can indicate which simmath integrator to use. Are one or more of the integrators that come with OpenSim better at handling stiff problems, such as with ground contact in a musculoskeletal model?
Thanks,
Brian
- Michael Sherman
- Posts: 807
- Joined: Fri Apr 01, 2005 6:05 pm
Re: Suppress output from Forward Tool?
We don't have a great method yet for fast simulation with compliant contact, but some are better than others. The CPodes integrator is a stiff integrator so does very well with steady contact but tends to slow down across impacts. More recently we have been using SemiExplicitEuler2Integrator which can be used at very low accuracy (like .01 or even .1) to get improved performance. (That's not in OpenSim 3.1 but if you are building Simbody from source you can try it.)
In 3.1 you might want to try CPodes at accuracy .001 (it doesn't work well looser) or try RungeKuttaMerson or RungeKutta3 at looser accuracy (.01 to .05 ish).
Approaching it from the other end, you could try making the problem less stiff by changing the transition velocity (larger number is less stiff), dissipation and friction coefficients. A softer material also helps.
Regards,
Sherm
In 3.1 you might want to try CPodes at accuracy .001 (it doesn't work well looser) or try RungeKuttaMerson or RungeKutta3 at looser accuracy (.01 to .05 ish).
Approaching it from the other end, you could try making the problem less stiff by changing the transition velocity (larger number is less stiff), dissipation and friction coefficients. A softer material also helps.
Regards,
Sherm
- Brian Umberger
- Posts: 48
- Joined: Tue Aug 28, 2007 2:03 pm
Re: Suppress output from Forward Tool?
Hi Sherm,
Thanks for the helpful information!
Brian
Thanks for the helpful information!
Brian
- Alex Priamikov
- Posts: 14
- Joined: Fri Jan 11, 2013 9:11 am
Re: Suppress output from Forward Tool?
Hi Brian,
Returning to your first question, I suppressed such output basically commenting code as "cout" in sources and recompiling opensim.
Maybe it can works for you.
Best,
Alex
Returning to your first question, I suppressed such output basically commenting code as "cout" in sources and recompiling opensim.
Maybe it can works for you.
Best,
Alex
- Brian Umberger
- Posts: 48
- Joined: Tue Aug 28, 2007 2:03 pm
Re: Suppress output from Forward Tool?
Hi Alex,
Thanks for the suggestion. I wasn't planning on recompiling OpenSim from source, but that would certainly do the trick! In the meantime, I think that I've worked out how to run the forward simulations from within Matlab using a simulation Manager, which achieves the desired result without any output to the screen and is a bit faster than the Forward Tool (less overhead I assume).
Thanks,
Brian
Thanks for the suggestion. I wasn't planning on recompiling OpenSim from source, but that would certainly do the trick! In the meantime, I think that I've worked out how to run the forward simulations from within Matlab using a simulation Manager, which achieves the desired result without any output to the screen and is a bit faster than the Forward Tool (less overhead I assume).
Thanks,
Brian
Re: Suppress output from Forward Tool?
Hi Brian,
May i know how do you use a simulation Manager in Matlab to run the forward simulations?
I always get java runtime error when i use manager.
Thanks,
Kai
May i know how do you use a simulation Manager in Matlab to run the forward simulations?
I always get java runtime error when i use manager.
Thanks,
Kai
- kathi pearl
- Posts: 1
- Joined: Thu Jan 01, 2015 3:42 am
Re: Suppress output from Forward Tool?
Thank you for your reply.
I will try to interpolate the data.
_________________________
We are the pioneers in providing 648-375 and 9L0-415 with 100% pass-4sure dumps guarantee. Download our latest www.sterling.edu and Thomas Aquinas College or pass real exam of Jacksonville University.
I will try to interpolate the data.
_________________________
We are the pioneers in providing 648-375 and 9L0-415 with 100% pass-4sure dumps guarantee. Download our latest www.sterling.edu and Thomas Aquinas College or pass real exam of Jacksonville University.