# Using Constraints

In the scenario developed below, the simulated annealing algorithm is used with constraints and without objective function to search for a set of xA, xB, yA and yB parameters so that the inertia axis of the pad remains within an area defined by two circles.
Here are the circle definitions as they are specified as constraints in the scenario below:
Y**2 + Z**2 < 8100mm2
Y**2 + Z**2 < 1000mm2

When you are finished with this part of the scenario, the gradient algorithm is used to find a set of xA, xB, yA and yB so that the distance of the inertia axis to the origin is minimum. This second part of the scenario requires that the constraints are fulfilled.

Note that it is possible to use constraints without objective (Simulated Annealing only) or with objective (available for both algorithms.)

1. Open the KwoGettingStarted.CATPart document. This document is a pad extruded from a spline. The relations defined in this document allow you to specify the position of an inertia axis.

2. From the Start > Knowledgeware menu, access the Product Engineering Optimizer workbench and click the Optimization icon (). The optimization dialog box is displayed.

3. Select the Only constraints optimization type.

4. Click Edit list to select the following free parameters below:
xA, xB, yA, yB. Don't select any optimized parameter. Click OK.

5. Select the Simulated Annealing Algorithm in the algorithms list.

6. In the Constraints tab, click New... to enter the constraint below
Y**2 + Z**2 > 8100mm2

7. Click OK in the Optimization Constraints Editor, then click New... again to enter the second constraint:
Y**2 + Z**2 < 10000mm2

8. Click Run optimization.
After the optimization has finished running, you obtain a pad whose inertia axis is located in an area delimited by the two circles specified. Take a look at the Constraints tab. The constraints are all fulfilled. You can now start a gradient algorithm to search for the minimum value of the Rad parameter.

9. In the Problem tab, select:

 Minimization as the optimization type. Rad as the parameter to be optimized (click Select...) and choose the Gradient Algorithm With Constraint(s). Don't modify the free parameters.
10. Click Run optimization to run the optimization with the default termination criteria.  After the optimization has finished running, the minimum value of Rad is closed to 90mm. You have found a set of xA, xB, yA, yB value so that the inertia axis of the pad is located almost on the circle defined by the relation below:
Y**2 + Z**2 = 8100mm2