Skip to content

Mismatch: OptSolver versus set_results_format #3336

@sstroemer

Description

@sstroemer

Summary

The set_results_format function checks against _valid_results_formats, while the attribute in OptSolver is called _valid_result_formats. Not sure if singular/plural is better since I assume it could be both results as well as (a) result, but the respective other attribute is called _results_format , so I assume _valid_results_formats should be the way to go.

Steps to reproduce the issue

from pyomo.opt import SolverFactory
from pyomo.opt.base import ProblemFormat

opt = SolverFactory("cbc")
opt.set_results_format(ProblemFormat.cpxlp)

Error Message

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/miniconda3/envs/envname/lib/python3.12/site-packages/pyomo/opt/base/solvers.py", line 473, in set_results_format
    if (self._problem_format in self._valid_results_formats) and (
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'CBCSHELL' object has no attribute '_valid_results_formats'. Did you mean: '_valid_result_formats'?

Information on your system

Pyomo version: 6.7.1
Python version: 3.12.4
Operating system: Ubuntu 20.04
How Pyomo was installed (PyPI, conda, source): mamba
Solver (if applicable): any that supports this (e.g., gurobi fails too)

Additional information

Bug was observed in v6.7.1 but still persists in latest (b480497), see:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions