예제 #1
0
 def _gurobi_vtype_from_var(self, var):
     """
     This function takes a pyomo variable and returns the appropriate gurobi variable type
     :param var: pyomo.core.base.var.Var
     :return: gurobipy.GRB.CONTINUOUS or gurobipy.GRB.BINARY or gurobipy.GRB.INTEGER
     """
     if var.is_binary():
         vtype = self._gurobipy.GRB.BINARY
     elif var.is_integer():
         vtype = self._gurobipy.GRB.INTEGER
     elif var.is_continuous():
         vtype = self._gurobipy.GRB.CONTINUOUS
     else:
         raise ValueError('Variable domain type is not recognized for {0}'.format(var.domain))
     return vtype
예제 #2
0
 def _gurobi_vtype_from_var(self, var):
     """
     This function takes a pyomo variable and returns the appropriate gurobi variable type
     :param var: pyomo.core.base.var.Var
     :return: gurobipy.GRB.CONTINUOUS or gurobipy.GRB.BINARY or gurobipy.GRB.INTEGER
     """
     if var.is_binary():
         vtype = self._gurobipy.GRB.BINARY
     elif var.is_integer():
         vtype = self._gurobipy.GRB.INTEGER
     elif var.is_continuous():
         vtype = self._gurobipy.GRB.CONTINUOUS
     else:
         raise ValueError('Variable domain type is not recognized for {0}'.format(var.domain))
     return vtype
예제 #3
0
 def _xpress_vartype_from_var(self, var):
     """
     This function takes a pyomo variable and returns the appropriate xpress variable type
     :param var: pyomo.core.base.var.Var
     :return: xpress.continuous or xpress.binary or xpress.integer
     """
     if var.is_binary():
         vartype = self._xpress.binary
     elif var.is_integer():
         vartype = self._xpress.integer
     elif var.is_continuous():
         vartype = self._xpress.continuous
     else:
         raise ValueError('Variable domain type is not recognized for {0}'.format(var.domain))
     return vartype
예제 #4
0
    def _mosek_vtype_from_var(self, var):
        """
        This function takes a pyomo variable and returns the appropriate mosek variable type
        :param var: pyomo.core.base.var.Var
        :return: mosek.variabletype.type_int or mosek.variabletype.type_cont
        """

        if var.is_integer() or var.is_binary():
            vtype = self._mosek.variabletype.type_int
        elif var.is_continuous():
            vtype = self._mosek.variabletype.type_cont
        else:
            raise ValueError(
                'Variable domain type is not recognized for {0}'.format(var.domain))
        return vtype
예제 #5
0
 def _mosek_vartype_from_var(self, var):
     if var.is_integer():
         return self._mosek.variabletype.type_int
     return self._mosek.variabletype.type_cont