Bottle Volume Optimization Example

Предыдущая страницаВ началоСледующая страница

This example clarifies use of optimization for 3D models. The file for the example is located in the library Examples\Additional resources\Optimization\Bottle.grb.

The example presents the solution to the bottle volume problem. In this example, the variable Volume is created, equal to the bottle capacity, that is, the volume of its contents. The variable H defines the height of the bottle, while HW – the level of the liquid in it. The optimization task is to maintain the constant bottle capacity (0.5 liter = 500000 mm3) while varying the bottle height and the level of the liquid in it. To achieve this goal, we need to find the value of the variable D driving the median diameter of the bottle (the widest portion diameter). The optimization task Volume was defined in the Optimize command as follows.

Optimization7

The target function equates the variable Volume to 500000 with the tolerance equal 1. The modifiable variable is D, in the range from 70 to 90. No additional conditions are imposed on the model variables; therefore, no restrictions are defined. To visualize the optimization process, the flags are turned on, Show current result and Recalculate 3D model. The dichotomy method is selected for the optimization algorithm, with the maximum number of iterations equal to 100. The parameter Run is set to the option User, so that the optimization is run only upon the user request.

After specifying the optimization task, let's modify the model. For example, let's reduce the bottle height and, respectively, the level of the liquid in it, by changing the values of the variables H and HW. This reduces the capacity of the bottle.

Optimization8

Optimization9

To adjust the bottle diameter, simply call the Optimize command, select the Volume task in the coming up dialog box and press the Run graphic button. The shape of the model will be changing on the screen according to the current values of the variable being optimized as the solution progresses.

Optimization10        

By accepting the found solution by pressing the button OK, we get the bottle 220 mm high and 0.5 liter in capacity.