Running a Constrained Optimization With Weights

You can assign weights to constraints to affect the geometry.

See Also
Optimization Editor
  1. Create a representation identical to the one below.

    This representation contains a triangle. The sides of the triangle are assigned parameters valuated by formulas.

    • f1: Distance between Point.1 and Point.3. It is valuated by Formula.1.

    • f2: Distance between Point.2 and Point.3. It is valuated by Formula.2.

    • l1: Distance between Point.1 and Point.3. It is valuated by Formula.3.

    • l2: Distance between Point.2 and Point.3. It is valuated by Formula.4.

    • A circle is created on top of the triangle which center is a projection of Point.3.

  2. From the Compass, click 3D Modeling Apps and select Design Optimization.
  3. Click Optimization .
  4. Define the data required to run the optimization algorithm as follows:
    In the Problem tab
    • From the Optimization type scrolling list, select the Only constraints option.

    • Click Edit list in the Free Parameters box. Use the arrow key to select the following parameters and click OK when done:

      GS\Point.3\X
      GS\Point.3\Z
    In the Constraints tab
    • Click New... to create a constraint and enter the following script into the editor: f1*f1==0.

    • Click OK when done.

    • Click New... to create a constraint and enter the following script into the editor: f2*f2==0.
    • Click OK when done. The constraints are defined.
    • Assign a weight to Constraint.1. To do so, click Constraint.1 in the table and enter 5 in the Weight box.
    • Set the precision value to 0.01.
  5. Click With visualization update and click Run optimization.
  6. Type the name of the representation that is going to contain the optimization data in the New dialog box (Constraintswithweights in this scenario), and click Save.
    • The Optimization message box displays the data for each iteration. Do not intervene on the algorithm process (i.e. don't click Stop at the next iteration) and let the optimization process execute until the target value is found out or one of the termination condition is reached.

    • The result appears in the Constraints tab.
    • The geometry is updated. The representation of Point.3 tends to the right.
    • Point.3 coordinates are updated in the tree.
  7. Assign a weight to Constraint.2. To do so, click Constraint.2 in the table and enter 10 in the Weight box.
  8. Click Run optimization. Click Yes when prompted to overwrite Constraintswithweights.
    • The result appears in the Constraints tab.

    • The geometry is updated. The representation of Point.3 tends to the left.
    • Point.3 coordinates are updated in the tree.
  9. Click the Computations results tab. The results are sorted in the Sorted results table .