i am trying to figure out how to systematically minimize the distance between two nodes in space using the AnyOptKin study. Therefore i created the small example attached to this post.

The first node is called Marker0, located in the origin of the global reference frame.
The second node is called Marker1, initially located at x = 0.1, y = 0.1 and z = 0.

I am trying to use the AnyOptKin study to change the x and y position of Marker1 in the range of min = -0.05, max = 0.05 to minimize its distance to Marker0.

The AnyDesVariables are PosXPointM1 and PosYPointM1.
The AnyDesMeasure is DistanceM0toM1

Right now, i am not quite sure if this is the right way to procede.

This study can be used to minimize errors on soft kinematic constraints, by e.g. moving a joint location to provide a better fit on markers. So the objective function is implicit built into this study, and it is to minimize the sum of all errors on soft kinematic constraints. The problem is that you model has one segment and no soft kin constraints.

This is a general optimization, and you can decide the objective function it is not implicit defined.

So in short:

AnyKinOptStudy: used for optimizing paramters which will minimize errors on soft kinematic constraints
*AnyOptStudy: used for general purpose optimization the objetive function can be any output from the model either kinematics or kinetics.

I assume that what you are still working on is the scapula mechanism scaling as we talked about?

For that problem, the AnyOptKinStudy is the correct one to use, but the setup you have made here is not. What you specified here requires an AnyOptStudy as Søren mentions. What I think you need is to make the AnyKinPLine between marker 0 and 1 into an AnyKinLinear (to not only look at the distance between points but all three vector components), set that measure to Soft for all three directions and minimize that least-square error over all frames with the AnyOptKinStudy. You also have to use that linear kinematic measure in a driver in your model that you minimise the errors on.

Notice also that that study does not take inequalities (your -0.05 to 0.05) into account and was never build for that either.