Optimizer error message
- Nithin Kurup
- Posts: 149
- Joined: Sat Jan 18, 2014 5:13 am
Optimizer error message
Hi,
I was performing an Optimization and it exited with an error message. Could someone kindly tell me the meaning.
69580D60SimTK Exception thrown at InteriorPointOptimizer.cpp:261:
Optimizer failed: Ipopt: Insufficient memory (status -102)
Is it related to optimiser or my computer memory?
Thanks,
Nithin
I was performing an Optimization and it exited with an error message. Could someone kindly tell me the meaning.
69580D60SimTK Exception thrown at InteriorPointOptimizer.cpp:261:
Optimizer failed: Ipopt: Insufficient memory (status -102)
Is it related to optimiser or my computer memory?
Thanks,
Nithin
- Michael Sherman
- Posts: 806
- Joined: Fri Apr 01, 2005 6:05 pm
Re: Optimizer error message
Hi, Nithin. I looked in the code and that message is generated as a result of a C++ std::bad_alloc exception, very likely meaning that the maximum available memory was already in use. This usually means there is a memory leak somewhere -- you are using up memory but never freeing it. Likely something is being allocated at every objective function evaluation during the optimization but then not freed at the end of the evaluation.
This error does not mean your computer has insufficient hardware; it is a software issue.
Regards,
Sherm
This error does not mean your computer has insufficient hardware; it is a software issue.
Regards,
Sherm
- Nithin Kurup
- Posts: 149
- Joined: Sat Jan 18, 2014 5:13 am
Re: Optimizer error message
Dear Sherman,
Thank you so much for your reply, I absolutely have no idea how to solve it. I will check the objective function and hopefully find the error.
Thanks again,
Nithin
Thank you so much for your reply, I absolutely have no idea how to solve it. I will check the objective function and hopefully find the error.
Thanks again,
Nithin
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: Optimizer error message
Do you use `new SomeObject()` in your objective function? This would be the place to start. Sometimes you need a corresponding `delete obj`, but sometimes you pass that "new" object into another object that will take ownership of it (which means it will get deleted for you).
Are you using OpenSim? There are some memory leaks in OpenSim as well, but they are minor and would not use up all your memory unless you only get that error after *many* iterations.
Are you using OpenSim? There are some memory leaks in OpenSim as well, but they are minor and would not use up all your memory unless you only get that error after *many* iterations.
- Nithin Kurup
- Posts: 149
- Joined: Sat Jan 18, 2014 5:13 am
Re: Optimizer error message
Dear Chris,
I have two analysis where I have used the pointers to access the members.
1. ForceReporter* reporter = new ForceReporter(&osimModel);
2. BodyKinematics* BK = new BodyKinematics(&osimModel);
then,
since I am doing a forward optimization I also have the prescribedcontroller
PrescribedController *control = new PrescribedController();
PrescribedController* controller_r = dynamic_cast<PrescribedController*>( &controllerSet.get(i) );
Apart from this I also have an event handler, and I also notice this was set to 500
opt.setLimitedMemoryHistory(500);
Thanks
Nithin
I have two analysis where I have used the pointers to access the members.
1. ForceReporter* reporter = new ForceReporter(&osimModel);
2. BodyKinematics* BK = new BodyKinematics(&osimModel);
then,
since I am doing a forward optimization I also have the prescribedcontroller
PrescribedController *control = new PrescribedController();
PrescribedController* controller_r = dynamic_cast<PrescribedController*>( &controllerSet.get(i) );
Apart from this I also have an event handler, and I also notice this was set to 500
opt.setLimitedMemoryHistory(500);
Thanks
Nithin
- Jiang Ping
- Posts: 132
- Joined: Sun Aug 26, 2012 4:09 am
Re: Optimizer error message
I have the similar problem before.
delete reporter when you dont need it.
OpenSim will not delete it for us. (Tested in OpenSim3.2)
delete reporter when you dont need it.
OpenSim will not delete it for us. (Tested in OpenSim3.2)
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: Optimizer error message
Jiang is right. I'm not sure how you're using those reporters, but if you don't pass them to any other object then you should delete them yourself. If you pass them to a Model, the model might delete them for you. Also, are you sure you need to dynamically allocate the reporters?
Do you add the PrescribedController to the model? If so, the Model should take care of deleting it.
The "limited memory history" is not about C++ memory management; it has to do with the operation of the optimizer algorithms.
Do you add the PrescribedController to the model? If so, the Model should take care of deleting it.
The "limited memory history" is not about C++ memory management; it has to do with the operation of the optimizer algorithms.
- Nithin Kurup
- Posts: 149
- Joined: Sat Jan 18, 2014 5:13 am
Re: Optimizer error message
Dear chris and Jiang,
Thanks for your replies, As per jiang's suggestion, I have added the removeAnalysis(*,true) , once I have collected the data and before the start of next iteration.
Chris,I dont pass the reporters through any other objects- so I assume that I have to remove them [ Would have been great if it was added to documentation].
I have also used delete 'obj' for a motion Prescriber I have used as per your suggestion.I have included the PrescribedController to model,so hope including too many parameters for optimization wont lead to memory leak.
Also- a doubt on the limitedmemoryHistory, I wasnt able to find documentation that mentions the upper or lower limits we could set for these optimizer algorithms, also if it was possible to pass parameters other than opensim actuators through the optimizer.
thanks again for your replies,
nithin
Thanks for your replies, As per jiang's suggestion, I have added the removeAnalysis(*,true) , once I have collected the data and before the start of next iteration.
Chris,I dont pass the reporters through any other objects- so I assume that I have to remove them [ Would have been great if it was added to documentation].
I have also used delete 'obj' for a motion Prescriber I have used as per your suggestion.I have included the PrescribedController to model,so hope including too many parameters for optimization wont lead to memory leak.
Also- a doubt on the limitedmemoryHistory, I wasnt able to find documentation that mentions the upper or lower limits we could set for these optimizer algorithms, also if it was possible to pass parameters other than opensim actuators through the optimizer.
thanks again for your replies,
nithin
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: Optimizer error message
Nithin:
I'm a little confused by your latest response. I'm not sure if you are using "motion Prescriber" and "PrescribedController" refer to the same thing, since there is also a separate concept of "prescribed motion" in OpenSim and Simbody.
I'm also not sure why having more parameters in the optimization would increase the number of memory leaks; is this just because the optimizer would likely run for longer or that you're using a larger population size?
As for your question about upper/lower limits, could you rephrase? I'm not sure what you're asking.
I'm a little confused by your latest response. I'm not sure if you are using "motion Prescriber" and "PrescribedController" refer to the same thing, since there is also a separate concept of "prescribed motion" in OpenSim and Simbody.
I'm also not sure why having more parameters in the optimization would increase the number of memory leaks; is this just because the optimizer would likely run for longer or that you're using a larger population size?
As for your question about upper/lower limits, could you rephrase? I'm not sure what you're asking.
- Nithin Kurup
- Posts: 149
- Joined: Sat Jan 18, 2014 5:13 am
Re: Optimizer error message
Dear chris,
Really sorry for creating confusion, in my code I have prescribed a motion for a coordinate, and during each iteration I update the values. I understand that prescribed controller and motion prescriber are different concepts.
Chris, what I asked about the optimizer setting was that, we have these
eg.
opt.setMaxIterations(1000);
opt.setLimitedMemoryHistory(500);
Just wanted to know, what is the highest number of iterations we can provide or is 1000 iterations the highest setting for this optimizer or is it just a default value.
Another doubt about optimizer- Is it possible to pass parameters that are not opensim actuators for optimizing, ie, I have some shape parameters which I would like to optimize along with muscle excitations, but is it possible as most examples about optimization includes torque and muscle excitation.
Thanking you again and hope I havent caused more confusion.
Thanks
Really sorry for creating confusion, in my code I have prescribed a motion for a coordinate, and during each iteration I update the values. I understand that prescribed controller and motion prescriber are different concepts.
Chris, what I asked about the optimizer setting was that, we have these
eg.
opt.setMaxIterations(1000);
opt.setLimitedMemoryHistory(500);
Just wanted to know, what is the highest number of iterations we can provide or is 1000 iterations the highest setting for this optimizer or is it just a default value.
Another doubt about optimizer- Is it possible to pass parameters that are not opensim actuators for optimizing, ie, I have some shape parameters which I would like to optimize along with muscle excitations, but is it possible as most examples about optimization includes torque and muscle excitation.
Thanking you again and hope I havent caused more confusion.
Thanks