Skip to content

Commit

Permalink
Store copies of the parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFP committed Nov 30, 2023
1 parent b09cb94 commit 484a19a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions optimas/generators/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations
import os
from copy import deepcopy
from typing import List, Dict, Optional, Union

import numpy as np
Expand Down Expand Up @@ -87,8 +88,10 @@ def __init__(
) -> None:
if objectives is None:
objectives = [Objective()]
self._varying_parameters = varying_parameters
self._objectives = objectives
# Store copies to prevent unexpected behavior if parameters are changed
# externally.
self._varying_parameters = deepcopy(varying_parameters)
self._objectives = deepcopy(objectives)
self._constraints = constraints
self._analyzed_parameters = (
[] if analyzed_parameters is None else analyzed_parameters
Expand Down

0 comments on commit 484a19a

Please sign in to comment.