Skip to content

Commit ec64bfc

Browse files
author
Rolf Johan Lorentzen
committed
Update for epf optimization
1 parent 91b24e8 commit ec64bfc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

popt/loop/optimize.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def __init__(self, **options):
102102
self.epf_iteration = 0
103103

104104
# Initialize variables (set in subclasses)
105+
# TODO: these variables should be abstract properties that subclasses are forced to define
105106
self.options = None
106107
self.mean_state = None
107108
self.obj_func_values = None
@@ -195,7 +196,7 @@ def run_loop(self):
195196
logger.info(f' -----> EPF-EnOpt: {self.epf_iteration}, {r} (outer iteration, penalty factor)') # print epf info
196197
else:
197198
logger.info(f' -----> EPF-EnOpt: converged, no variables changed more than {conv_crit*100} %') # print epf info
198-
final_obj_no_penalty = str(round(float(self.fun(self.mean_state)),4))
199+
final_obj_no_penalty = str(round(float(np.mean(self.fun(self.mean_state))),4))
199200
logger.info(f' -----> EPF-EnOpt: objective value without penalty = {final_obj_no_penalty}') # print epf info
200201

201202
def save(self):

popt/update_schemes/linesearch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ def _fun(self, x):
283283
self.nfev += 1
284284
x = ot.clip_state(x, self.bounds) # ensure bounds are respected
285285
if self.args is None:
286-
f = np.mean(self.function(x))
286+
f = np.mean(self.function(x, **self.epf))
287287
else:
288-
f = np.mean(self.function(x, *self.args))
288+
f = np.mean(self.function(x, *self.args, **self.epf))
289289
return f
290290

291291
def _jac(self, x):

0 commit comments

Comments
 (0)