Question about Simmath example in user guide
Posted: Mon Mar 08, 2010 8:58 am
Hi,
I tested an example of Simmath optimization.
But I think there are some problems in the example written in the user guide.
So after some modifications on the original code written in the user guide, I could get the proper result.
The class ‘OptimizerSystem’ has one default constructor and one overloaded constructor. But the overloaded constructor should take only one parameter value according to SimTKcore 2.0 doxygen documentation. But in the user guide the overloaded constructor of OptimizerSystem class takes two parameters. So at the end of the definition of class ‘ProblemSystem’, some modification may be applied like this:
ProblemSystem( const int numParams, const int numConstraints) :
OptimizerSystem( numParams ) {
setNumInequalityConstraints(numConstraints);
}
And ‘NUMBER_OF_PARAMETERS’ and ‘NUMBER_OF_CONSTRAINTS’ are not predetermined. In this example, these two values should be same as 2 because the parameters are x1 & x2 and the number of constraint equations is 2.
Here, I have an additional question.
When overriding ‘constraintFunc’ virtual function for ProblemSystem class inherited from OptimizerSystem class, users can put both equality constraint equations and inequality constraint equations. When inequality constraint equations are in form of ‘f(x)>=0’, then can I write this inequality constraint equation as ‘constraints[index]=f(x)’ in the constraintFunc function?
Thanks very much for reading this question and please help me get your advice.
Best regards,
Moonki
I tested an example of Simmath optimization.
But I think there are some problems in the example written in the user guide.
So after some modifications on the original code written in the user guide, I could get the proper result.
The class ‘OptimizerSystem’ has one default constructor and one overloaded constructor. But the overloaded constructor should take only one parameter value according to SimTKcore 2.0 doxygen documentation. But in the user guide the overloaded constructor of OptimizerSystem class takes two parameters. So at the end of the definition of class ‘ProblemSystem’, some modification may be applied like this:
ProblemSystem( const int numParams, const int numConstraints) :
OptimizerSystem( numParams ) {
setNumInequalityConstraints(numConstraints);
}
And ‘NUMBER_OF_PARAMETERS’ and ‘NUMBER_OF_CONSTRAINTS’ are not predetermined. In this example, these two values should be same as 2 because the parameters are x1 & x2 and the number of constraint equations is 2.
Here, I have an additional question.
When overriding ‘constraintFunc’ virtual function for ProblemSystem class inherited from OptimizerSystem class, users can put both equality constraint equations and inequality constraint equations. When inequality constraint equations are in form of ‘f(x)>=0’, then can I write this inequality constraint equation as ‘constraints[index]=f(x)’ in the constraintFunc function?
Thanks very much for reading this question and please help me get your advice.
Best regards,
Moonki