Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMPL solver duplicate funcadd fix #3206

Merged
merged 12 commits into from
Apr 9, 2024
5 changes: 4 additions & 1 deletion pyomo/solvers/plugins/solvers/ASL.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ def create_command_line(self, executable, problem_files):
#
if 'PYOMO_AMPLFUNC' in env:
if 'AMPLFUNC' in env:
env['AMPLFUNC'] += "\n" + env['PYOMO_AMPLFUNC']
existing = set(env['AMPLFUNC'].split("\n"))
for line in env['PYOMO_AMPLFUNC'].split('\n'):
if line not in existing:
env['AMPLFUNC'] += "\n" + line
else:
env['AMPLFUNC'] = env['PYOMO_AMPLFUNC']

Expand Down
5 changes: 4 additions & 1 deletion pyomo/solvers/plugins/solvers/IPOPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ def create_command_line(self, executable, problem_files):
#
if 'PYOMO_AMPLFUNC' in env:
if 'AMPLFUNC' in env:
env['AMPLFUNC'] += "\n" + env['PYOMO_AMPLFUNC']
existing = set(env['AMPLFUNC'].split("\n"))
for line in env['PYOMO_AMPLFUNC'].split('\n'):
if line not in existing:
env['AMPLFUNC'] += "\n" + line
else:
env['AMPLFUNC'] = env['PYOMO_AMPLFUNC']

Expand Down
Loading