Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions epde/operators/common/fitness.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,9 @@ def apply(self, objective: SoEq, arguments: dict, force_out_of_place: bool = Fal
print(f'solution[..., eq_idx] {solution[..., eq_idx].shape}, eq_idx {eq_idx}')
referential_data = global_var.tensor_cache.get((eq.main_var_to_explain, (1.0,)))
discr = solution[..., eq_idx] - referential_data.reshape(solution[..., eq_idx].shape)
discr = np.multiply(discr, self.g_fun_vals.reshape(discr.shape)) / np.std(discr)
rl_error = np.sqrt(np.mean(discr ** 2))
discr = np.multiply(discr, self.g_fun_vals.reshape(discr.shape))
# rl_error = np.sqrt(np.mean(discr ** 2))
rl_error = np.sum(np.abs(discr)) / np.sum(np.abs(referential_data.reshape(solution[..., eq_idx].shape))) * 100

print(f'fitness error is {rl_error}, while loss addition is {float(loss_add)}')
lp = rl_error + self.params['pinn_loss_mult'] * float(
Expand Down
1 change: 0 additions & 1 deletion epde/operators/common/right_part_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def apply(self, objective : Equation, arguments : dict):
objective.reset_state(True)
min_fitness = np.inf
weights_internal = np.zeros_like(objective.structure)
objective.weights_internal_evald = False
min_idx = 0
if not any(term.contains_variable(objective.main_var_to_explain) and term.contains_deriv(objective.main_var_to_explain) for term in objective.structure):
objective.restore_property(mandatory_family=objective.main_var_to_explain, deriv=True)
Expand Down
2 changes: 1 addition & 1 deletion epde/operators/multiobjective/moeadd_specific.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def apply(self, objective : ParetoLevels, arguments : dict):
self.suboperators['chromosome_fitness'].apply(objective=candidate,
arguments=subop_args['chromosome_fitness'])
objective.history.add(system)
print(candidate.obj_fun)
# print(candidate.obj_fun)
objective.initial_placing()

# TODO: consider carefully, where normalizer init shall be held. If here, only the initial values are employed
Expand Down
6 changes: 4 additions & 2 deletions epde/supplementary.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ def minmax_normalize(matrix):
return 2 * (matrix - matrix.min()) / (matrix.max() - matrix.min()) - 1
else:
for i in np.arange(matrix.shape[0]):
matrix[i] = 2 * (matrix[i] - matrix[i].min()) / (matrix[i].max() - matrix[i].min()) - 1

if matrix[i].max() != matrix[i].min():
matrix[i] = 2 * (matrix[i] - matrix[i].min()) / (matrix[i].max() - matrix[i].min()) - 1
else:
matrix[i] = np.zeros_like(matrix[i])
return matrix