Skip to content

Commit

Permalink
Merge pull request #1555 from swryan/work
Browse files Browse the repository at this point in the history
consolidate multiple versions of TLDR example
  • Loading branch information
swryan committed Jul 24, 2020
2 parents 336d08f + 821d3a0 commit 78fb37e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 55 deletions.
2 changes: 1 addition & 1 deletion openmdao/docs/examples/tldr_paraboloid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Optimizing a Paraboloid -- The TL;DR Version
============================================

.. embed-code::
openmdao.test_suite.test_examples.tldr_paraboloid.TestParaboloidTLDR.test_tldr
openmdao.test_suite.test_examples.test_tldr_paraboloid.TestParaboloidTLDR.test_tldr
:layout: interleave
4 changes: 2 additions & 2 deletions openmdao/docs/getting_started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ With OpenMDAO installed, let's try out a simple example, to get you started runn
Copy the following code into a file named paraboloid_min.py:

.. embed-code::
openmdao.test_suite.test_examples.tldr_paraboloid.TestParaboloidTLDR.test_tldr
openmdao.test_suite.test_examples.test_tldr_paraboloid.TestParaboloidTLDR.test_tldr
:layout: code


Expand All @@ -45,6 +45,6 @@ If all works as planned, results should appear as such:


.. embed-code::
openmdao.test_suite.test_examples.tldr_paraboloid.TestParaboloidTLDR.test_tldr
openmdao.test_suite.test_examples.test_tldr_paraboloid.TestParaboloidTLDR.test_tldr
:layout: output

2 changes: 1 addition & 1 deletion openmdao/docs/other/citing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ If you copy the following script into a file called `paraboloid.py`,
then you can get the citations from the command line using the :ref:`openmdao command-line script<om-command>`.

.. embed-code::
openmdao.test_suite.test_examples.tldr_paraboloid.TestParaboloidTLDR.test_tldr
openmdao.test_suite.test_examples.test_tldr_paraboloid.TestParaboloidTLDR.test_tldr
:layout: code, output

.. embed-shell-cmd::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from openmdao.utils.assert_utils import assert_near_equal

# If the code in this test must be changed, please go change the
# sister example on the front page of the OpenMDAO website!

class TestParaboloidTLDR(unittest.TestCase):

Expand All @@ -27,14 +29,15 @@ def test_tldr(self):
prob.set_val('paraboloid.x', 3.0)
prob.set_val('paraboloid.y', -4.0)

# run the optimization
prob.run_driver()

# minimum value
assert_near_equal(prob['paraboloid.f'], -27.33333, 1e-6)
assert_near_equal(prob.get_val('paraboloid.f'), -27.33333, 1e-6)

# location of the minimum
assert_near_equal(prob['paraboloid.x'], 6.6667, 1e-4)
assert_near_equal(prob['paraboloid.y'], -7.33333, 1e-4)
assert_near_equal(prob.get_val('paraboloid.x'), 6.6667, 1e-4)
assert_near_equal(prob.get_val('paraboloid.y'), -7.33333, 1e-4)

if __name__ == "__main__":

Expand Down
48 changes: 0 additions & 48 deletions openmdao/test_suite/test_examples/test_tldr_paraboloid_b.py

This file was deleted.

0 comments on commit 78fb37e

Please sign in to comment.