Specifications
250
Notice how the final objective function value is slightly higher than the previous optimization result. Notice
also how only the first iteration out of 7 provides significant improvement of the objective function. This step
brings the design value down into to the valley. The remaining iterations zigzags in the bottom of the valley
without being able to get up and out and without providing any visible improvement. Finally, the
convergence criterion is fulfilled. It can be mentioned that the convergence criterion requires both objective
and design changes to be small.
In the beginning of this lesson, we mentioned that the optimization problem formulation also handles
constraints. They can be used for all sorts of purposes. For instance we notice that the optimal solution is a
rather low saddle position, cf. the picture above. Suppose that for some reason, this position is too low. We,
therefore, want to ensure that the distance between the crank and the seat is not too small, for instance
larger than 0.66 m. This can be formulated very nicely as a constraint like this:
AnyDesMeasure Metab = {
Val = secint(..Study.Metabolism(),..Study.tArray);
Type = ObjectiveFun;
};
AnyDesMeasure SeatDist = {
Val = (.SaddleHeight.Val^2+.SaddlePos.Val^2)^0.5 - 0.66;
Type = GreaterThanZero;
};
Notice that constraints are defined as AnyDesMeasures of type LessThanZero or GreaterThanZero. In the
mathematical formulation of the optimization problem stated in the beginning of this lesson, we have only
less-than-or-equal-to constraints, but there is only a minus sign in difference of making a greater-than-or-
equal-to into a less-than-or-equal-to constraint. You can put this minus sign manually or you can use Type
= GreaterThanZero, which is equivalent. Notice that equality constraints are in principle also a possibility,
but currently the optimization solvers in AnyBody do not handle this type of constraints. Moreover, it is most
often possible to handle equality constraints by means of inequality constraints, because the objective
function's gradient will put pressure on the constraint from one side; thus, it is merely a matter of
determining the proper type of inequality constraint.
Notice also that the constraint is just an AnyDesMeasure, so anything you could conceivably use as an
objective function can also be a constraint. In this case, the constraint is a simple mathematical combination
of variables, but in general it can also be properties such as muscle forces, joint reactions, point locations,










