I would like to perform a set of optimization studies. Is it possible to integrate an OptStudy into a ParamStudy? How is this done. I am unsure about the AnyDesMeasure and the role of AnyOutputFun from the Main.Study.

So what you want to do is several OptStudy in a sequence? I am right?
It is actually possible to include the OptStudy in the ParamStudy. So for each iteration of the ParamStudy the system runs a full optimization instead of just the InverseDynamic analysis.

To so you have to define a ParamStudy and an OptStudy. And in the ParamStudy.Analysis point to the optimization like this:

The AnyDesMeasure is the output of the parameter study. For the optimization study AnyDesMeasure is the function we want to minimize, and it is also the output once it as been minimized.
So you also have to make sure that the AnyDesMeasure of the parameter study is the pointing at the AnyDesMeasure of the optimization study.

There is an optimization tutorial on the web site www.anybodytech.com , it will show you how to set it up.

i understood that there must be a reference within the ParamStudy pointing to the OptStudy. But i am not sure how to handle the AnyDes Measure.

In the ParamStudy i would like to save several outputs, not just one as in the example of the tutorial. Therefore i created a vector containing all interesting results within the AnyBodyStudy. The optimization should be performed on a different result, namely on the MaxMuscleActivity. I could add this to the vector also.

To break my problem down, lets consider i just want to perform a ParamStudy. How can i save several results with the ParamStudy?
“Val” of AnyDesMeasure in the ParamStudy seems to have to be a one-dimensional vector. Correct? I would like to do “Val = <Folder>” or at least “Val=<vector>”.

When i want to assign a vector to Val i got the error:
‘=’ : Illegal operation for given argument types : ‘AnyFloat’ ‘=’ ‘AnyFloat[1]’

The problem how to combine OptStudies and ParamStudies is than probably also solved.

additional remark: I am aware of the fact that a scalar becomes a vector after an AnybodyStudy due to the number of timesteps. Therefore the problem description sounds a bit weird.

The value of the AnyDesMeasure has to be a single variable, that is right. No vectors.
But you can create as much AnyDesMeasure as you want in the parameter study. So if you want several outputs you have to create an AnyDesMeasure for each of them. Notice that it can’t be either a one dimensional vector (AnyFloat[1]). It must be of the type AnyVar.

It is a good remark that even the AnyVar becomes a vector because of the time steps. That is why the parameter study returns by default the value of the last time step. This is good for static analysis (single time step) but not always for dynamic. Usualy in this type of analysis we take the max or min of the value through time, depending on what we are interested in.

that works. Great. Thank you. But i do not need the AnyDesMeasure of the OptStudy in the ParamStudy (neither as reference nor directly). It would probably work without any AnyDesMeasure. Then comes the question how to output the results but for this i will open another thread.