Skip to content

Commit

Permalink
Fixing table diffs.
Browse files Browse the repository at this point in the history
  • Loading branch information
1ozturkbe committed Sep 24, 2019
1 parent 96312f6 commit c03b07b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
28 changes: 14 additions & 14 deletions robust/testing/diffs/test_table.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
L/D & 17.0 & 15.4 & 17.0 & 17.8
A & 8.91 & 6.24 & 6.4 & 7.58
Re & 5010000.0 & 6940000.0 & 7290000.0 & 6360000.0
S & 28.2 & 81.5 & 79.7 & 66.4
V & 57.7 & 40.9 & 42.3 & 44.0
t_s & 14.4 & 20.4 & 19.7 & 18.9
W_w & 2360.0 & 6960.0 & 7040.0 & 5890.0
W_{w_{strc}} & 670.0 & 1580.0 & 1750.0 & 1490.0
W_{w_{surf}} & 1690.0 & 5380.0 & 5290.0 & 4410.0
W_{fuse} & 350.0 & 414.0 & 435.0 & 420.0
V_{f_{avail}} & 0.15 & 0.274 & 0.28 & 0.246
V_{f_{fuse}} & 6.65e-10 & 7.82e-10 & 4.68e-10 & 3.52e-10
V_{f_{wing}} & 0.18 & 0.954 & 0.916 & 0.64
cost & 2933.499 & 4640.654 & 4609.423 & 4247.673
L/D & 17.0 & 16.0 & 17.0 & 17.0
A & 8.9 & 7.5 & 7.7 & 8.3
Re & 5000000.0 & 5800000.0 & 5900000.0 & 5600000.0
S & 28.0 & 46.0 & 46.0 & 42.0
V & 58.0 & 49.0 & 50.0 & 51.0
t_s & 14.0 & 17.0 & 17.0 & 16.0
W_w & 2400.0 & 3900.0 & 4000.0 & 3700.0
W_{w_{strc}} & 670.0 & 1000.0 & 1100.0 & 990.0
W_{w_{surf}} & 1700.0 & 2900.0 & 2900.0 & 2700.0
W_{fuse} & 350.0 & 380.0 & 390.0 & 400.0
V_{f_{avail}} & 0.15 & 0.19 & 0.2 & 0.19
V_{f_{fuse}} & 6.6e-10 & 2.7e-10 & 5.6e-10 & 1e-09
V_{f_{wing}} & 0.18 & 0.38 & 0.38 & 0.33
cost & 2933.499 & 3598.235 & 3589.81 & 3481.407
15 changes: 8 additions & 7 deletions robust/testing/t_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_simulate(self):
model = simple_ac()
model.cost = model['c']
number_of_time_average_solves = 3
number_of_iterations = 20
number_of_iterations = 10
uncertainty_sets = ['elliptical']
methods = [{'name': 'Best Pairs', 'twoTerm': True, 'boyd': False, 'simpleModel': False}]
nGammas = 3
Expand Down Expand Up @@ -56,15 +56,16 @@ def test_table_diff(self):
m = simple_ac()
m.cost = m['c']
sol = m.localsolve(verbosity=0)
gamma = 0.5

# Model with margins
mm = MarginModel(m)
mm = MarginModel(m, gamma=gamma)
msol = mm.localsolve(verbosity=0)
# Model with box uncertainty
bm = RobustModel(m, 'box', twoTerm = True, boyd = False, simpleModel = False)
bm = RobustModel(m, 'box', gamma=gamma, twoTerm = True, boyd = False, simpleModel = False)
bsol = bm.robustsolve(verbosity=0)
# Model with elliptical uncertainty
em = RobustModel(m, 'elliptical', twoTerm = True, boyd = False, simpleModel = False)
em = RobustModel(m, 'elliptical', gamma=gamma, twoTerm = True, boyd = False, simpleModel = False)
esol = em.robustsolve(verbosity=0)

soltab = [sol, msol, bsol, esol]
Expand All @@ -82,10 +83,10 @@ def test_table_diff(self):
a = [mag(np.sum(s(i))) for s in soltab]
else:
a = [mag(s(i)) for s in soltab]
f.write(''.join([" & " + str(round_sig(j,3)) for j in a]))
f.write(''.join([" & " + str(round_sig(j,2)) for j in a]))
f.write('\n')
f.write('cost')
f.write(' '.join([" & " + str(i['cost']) for i in soltab]))
f.write('cost ')
f.write(' '.join(["& " + str(i['cost']) for i in soltab]))
f.write('\n')
f.close()

Expand Down

0 comments on commit c03b07b

Please sign in to comment.