Ejemplo n.º 1
0
    def __init__(self, **kwds):
        kwds['type'] = 'cplex_persistent'
        PersistentSolver.__init__(self, **kwds)
        CPLEXDirect._init(self)

        self._pyomo_model = kwds.pop('model', None)
        if self._pyomo_model is not None:
            self.set_instance(self._pyomo_model, **kwds)
Ejemplo n.º 2
0
    def add_sos_constraint(self, con):
        """
        Add an SOS constraint to the solver's model (if supported). This will keep any existing model components intact.

        Parameters
        ----------
        con: SOSConstraint
        """
        PersistentSolver.add_sos_constraint(self, con)
        self._solver_model.update()
Ejemplo n.º 3
0
    def add_constraint(self, con):
        """
        Add a constraint to the solver's model. This will keep any existing model components intact.

        Parameters
        ----------
        con: Constraint
        """
        PersistentSolver.add_constraint(self, con)
        self._solver_model.update()
Ejemplo n.º 4
0
    def add_var(self, var):
        """
        Add a variable to the solver's model. This will keep any existing model components intact.

        Parameters
        ----------
        var: Var
            The variable to add to the solver's model.
        """
        PersistentSolver.add_var(self, var)
        self._solver_model.update()
Ejemplo n.º 5
0
 def _presolve(self, **kwds):
     self.paramsets = kwds.pop('paramsets', None)
     PersistentSolver._presolve(self, **kwds)