Products & Services Solutions Academia Support User Community Company

Learn more about Model-Based Calibration   

Applying Constraints

How to Apply Constraints

In many cases designs might not coincide with the operating region of the system to be tested. For example, an automobile engine normally does not operate in a region of low speed (n) and high exhaust gas recirculation (EGR). You cannot run 15% EGR at 1000 RPM. There is no point selecting design points in impractical regions, so you can constrain the candidate set for test point generation.

Designs can have any number of geometric constraints placed upon them. Each constraint can be one of four types: an ellipsoid, a hyperplane, a 1-D lookup table, or a 2-D lookup table.

To add a constraint to a design:

  1. Select Edit > Constraints from the Design Editor menus.

  2. The Constraints Manager dialog box appears.

The example shows the Constraints Manager dialog box. Here you can add new constraints, and you can delete, edit, duplicate or negate existing constraints. Use the NOT button to negate a constraint, for example if you want to constrain points to be outside a boundary model.

If there are no constraints yet, the Constraints Manager is empty and you can only click Add to construct a new constraint.

To construct a new constraint,

  1. Click Add.

  2. The Constraint Editor dialog box with available constraints appears. You can select the following from the Constraint Type drop-down menu: Linear, Ellipsoid, 1-D Table and 2-Table. See the next section, Constraint Types.

  3. After defining any constraint, click OK. Your new constraint appears in the Constraint Manager list box. Click OK to return to the Design Editor, or Add to define more constraints.

A dialog box appears if there are points in the design that fall outside your newly constrained candidate set. You can simply continue (delete them) or cancel the constraint. Fixed points are not removed by this process. For optimal designs you can also replace them with new random points within the new candidate set, as shown in the preceding example figure.

To view constraints in the Design Editor:

  1. Right-click the Design Editor display pane to reach the context menu.

  2. Select Current > View > 3D Constraints. (You can also select 2-D constraints view). See the following figure for an example.

These views are intended to give some idea of the region of space that is currently available within the constraint boundaries.

Constraint Types

1-D Table Constraints

1-D table constraints limit the maximum or minimum setting of one factor as a function of another factor. Linear interpolation between user-defined points is used to specify the constraint. You can use the Table Editor tab or the Graphical Editor tab to define the constraint.

Linear Constraints

You specify the coefficients of the equation for an (N-1) dimensional hyperplane in the N-factor space. The form of the equation is A.x = b where A is your defined coefficient vector, x is the vector of values of the factor(s) to be constrained, and b is a scalar. For example,

In two dimensions: A=(1, 2), x=(L, A), b=3

Then A.x = b expands to

1*L + 2*A = 3

Rearranging this, you can write it as

A = -L/2 + 3/2

which corresponds to the traditional equation of a 2-D straight line, y = mx + c, with m = -1/2 and c = 3/2. A.x = b is thus the higher dimensional extension of this equation.

The linear constraints work by selecting the region below the defined plane (that is, A.x <= b). To select a region above the plane, multiply all your values by -1: A -> -A, b -> -b.

For example, to select a simple plane where SPK<50 as a constraint boundary, enter 1 next to SPK and 50 next to b. You can set all the other factors to 0 (or you can remove them on the Inputs tab if you are constraining an optimization).

Ellipsoid Constraints

The ellipsoid constraint allows you to define an N-dimensional ellipsoid. You can specify the center of the ellipsoid, the length of each axis, and the rotation of the ellipsoid.

Ellipsoid center.   You can specify the center of the ellipsoid by entering values in the Center point columns. These are the values, in natural units, that mark where you want the ellipsoid to be centered in each of the factor dimensions. The defaults are the midpoint of each factor range.

Axis length.   You specify the size of the ellipsoid by entering values along the diagonal of the matrix. The default values create an ellipsoid that touches the edge of the space in each of the factor dimensions. In general, for an entry value X in the diagonal, the ellipsoid size in that factor is 1/sqrt(X).

If you want a radius of r in a factor, enter 1/(r^2). For example, if you want to restrict N to a radius of 2000 from the center point, enter 1/2000^2= 2.5e-7, as shown in the example below.

Enter a zero in the diagonal to not constrain with respect to that factor.

Rotation.   The matrix entries that are not on the main diagonal control rotation of the ellipsoid.

The following example shows a defined ellipsoid constraint.

You must enter values in the table to define the ellipsoid. If you leave the values at the defaults, the candidate set is a sphere.

In this example, entering 2.5e-7 in the ENGSPEED diagonal restricts that axis to 1/sqrt(2.5e-7) = 2000. Entering zero in the INTCAM diagonal leaves INTCAM unconstrained (that is, the constraint is a cylinder extending to the ends of the INTCAM factor range). The ellipse is not rotated as the non-diagonal matrix entries are all zero.

A 3-D display to show the shape of this example constraint in the Design Editor can be seen below.

2-D Table Constraints

2-D table constraints are an extension of the 1-D table. Constraint boundary values for a factor are specified over a 2-D grid of two other factors.

The constraint boundary between the defined grid points is calculated using bilinear interpolation.

See also 1-D Table Constraints

Importing Constraints

Select File > Import Constraints. The Import Constraints dialog box appears, as shown in the following example.

Here you can import constraints for the currently selected design from

  1. If importing from a file you can type the filename in the edit box or use the browse button to locate the file.

  2. Click to select constraints in the Available Constraints list, or Ctrl+click to select multiple constraints.

  3. Click OK to import and apply the constraints.

    If importing boundary constraints a dialog box appears (once for each constraint) where you can match up factor names.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS