Sequence of AnyOptStudy

Hi,
I'm trying to run several optimization studies sequentially, but I need each one to complete before the next begins. This is necessary to resolve some positional constraints in a chain of segments.

The optimizations worksy when I manually run the Studies in the AnyBody GUI, but I haven’t found a way to automate their execution with a sequence command. This is currently a test model, and my goal is to implement the same approach for the full spine model (Thats why I would like to automate it)

Here is the setup for my test model:
TestModelOptimizeJntPos_TwoSegments.any (8.2 KB)

Can I run serveral Studies as a Sequence? Something like AnyOperationSequence with AnyPyTools or AnyBody?

Best
Viktoria

Hi Viktoria,

This is certainly possible. You are on the right track in using AnyOperationSequence and you are almost there with your script :slight_smile:
The only thing that needs to be fixed is that AnyOperationSequence looks for reference pointers to AnyOperation and derived. So you would need to change your code from:

  AnyOperationSequence RunOptimization = {
    AnyOptStudy &OptSeg1 = Main.OptimizeSeg1;
    AnyOptStudy &OptSeg2 = Main.OptimizeSeg2;
  };

to

  AnyOperationSequence RunOptimization = {
    AnyOperation &OptSeg1 = Main.OptimizeSeg1.Optimization;
    AnyOperation &OptSeg2 = Main.OptimizeSeg2.Optimization;
  };

Then, you run this operation either through AnyBody or through AnyPyTools.

Best regards,
Dave