save original expression
This commit is contained in:
parent
c601e77cec
commit
7762758958
@ -116,8 +116,10 @@ class Parameter:
|
|||||||
self.namespace = None
|
self.namespace = None
|
||||||
self.eval_allowed = True
|
self.eval_allowed = True
|
||||||
self._expr = None
|
self._expr = None
|
||||||
|
self._expr_disp = None
|
||||||
|
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
|
self._expr_disp = value
|
||||||
value = _prepare_namespace_string(value)
|
value = _prepare_namespace_string(value)
|
||||||
self._expr = value
|
self._expr = value
|
||||||
self.var = False
|
self.var = False
|
||||||
@ -152,7 +154,7 @@ class Parameter:
|
|||||||
if self._expr is None:
|
if self._expr is None:
|
||||||
ret_string += ' (fixed)'
|
ret_string += ' (fixed)'
|
||||||
else:
|
else:
|
||||||
ret_string += f' (calc: {self._expr})'
|
ret_string += f' (calc: {self._expr_disp})'
|
||||||
|
|
||||||
return ret_string
|
return ret_string
|
||||||
|
|
||||||
@ -213,7 +215,7 @@ class Parameter:
|
|||||||
|
|
||||||
def copy(self) -> Parameter:
|
def copy(self) -> Parameter:
|
||||||
if self._expr:
|
if self._expr:
|
||||||
val = self._expr
|
val = self._expr_disp
|
||||||
else:
|
else:
|
||||||
val = self._value
|
val = self._value
|
||||||
para_copy = Parameter(name=self.name, value=val, var=self.var, lb=self.lb, ub=self.ub)
|
para_copy = Parameter(name=self.name, value=val, var=self.var, lb=self.lb, ub=self.ub)
|
||||||
|
Loading…
Reference in New Issue
Block a user