Volume 10, Issue 1
Download This Issue
Staff and Contributors
Configuration Analysis and Design by Using Optimization Tools in Mathematica
Contact and Collision Problems
There are many situations in engineering analysis and design in which one would like to know whether two stationary objects are in contact or, if not, what the minimum distance is between them. Similarly, for moving objects, one may wish to know whether or not they collide, the collision time if they do, or the minimum distance if they do not.
If each object can be analytically described as a set of points satisfying certain constraints, then finding the minimum distance can be formulated as a minimization problem in which one minimizes the distance between two points, each constrained to be in one of the objects. If one is only interested in whether or not the objects are in contact, the problem can be solved by determining if there are any points that satisfy the constraints describing both objects.
Intersecting Stationary Objects
For a simple example of determining whether or not two stationary objects intersect, let us consider two triangles described by the following lists of constraints.
The points satisfying one or the other list of constraints can be shown using the InequalityPlot function. It is easily seen that the two triangles do intersect.
The shape of the intersection, when nonempty, can be easily produced by looking at points satisfying both lists of constraints.
We can use the Minimize function to determine some target extremal point of the intersection of the triangles. In the following example, we want to determine the location of the point with the smallest value (see the preceding plot).
Had the triangles not overlapped, there would have been no solution to the optimization model.
As another simple example, we can also determine the point in the intersection that has the maximal -norm (Manhattan) distance from the origin.
Nonintersecting Stationary Objects
To see an example of nonintersecting stationary objects, we modify triangle 1.
In this case, Minimize gives no solution, as there are no points that satisfy the constraints of both triangles.
Next, we shall take a nonlinear optimization model form to analyze the current configuration of the triangles. NMinimize can be used to find the shortest line joining the two triangles by minimizing the distance between two points and , with the first point constrained to be in triangle 1 and the second point constrained to be in triangle 2.
MathOptimizer can be used as well to handle this optimization model. Note that in order to use MathOptimizer, it is necessary to rewrite the inequalities in the form , and then give as input only a list of the left-hand side of the inequalities.
The shortest line can be shown superimposed on a plot of the triangles.
Analysis of Moving Objects
In the following example, we shall analyze the configuration of two objects, one of them moving along a trajectory given analytically. Let us define
Then Thread[sqr[x,y]≤0] defines a square with edge 1 centered on the origin.
Next, we define the rotation rot that rotates two-dimensional points clockwise by angle .
The function disp[dx,dy] displaces a point by .
Finally, newsqr[dx,dy,] takes variables x and y (specifically, denoting a point from the square), and rotates and displaces it back to the starting position so the original constraints can be applied.
The other object in our illustrative example is a static disk centered on the origin with radius 1/2.
Now, as a starting position, we center the square at , rotated clockwise by at and then have it move with velocity and rotate with angular velocity 0.3. At any time moment t, the position of the disk and the square can be plotted using the following function.
Note that the function p[t] can be used to generate a series of plots, which can be animated. Here are the initial object positions.
Now let us find the minimum distance between the square and the disk. First, we apply NMinimize and then MathOptimizer.
The minimum distance is (numerically very close to) 0, so the objects must have collided. A graph of the solution confirms that the square and disk had collided, actually by the earlier of the two times found. (As indicated by the plot, at tsoln the objects already overlap.)
Next, let us find the collision time by minimizing t with a point in the square constrained to be equal to a point in the disk. NMinimize and MathOptimizer give the same solution.
The next plot visually confirms that the solution found is a good numerical approximation of the collision time.
Obviously, these simple illustrative examples could be extended and modified to model issues of practical interest, for example, robot or machine movements in manufacturing and ergonomic contexts. Further related examples are discussed in .
About Mathematica | Download Mathematica Player
© Wolfram Media, Inc. All rights reserved.