Skip to content

Commit

Permalink
Revert Factory changes; clean up some nonsense
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmundt committed Nov 21, 2023
1 parent 131a142 commit 52b8b6b
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyomo/contrib/appsi/plugins.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pyomo.common.extensions import ExtensionBuilderFactory
from pyomo.opt.base.solvers import SolverFactory
from pyomo.solver.factory import SolverFactory
from .solvers import Gurobi, Ipopt, Cbc, Cplex, Highs
from .build import AppsiBuilder

Expand Down
2 changes: 1 addition & 1 deletion pyomo/solver/IPOPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from pyomo.repn.plugins.nl_writer import NLWriter, NLWriterInfo
from pyomo.solver.base import SolverBase
from pyomo.solver.config import SolverConfig
from pyomo.opt.base.solvers import SolverFactory
from pyomo.solver.factory import SolverFactory
from pyomo.solver.results import (
Results,
TerminationCondition,
Expand Down
1 change: 0 additions & 1 deletion pyomo/solver/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from pyomo.core.base.objective import _GeneralObjectiveData
from pyomo.common.timing import HierarchicalTimer
from pyomo.common.errors import ApplicationError

from pyomo.opt.results.results_ import SolverResults as LegacySolverResults
from pyomo.opt.results.solution import Solution as LegacySolution
from pyomo.core.kernel.objective import minimize
Expand Down
33 changes: 33 additions & 0 deletions pyomo/solver/factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ___________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2022
# National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of Sandia, LLC, the U.S. Government retains certain
# rights in this software.
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________

from pyomo.opt.base import SolverFactory as LegacySolverFactory
from pyomo.common.factory import Factory
from pyomo.solver.base import LegacySolverInterface


class SolverFactoryClass(Factory):
def register(self, name, doc=None):
def decorator(cls):
self._cls[name] = cls
self._doc[name] = doc

# class LegacySolver(LegacySolverInterface, cls):
# pass

# LegacySolverFactory.register(name, doc)(LegacySolver)

return cls

return decorator


SolverFactory = SolverFactoryClass()
2 changes: 1 addition & 1 deletion pyomo/solver/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# ___________________________________________________________________________


from pyomo.opt.base.solvers import SolverFactory
from .factory import SolverFactory
from .IPOPT import IPOPT


Expand Down

0 comments on commit 52b8b6b

Please sign in to comment.