Skip to content

deepcopy of SolverResults duplicates keys #3594

@rhshadrach-8451

Description

@rhshadrach-8451

Summary

When performing a deepcopy of SolverResults, they keys become duplicated.

Steps to reproduce the issue

import copy

import pyomo.environ as pyo

m = pyo.ConcreteModel()
m.a = pyo.Var(bounds=(0, 1))
m.b = pyo.Var(bounds=(0, 1))
m.obj = pyo.Objective(rule=m.a+m.b)

opt = pyo.SolverFactory('highs')
result = opt.solve(m)
print(result.keys())
# ['Problem', 'Solver', 'Solution', 'Timing info']

result2 = copy.deepcopy(result)
print(result2.keys())
# ['Problem', 'Solver', 'Solution', 'Timing info', 'Problem', 'Solver', 'Solution', 'Timing info']

Information on your system

Pyomo version: 6.9.2
Python version: 3.10.17
Operating system: Mac
How Pyomo was installed (PyPI, conda, source): PyPI
Solver (if applicable): NA

Additional information

I haven't throughly checked the remaining state of the copied SolverResults to see if there are any other issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions