Mechanism Evaluation Function.

Version 1.0

In order to perform search in the space of possible designs we need an evaluation function (heuristic function) to estimate the quality of generated designs. We choose waited polynomial function since it is easy to compute and modify.

F() =  ki *fi()

Where F() is evaluation function, fi() one of the evaluation aspects and ki is weight assigned to this aspect. This form of evaluation function allows for easy addition and removal of evaluation aspects. Most of the aspects are tightly coupled which means that by adding components to the mechanism one can increase cargo space, but will increase cost at the same time. This property makes standard optimization techniques difficult to implement. Some aspects we would like to minimize or maximize, while others we want to bring into a certain range, or as close to given value as possible. Weights will have positive values for desired features, and negative values for undesired features. In this way weight of the "mechanism cost" aspect will be negative, since we are trying to minimize the cost, but weight on the "provided torque" aspect will be positive since we are trying to increase it. Precise values of the waits will be determined later by tuning the optimization process.

Following table demonstrates all evaluated aspects of the mechanism, their names, descriptions and do we want to increase or decrease this particular aspect.

# / Name / Description / Direction
1 / Weight / Represents total weight of the unloaded mechanism. / Decrease
2 / Price / Represents total manufacturing price of the mechanism. / Decrease
3 / Peaces / Represents total number of LEGO peaces composed into mechanism. / Decrease
4 / Wheels / This aspect describes all wheels characteristics. Does the mechanism have wheels and the number of them? Are they parallel to each other? How many of them can touch the ground? Distance between wheels. / Increase
# / Name / Description / Direction
5 / Dimensions / Describes how close the mechanism to the desired size in X-Y-Z space. This aspect is compound from evaluations for each axis. / As close as possible
6 / Torque / Describes torque generated on the wheels (if mechanism has any). / Increase
7 / Clearance / Describes distance between lowest point of the vehicle and the road. / Increase
8 / Mass Canter / Describes distance between mass center of the vehicle and the road. / Decrease
9 / Cargo Space / Describes size of the largest flat surface on top of the vehicle. / Increase
10 / Mechanical Strength / Describes the ability of the mechanism to resist against mechanical stress. / Increase
11 / Symmetry / Describes how symmetric mechanism is. / Increase

Description of every aspect of the evaluation function is provided below.

1. Weight. Represents total weight of the unloaded mechanism. Weight is the aspect we usually want to minimize. Each LEGO element has its predetermined weight. Weight of the mechanism will be computed by summarizing weights of all its components.

2. Price. Represents total manufacturing price of the mechanism. Price is the aspect we usually want to minimize. Each LEGO element and each type of connection has its predetermined price. Obviously price is not actually applicable to the LEGO connections, but we decided to associate some small price with each to bring our model closer to the real world where assembling a mechanism from parts can be an expensive operation. Price of the LEGO Peace is much higher than a price of LEGO connection. Price of the mechanism will be computed by summarizing prices of all its components and connections.

3. Peaces. Represents total number of LEGO peaces composed into mechanism. Peaces is the aspect we usually want to minimize. It will be computed by counting all LEGO elements in the mechanism.

4. Wheels. This aspect describes all wheels characteristics. This aspect is critical and most likely will have highest weight assigned to it. It is compound aspect and it also will be represented as function by coefficients. We will describe all of its components separately.

4.a. Does the mechanism have wheels? This component gives mechanisms with wheels competitive advantage over the mechanisms that do not have any. It will be assigned value 1 for the mechanisms with wheels and 0 for the mechanisms without wheels. It is the coefficient w on which the wheel evaluation function is multiplied. All other components will be evaluated only if mechanism has at least one wheel.


4.b The number of wheels mechanism has. This function N()should have a bias towards even numbers and should have a maximum around numbers 4 and 6. As a first guess we suggest following function:

4.c Are wheels parallel to each other? This component gives advantage to mechanisms with wheels in parallel plains. Wheels of the mechanism can be located in X-Z and Y-Z plains. In order to compute this coefficient p first we need to determine the maximum number of the parallel wheels. Coefficient is equal to maximum number of parallel wheels to total number of wheels ratio. It is the coefficient on which the wheels evaluation function is multiplied.

p = (Parallel Wheels) / (Total Wheels)

Note that the value of the p can alternate between 0.5 and 1.

4.d Are wheels touching the ground? This component gives advantage to mechanisms with wheels touching the ground. In order to compute this coefficient t first we need to determine at least three lowest points of the mechanism. These points actually touch the ground. Coefficient is equal to one plus the number of wheels touching the ground divided by the number of elements touching the ground.

t = 1 + (Wheels on Ground) / (Elements on Ground)

Note that the value of the t can alternate between 1 and 2.

This means that all wheels characteristics will be evaluated by formula.

W = w * (p*t*N())

5. Dimensions. Describes how close the mechanism to the desired size in X-Y-Z space. This aspect is sum of evaluations of square tolerance along each axis. It is equal to desired size minus actual size divided by desired size squared.

G = Gx + Gy + Gz

Gx = ((Desiredx- Actualx) / Desiredx)^2

Gy = ((Desiredy- Actualy) / Desiredy)^2

Gz = ((Desiredz- Actualz) / Desiredz)^2

Different weights may be assigned to the different dimensions if it is necessary.

Actual size in each dimension is computed by applying depth first search to the mechanism. Following scheme describes how it should be done in more detail.

  1. Select starting Element other than wheel.
  2. Set Current Low to 0, and Current High to the Element size in the given dimension.
  3. Set Lowest to Current Low, Highest to Current High.
  4. Mark this Element as processed.
  5. Generate the list of all unprocessed Elements connected to this one (Ignore Gear to Gear connections).
  6. For each Element on the list
  7. Compute Element Low and Element High in each dimension by using appropriate formula from the table

(Terminology:

Current Low– lover coordinate of the parent Element in selected dimension known up front.

Current High– higher coordinate of the parent Element in selected dimension known up front.

Element Low– lover coordinate of the Element under investigation in selected dimension.

Element High– higher coordinate of the Element under investigation in selected dimension.

Element Size– the size of the Element under investigation in selected dimension.

Current Peg– peg number in selected dimension on the parent Element from any PegPare in the Snap connection.

Element Peg– peg number in selected dimension on the Element under investigation from the same PegPare in the Snap connection.

Hole Number– number of Hole in which Axleis inserted. First Parameter of the Insert connection.

Radius– Radius of the Wheel or Gear.

Axle Connect– distance from the point of origin of an Axleto the connection in LEGO peg units. Second Parameter of the Insert connection. )

Connection /

Axis

/

Formula

Snap (pointing from) / X / Element Lowx = Current Lowx + Current Pegx – Element Pegx
Element Highx = Current Lowx + Current Pegx – Element Pegx + Element Sizex
Snap (pointing to) / X / Element Lowx = Current Lowx + Current Pegx – Element Pegx + Current Pegx
Element Highx = Current Lowx + Current Pegx – Element Pegx + Element Sizex
Insert (Brick to Axle) / X / Element Lowx = iif ( Parallel (Element, X), (Current Lowx – Axle Connectx), (Current Lowx + Hole Numberx))
Element Highx = iif ( Parallel (Element, X), (Current Lowx – Axle Connectx + Element Sizex), (Current Lowx + Hole Numberx))
Insert (Axle to Brick) / X / Element Lowx = iif ( Parallel (Element, X), (Current Lowx – Hole Numberx), (Current Lowx + Axle Connectx))
Element Highx = iif ( Parallel (Element, X), (Current Lowx –Hole Numberx +Element Sizex), (Current Lowx + Axle Connectx))
TInsert / X / Element Lowx = iif ( Parallel (Current, X), (Current Lowx + Axle Connectx), Current Lowx – Radius)
Element Lowx = iif ( Parallel (Current, X), (Current Lowx + Axle Connectx), Current Lowx + Radius)
Snap (pointing from) / Y / Element Lowy = Current Lowy + Current Pegy – Element Pegy
Element Highy = Current Lowy + Current Pegy – Element Pegy + Element Sizey
Snap (pointing to) / Y / Element Lowy = Current Lowy + Current Pegy – Element Pegy
Element Highy = Current Lowy + Current Pegy – Element Pegy + Element Sizey
Insert (Brick to Axle) / Y / Element Lowy = iif ( Parallel (Element, Y), (Current Lowy – Axle Connecty), (Current Lowy + Hole Numbery))
Element Highx = iif ( Parallel (Element, Y), (Current Lowy – Axle Connecty + Element Sizey), ), (Current Lowy + Hole Numbery))
Insert (Axle to Brick) / Y / Element Lowy = iif ( Parallel (Element, Y), (Current Lowy – Hole Numbery), (Current Lowy + Axle Connecty))
Element Highx = iif ( Parallel (Element, Y), (Current Lowy –Hole Numbery +Element Sizey), Current Lowy + Axle Connecty))
TInsert / Y / Element Lowy = iif ( Parallel (Current, Y), (Current Lowy + Axle Connecty), Current Lowy – Radius)
Element Lowy = iif ( Parallel (Current, Y), (Current Lowy + Axle Connecty), Current Lowy + Radius)
Snap (pointing from) / Z / Element Lowz = Current Highz
Element Highz = Current Highz + Element Sizez
Snap (pointing to) / Z / Element Lowz = Current Lowz - Element Sizez
Element Highz = Current Lowz
Insert (Brick to Axle) / Z / Element Lowz = Current Lowz
Element Highz = Current Highz
Insert (Axle to Brick) / Z / Element Lowz = Current Lowz
Element Highz = Current Highz
TInsert / Z / Element Lowy = Current Lowz – Radius
Element Lowy = Current Lowz + Radius
GTrans / Z / Gear to Gear connections can be ignored for this calculation.
  1. Update Lowest and Highest if necessary.
  2. Mark this Element as processed.
  3. Generate the list of all unprocessed Elements connected to this one and upped it to the beginning of the original list.
  4. Continue to step 6 until list is empty.

All other evaluation aspects will be added later, if necessery.