Skip to content

Latest commit

 

History

History
57 lines (36 loc) · 1.57 KB

examples.rst

File metadata and controls

57 lines (36 loc) · 1.57 KB

Examples

iPython Notebook Examples

More examples, including some in-depth and experimental models, can be seen on nbviewer.

A Trivial GP

The most trivial GP we can think of: minimize x subject to the constraint x \ge 1.

.. literalinclude:: examples/x_greaterthan_1.py

Of course, the optimal value is 1. Output:

.. literalinclude:: examples/x_greaterthan_1_output.txt

Maximizing the Volume of a Box

This example comes from Section 2.4 of the GP tutorial, by S. Boyd et. al.

.. literalinclude:: examples/simple_box.py

The output is

.. literalinclude:: examples/simple_box_output.txt

Water Tank

Say we had a fixed mass of water we wanted to contain within a tank, but also wanted to minimize the cost of the material we had to purchase (i.e. the surface area of the tank):

.. literalinclude:: examples/water_tank.py

The output is

.. literalinclude:: examples/water_tank_output.txt

Simple Wing

This example comes from Section 3 of Geometric Programming for Aircraft Design Optimization, by W. Hoburg and P. Abbeel.

.. literalinclude:: examples/simple_wing.py

The output is

.. literalinclude:: examples/simple_wing_output.txt