def buildSolverModel(self, lp):
    '\n            Takes the pulp lp model and translates it into a gurobi model\n            '
    log.debug('create the gurobi model')
    lp.solverModel = gurobipy.Model(lp.name)
    log.debug('set the sense of the problem')
    if (lp.sense == constants.LpMaximize):
        lp.solverModel.setAttr('ModelSense', (- 1))
    if self.timeLimit:
        lp.solverModel.setParam('TimeLimit', self.timeLimit)
    if self.epgap:
        lp.solverModel.setParam('MIPGap', self.epgap)
    log.debug('add the variables to the problem')
    for var in lp.variables():
        lowBound = var.lowBound
        if (lowBound is None):
            lowBound = (- gurobipy.GRB.INFINITY)
        upBound = var.upBound
        if (upBound is None):
            upBound = gurobipy.GRB.INFINITY
        obj = lp.objective.get(var, 0.0)
        varType = gurobipy.GRB.CONTINUOUS
        if ((var.cat == constants.LpInteger) and self.mip):
            varType = gurobipy.GRB.INTEGER
        var.solverVar = lp.solverModel.addVar(lowBound, upBound, vtype=varType, obj=obj, name=var.name)
    lp.solverModel.update()
    log.debug('add the Constraints to the problem')
    for (name, constraint) in lp.constraints.items():
        expr = gurobipy.LinExpr(list(constraint.values()), [v.solverVar for v in constraint.keys()])
        if (constraint.sense == constants.LpConstraintLE):
            relation = gurobipy.GRB.LESS_EQUAL
        elif (constraint.sense == constants.LpConstraintGE):
            relation = gurobipy.GRB.GREATER_EQUAL
        elif (constraint.sense == constants.LpConstraintEQ):
            relation = gurobipy.GRB.EQUAL
        else:
            raise PulpSolverError('Detected an invalid constraint type')
        constraint.solverConstraint = lp.solverModel.addConstr(expr, relation, (- constraint.constant), name)
    lp.solverModel.update()
Takes the pulp lp model and translates it into a gurobi model
def buildSolverModel(self, lp):
    '\n            \n            '
    log.debug('create the gurobi model')
    lp.solverModel = gurobipy.Model(lp.name)
    log.debug('set the sense of the problem')
    if (lp.sense == constants.LpMaximize):
        lp.solverModel.setAttr('ModelSense', (- 1))
    if self.timeLimit:
        lp.solverModel.setParam('TimeLimit', self.timeLimit)
    if self.epgap:
        lp.solverModel.setParam('MIPGap', self.epgap)
    log.debug('add the variables to the problem')
    for var in lp.variables():
        lowBound = var.lowBound
        if (lowBound is None):
            lowBound = (- gurobipy.GRB.INFINITY)
        upBound = var.upBound
        if (upBound is None):
            upBound = gurobipy.GRB.INFINITY
        obj = lp.objective.get(var, 0.0)
        varType = gurobipy.GRB.CONTINUOUS
        if ((var.cat == constants.LpInteger) and self.mip):
            varType = gurobipy.GRB.INTEGER
        var.solverVar = lp.solverModel.addVar(lowBound, upBound, vtype=varType, obj=obj, name=var.name)
    lp.solverModel.update()
    log.debug('add the Constraints to the problem')
    for (name, constraint) in lp.constraints.items():
        expr = gurobipy.LinExpr(list(constraint.values()), [v.solverVar for v in constraint.keys()])
        if (constraint.sense == constants.LpConstraintLE):
            relation = gurobipy.GRB.LESS_EQUAL
        elif (constraint.sense == constants.LpConstraintGE):
            relation = gurobipy.GRB.GREATER_EQUAL
        elif (constraint.sense == constants.LpConstraintEQ):
            relation = gurobipy.GRB.EQUAL
        else:
            raise PulpSolverError('Detected an invalid constraint type')
        constraint.solverConstraint = lp.solverModel.addConstr(expr, relation, (- constraint.constant), name)
    lp.solverModel.update()