Skip to content

Commit e675265

Browse files
committed
add missing metadata section
1 parent 7a51682 commit e675265

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

pyoptsparse/pyNSGA2/pyNSGA2.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""
55

66
# Standard Python modules
7+
import datetime
78
import os
89
import time
910

@@ -179,6 +180,12 @@ def objconfunc(nreal, nobj, ncon, x, f, g):
179180
# fmt: on
180181
optTime = time.time() - t0
181182

183+
if self.storeHistory:
184+
self.metadata["endTime"] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
185+
self.metadata["optTime"] = optTime
186+
self.hist.writeData("metadata", self.metadata)
187+
self.hist.close()
188+
182189
# Broadcast a -1 to indcate NSGA2 has finished
183190
self.optProb.comm.bcast(-1, root=0)
184191

tests/test_sphere.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ class TestSphere(OptTest):
5353
"seed": 1235,
5454
},
5555
"NSGA2": {
56-
"PopSize": 24,
57-
"maxGen": 150,
56+
"PopSize": 32,
57+
"maxGen": 100,
58+
"seed": 123,
5859
},
5960
"SNOPT": {
6061
"Major iterations limit": 10,

0 commit comments

Comments
 (0)