More examples, including some with in-depth explanations and interactive visualizations, can be seen on nbviewer.
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
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
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
This example comes from Section 3 of Geometric Programming for Aircraft Design Optimization, by W. Hoburg and P. Abbeel.
.. literalinclude:: examples/simpleflight.py
The output is:
.. literalinclude:: examples/simpleflight_output.txt
In this example we consider a beam subjected to a uniformly distributed transverse force along its length. The beam has fixed geometry so we are not optimizing its shape, rather we are simply solving a discretization of the Euler-Bernoulli beam bending equations using GP.
.. literalinclude:: examples/beam.py
The output is:
.. literalinclude:: examples/beam_output.txt
By plotting the deflection, we can see that the agreement between the analytical solution and the GP solution is good.