Skip to content

Commit

Permalink
Hacking t_legacy for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
1ozturkbe committed Sep 12, 2019
1 parent fbdaf43 commit e14c5f3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions robust/testing/t_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
import os

import unittest
from gpkit import Model
from gpkit.tests.helpers import run_tests
from gpkit.constraints.bounded import Bounded

from robust.testing.models import simple_wing
from robust.simulations import simulate
from robust.simulations import read_simulation_data

class TestLegacy(unittest.TestCase):
def test_simple_wing(self):
model = simple_wing()
model = Model(simple_wing().cost, Bounded(simple_wing()), simple_wing().substitutions)
number_of_time_average_solves = 3
number_of_iterations = 10
nominal_solution, nominal_solve_time, nominal_number_of_constraints, directly_uncertain_vars_subs = \
simulate.generate_model_properties(model, number_of_time_average_solves, number_of_iterations)
model_name = 'Simple Wing'
gammas = np.linspace(0, 0.75, 3)
model_name = 'Simple_Wing'
gammas = np.linspace(0.0, 1.0, 3)
min_num_of_linear_sections = 3
max_num_of_linear_sections = 99
linearization_tolerance = 1e-4
Expand All @@ -29,7 +31,8 @@ def test_simple_wing(self):
{'name': 'Two Term', 'twoTerm': False, 'boyd': True, 'simpleModel': False}]
uncertainty_sets = ['box', 'elliptical']

variable_gamma_file_name = os.path.dirname(__file__) + '/simulation_data_variable_gamma.txt'
variable_gamma_file_name = os.path.dirname(__file__) + '/' + \
model_name + '_simulation_data_variable_gamma.txt'
simulate.print_variable_gamma_results(model, model_name, gammas, number_of_iterations,
min_num_of_linear_sections,
max_num_of_linear_sections, verbosity, linearization_tolerance,
Expand All @@ -45,17 +48,17 @@ def test_simple_wing(self):
{'name': 'Two Term', 'twoTerm': False, 'boyd': True, 'simpleModel': False}]
uncertainty_sets = ['box', 'elliptical']

variable_pwl_file_name = os.path.dirname(__file__) + '/simulation_data_variable_pwl.txt'
variable_pwl_file_name = os.path.dirname(__file__) + '/' + \
model_name + '_simulation_data_variable_pwl.txt'
simulate.print_variable_pwlsections_results(model, model_name, gamma, number_of_iterations,
numbers_of_linear_sections, linearization_tolerance,
verbosity, variable_pwl_file_name,
number_of_time_average_solves, methods, uncertainty_sets,
nominal_solution, nominal_solve_time,
nominal_number_of_constraints, directly_uncertain_vars_subs)

file_path_gamma = os.path.dirname(__file__) + '/simulation_data_variable_gamma.txt'
file_path_pwl = os.path.dirname(__file__) + '/simulation_data_variable_pwl.txt'
read_simulation_data.generate_all_plots(file_path_gamma, file_path_pwl)
read_simulation_data.generate_all_plots(variable_gamma_file_name,
variable_pwl_file_name)

TESTS = [TestLegacy]

Expand Down

0 comments on commit e14c5f3

Please sign in to comment.