def actualSolve(self, lp):
    'Solve a well formulated lp problem'
    if ('GUROBI_HOME' in os.environ):
        if ('LD_LIBRARY_PATH' not in os.environ):
            os.environ['LD_LIBRARY_PATH'] = ''
        os.environ['LD_LIBRARY_PATH'] += ((':' + os.environ['GUROBI_HOME']) + '/lib')
    if (not self.executable(self.path)):
        raise PulpSolverError(('PuLP: cannot execute ' + self.path))
    if (not self.keepFiles):
        uuid = uuid4().hex
        tmpLp = os.path.join(self.tmpDir, ('%s-pulp.lp' % uuid))
        tmpSol = os.path.join(self.tmpDir, ('%s-pulp.sol' % uuid))
        tmpMst = os.path.join(self.tmpDir, ('%s-pulp.mst' % uuid))
    else:
        tmpLp = (lp.name + '-pulp.lp')
        tmpSol = (lp.name + '-pulp.sol')
        tmpMst = (lp.name + '-pulp.mst')
    vs = lp.writeLP(tmpLp, writeSOS=1)
    try:
        os.remove(tmpSol)
    except:
        pass
    cmd = self.path
    cmd += (' ' + ' '.join([('%s=%s' % (key, value)) for (key, value) in self.options]))
    cmd += (' ResultFile=%s' % tmpSol)
    if self.mip_start:
        self.writesol(filename=tmpMst, vs=vs)
        cmd += (' InputFile=%s' % tmpMst)
    if lp.isMIP():
        if (not self.mip):
            warnings.warn('GUROBI_CMD does not allow a problem to be relaxed')
    cmd += (' %s' % tmpLp)
    if self.msg:
        pipe = None
    else:
        pipe = open(os.devnull, 'w')
    return_code = subprocess.call(cmd.split(), stdout=pipe, stderr=pipe)
    if (pipe is not None):
        pipe.close()
    if (return_code != 0):
        raise PulpSolverError(('PuLP: Error while trying to execute ' + self.path))
    if (not os.path.exists(tmpSol)):
        warnings.warn('GUROBI_CMD does provide good solution status of non optimal solutions')
        status = constants.LpStatusNotSolved
        values = reducedCosts = shadowPrices = slacks = None
    else:
        (status, values, reducedCosts, shadowPrices, slacks) = self.readsol(tmpSol)
    if (not self.keepFiles):
        for f in [tmpSol, tmpMst, tmpLp, 'gurobi.log']:
            try:
                os.remove(f)
            except:
                pass
    if (status != constants.LpStatusInfeasible):
        lp.assignVarsVals(values)
        lp.assignVarsDj(reducedCosts)
        lp.assignConsPi(shadowPrices)
        lp.assignConsSlack(slacks)
    lp.assignStatus(status)
    return status
Solve a well formulated lp problem
def actualSolve(self, lp):
    
    if ('GUROBI_HOME' in os.environ):
        if ('LD_LIBRARY_PATH' not in os.environ):
            os.environ['LD_LIBRARY_PATH'] = 
        os.environ['LD_LIBRARY_PATH'] += ((':' + os.environ['GUROBI_HOME']) + '/lib')
    if (not self.executable(self.path)):
        raise PulpSolverError(('PuLP: cannot execute ' + self.path))
    if (not self.keepFiles):
        uuid = uuid4().hex
        tmpLp = os.path.join(self.tmpDir, ('%s-pulp.lp' % uuid))
        tmpSol = os.path.join(self.tmpDir, ('%s-pulp.sol' % uuid))
        tmpMst = os.path.join(self.tmpDir, ('%s-pulp.mst' % uuid))
    else:
        tmpLp = (lp.name + '-pulp.lp')
        tmpSol = (lp.name + '-pulp.sol')
        tmpMst = (lp.name + '-pulp.mst')
    vs = lp.writeLP(tmpLp, writeSOS=1)
    try:
        os.remove(tmpSol)
    except:
        pass
    cmd = self.path
    cmd += (' ' + ' '.join([('%s=%s' % (key, value)) for (key, value) in self.options]))
    cmd += (' ResultFile=%s' % tmpSol)
    if self.mip_start:
        self.writesol(filename=tmpMst, vs=vs)
        cmd += (' InputFile=%s' % tmpMst)
    if lp.isMIP():
        if (not self.mip):
            warnings.warn('GUROBI_CMD does not allow a problem to be relaxed')
    cmd += (' %s' % tmpLp)
    if self.msg:
        pipe = None
    else:
        pipe = open(os.devnull, 'w')
    return_code = subprocess.call(cmd.split(), stdout=pipe, stderr=pipe)
    if (pipe is not None):
        pipe.close()
    if (return_code != 0):
        raise PulpSolverError(('PuLP: Error while trying to execute ' + self.path))
    if (not os.path.exists(tmpSol)):
        warnings.warn('GUROBI_CMD does provide good solution status of non optimal solutions')
        status = constants.LpStatusNotSolved
        values = reducedCosts = shadowPrices = slacks = None
    else:
        (status, values, reducedCosts, shadowPrices, slacks) = self.readsol(tmpSol)
    if (not self.keepFiles):
        for f in [tmpSol, tmpMst, tmpLp, 'gurobi.log']:
            try:
                os.remove(f)
            except:
                pass
    if (status != constants.LpStatusInfeasible):
        lp.assignVarsVals(values)
        lp.assignVarsDj(reducedCosts)
        lp.assignConsPi(shadowPrices)
        lp.assignConsSlack(slacks)
    lp.assignStatus(status)
    return status