Skip to content

Commit

Permalink
update constraint tolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedongPeng committed May 18, 2024
1 parent 582f634 commit 6c8927a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions pyomo/contrib/mindtpy/cut_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def add_oa_cuts(
constr.has_ub()
and (
linearize_active
and abs(constr.uslack()) < config.zero_tolerance
and abs(constr.uslack()) < config.constraint_tolerance
)
or (linearize_violated and constr.uslack() < 0)
or (config.linearize_inactive and constr.uslack() > 0)
Expand Down Expand Up @@ -147,7 +147,7 @@ def add_oa_cuts(
constr.has_lb()
and (
linearize_active
and abs(constr.lslack()) < config.zero_tolerance
and abs(constr.lslack()) < config.constraint_tolerance
)
or (linearize_violated and constr.lslack() < 0)
or (config.linearize_inactive and constr.lslack() > 0)
Expand Down
4 changes: 2 additions & 2 deletions pyomo/contrib/mindtpy/single_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def add_lazy_oa_cuts(
constr.has_ub()
and (
linearize_active
and abs(constr.uslack()) < config.zero_tolerance
and abs(constr.uslack()) < config.constraint_tolerance
)
or (linearize_violated and constr.uslack() < 0)
or (config.linearize_inactive and constr.uslack() > 0)
Expand Down Expand Up @@ -201,7 +201,7 @@ def add_lazy_oa_cuts(
constr.has_lb()
and (
linearize_active
and abs(constr.lslack()) < config.zero_tolerance
and abs(constr.lslack()) < config.constraint_tolerance
)
or (linearize_violated and constr.lslack() < 0)
or (config.linearize_inactive and constr.lslack() > 0)
Expand Down
14 changes: 7 additions & 7 deletions pyomo/contrib/mindtpy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,11 @@ def set_solver_constraint_violation_tolerance(
The specific configurations for MindtPy.
"""
if solver_name == 'baron':
opt.options['AbsConFeasTol'] = config.zero_tolerance
opt.options['AbsConFeasTol'] = config.constraint_tolerance
elif solver_name in {'ipopt', 'appsi_ipopt'}:
opt.options['constr_viol_tol'] = config.zero_tolerance
opt.options['constr_viol_tol'] = config.constraint_tolerance
elif solver_name == 'cyipopt':
opt.config.options['constr_viol_tol'] = config.zero_tolerance
opt.config.options['constr_viol_tol'] = config.constraint_tolerance
elif solver_name == 'gams':
if config.nlp_solver_args['solver'] in {
'ipopt',
Expand All @@ -600,7 +600,7 @@ def set_solver_constraint_violation_tolerance(
)
if config.nlp_solver_args['solver'] in {'ipopt', 'ipopth'}:
opt.options['add_options'].append(
'constr_viol_tol ' + str(config.zero_tolerance)
'constr_viol_tol ' + str(config.constraint_tolerance)
)
if warm_start:
# Ipopt warmstart options
Expand All @@ -614,15 +614,15 @@ def set_solver_constraint_violation_tolerance(
)
elif config.nlp_solver_args['solver'] == 'conopt':
opt.options['add_options'].append(
'RTNWMA ' + str(config.zero_tolerance)
'RTNWMA ' + str(config.constraint_tolerance)
)
elif config.nlp_solver_args['solver'] == 'msnlp':
opt.options['add_options'].append(
'feasibility_tolerance ' + str(config.zero_tolerance)
'feasibility_tolerance ' + str(config.constraint_tolerance)
)
elif config.nlp_solver_args['solver'] == 'baron':
opt.options['add_options'].append(
'AbsConFeasTol ' + str(config.zero_tolerance)
'AbsConFeasTol ' + str(config.constraint_tolerance)
)
opt.options['add_options'].append('$offecho')

Expand Down

0 comments on commit 6c8927a

Please sign in to comment.