Skip to content

Commit

Permalink
Rename eps_eq -> eps_lineq
Browse files Browse the repository at this point in the history
  • Loading branch information
schmoelder committed Jun 29, 2024
1 parent 11df0fb commit fea0a12
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions CADETProcess/optimization/optimizationProblem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2380,7 +2380,7 @@ def add_linear_equality_constraint(self, opt_vars, lhs=1, beq=0, eps=0.0):
lineqcon['opt_vars'] = opt_vars
lineqcon['lhs'] = lhs
lineqcon['beq'] = beq
lineqcon['eps_eq'] = float(eps)
lineqcon['eps'] = float(eps)

self._linear_equality_constraints.append(lineqcon)

Expand Down Expand Up @@ -2539,15 +2539,15 @@ def beq_transformed(self):
return beq_t

@property
def eps_eq(self):
def eps_lineq(self):
"""np.array: Relaxation tolerance for linear equality constraints.
See Also
--------
add_linear_inequality_constraint
"""
return np.array([
lineqcon['eps_eq'] for lineqcon in self.linear_equality_constraints
lineqcon['eps'] for lineqcon in self.linear_equality_constraints
])

@untransforms
Expand Down Expand Up @@ -2595,7 +2595,7 @@ def check_linear_equality_constraints(self, x):
flag = True

lhs = self.evaluate_linear_equality_constraints(x)
if np.any(np.abs(lhs) > self.eps_eq):
if np.any(np.abs(lhs) > self.eps_lineq):
flag = False

return flag
Expand Down
4 changes: 2 additions & 2 deletions CADETProcess/optimization/scipyAdapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ def get_lineqcon_obj(self, optimization_problem):
if optimization_problem.n_linear_equality_constraints == 0:
return None

lb = optimization_problem.beq_transformed - optimization_problem.eps_eq
ub = optimization_problem.beq_transformed + optimization_problem.eps_eq
lb = optimization_problem.beq_transformed - optimization_problem.eps_lineq
ub = optimization_problem.beq_transformed + optimization_problem.eps_lineq

return optimize.LinearConstraint(
optimization_problem.Aeq_independent_transformed, lb, ub,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_optimization_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ def check_equality_constraints(X, problem, transformed_space=False):
evaluate_constraints = lambda x: Aeq.dot(x) - beq

lhs = np.array(list(map(evaluate_constraints, X)))
rhs = problem.eps_eq
rhs = problem.eps_lineq
CV = np.all(np.abs(lhs) <= rhs, axis=1)

return CV
Expand Down

0 comments on commit fea0a12

Please sign in to comment.