Skip to content

Commit

Permalink
Brach example fix (#66)
Browse files Browse the repository at this point in the history
* removed singularity from initial guess in brachistochrone example.  added more tests

* version 0.9.1 -> 0.9.2
  • Loading branch information
robfalck authored Jul 30, 2018
1 parent e471cd9 commit 0499208
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.9.1
current_version = 0.9.2
commit = False
tag = False

Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
# built documents.
#
# The short X.Y version.
version = u'0.9.1'
version = u'0.9.2'
# The full version, including alpha/beta/rc tags.
release = version

Expand Down
2 changes: 1 addition & 1 deletion dymos/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import print_function, division, absolute_import

__version__ = '0.9.1'
__version__ = '0.9.2'

from .ode_options import ODEOptions, declare_time, declare_state, declare_parameter
from .phases.phase_factory import Phase
Expand Down
4 changes: 2 additions & 2 deletions dymos/examples/brachistochrone/ex_brachistochrone.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from dymos import Phase
from dymos.examples.brachistochrone.brachistochrone_ode import BrachistochroneODE

OPTIMIZER = 'SlSQP'
OPTIMIZER = 'SLSQP'
SHOW_PLOTS = True


Expand Down Expand Up @@ -64,7 +64,7 @@ def brachistochrone_min_time(
p['phase0.states:x'] = phase.interpolate(ys=[0, 10], nodes='state_input')
p['phase0.states:y'] = phase.interpolate(ys=[10, 5], nodes='state_input')
p['phase0.states:v'] = phase.interpolate(ys=[0, 9.9], nodes='state_input')
p['phase0.controls:theta'] = phase.interpolate(ys=[0, 100], nodes='control_input')
p['phase0.controls:theta'] = phase.interpolate(ys=[5, 100], nodes='control_input')
p['phase0.design_parameters:g'] = 9.80665

p.run_model()
Expand Down
33 changes: 26 additions & 7 deletions dymos/examples/brachistochrone/test/test_ex_brachistochrone.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def tearDownClass(cls):
if os.path.exists(filename):
os.remove(filename)

def run_asserts(self, p, transcription):
def run_asserts(self, p):
t_initial = p.model.phase0.get_values('time')[0]
tf = p.model.phase0.get_values('time')[-1]

Expand Down Expand Up @@ -51,11 +51,30 @@ def run_asserts(self, p, transcription):

assert_almost_equal(thetaf, 100.12, decimal=0)

@parameterized.expand(product(
['gauss-lobatto', 'radau-ps'],
))
def test_ex_brachistochrone(self, transcription='radau-ps'):
def test_ex_brachistochrone_radau_compressed(self):
ex_brachistochrone.SHOW_PLOTS = True
p = ex_brachistochrone.brachistochrone_min_time(transcription=transcription)
self.run_asserts(p, transcription)
p = ex_brachistochrone.brachistochrone_min_time(transcription='radau-ps',
compressed=True)
self.run_asserts(p)
self.tearDown()

def test_ex_brachistochrone_radau_uncompressed(self):
ex_brachistochrone.SHOW_PLOTS = True
p = ex_brachistochrone.brachistochrone_min_time(transcription='radau-ps',
compressed=False)
self.run_asserts(p)
self.tearDown()

def test_ex_brachistochrone_gl_compressed(self):
ex_brachistochrone.SHOW_PLOTS = True
p = ex_brachistochrone.brachistochrone_min_time(transcription='gauss-lobatto',
compressed=True)
self.run_asserts(p)
self.tearDown()

def test_ex_brachistochrone_gl_uncompressed(self):
ex_brachistochrone.SHOW_PLOTS = True
p = ex_brachistochrone.brachistochrone_min_time(transcription='gauss-lobatto',
compressed=False)
self.run_asserts(p)
self.tearDown()
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


setup(name='dymos',
version='0.9.1',
version='0.9.2',
description='Open-Source Optimization of Dynamic Multidiscplinary Systems',
url='https://github.com/OpenMDAO/dymos',
classifiers=[
Expand Down

0 comments on commit 0499208

Please sign in to comment.