How to use the mip.lists.EmptyVarSol function in mip

To help you get started, we’ve selected a few mip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github coin-or / python-mip / mip / gurobi.py View on Github external
def __clear_sol(self):
        model = self.model
        self.__x = EmptyVarSol(model)
        self.__rc = EmptyVarSol(model)
        self.__pi = EmptyRowSol(model)
        self.__obj_val = None
github coin-or / python-mip / mip / cbc.py View on Github external
def __clear_sol(self: "SolverCbc"):
        self.__x = EmptyVarSol(self.model)
        self.__rc = EmptyVarSol(self.model)
        self.__pi = EmptyRowSol(self.model)
        self.__slack = EmptyRowSol(self.model)
        self.__obj_val = None
        self.__obj_bound = None
        self.__num_solutions = 0
github coin-or / python-mip / mip / cbc.py View on Github external
if osi_ptr != ffi.NULL:
            self.osi = osi_ptr
            self.owns_solver = False
        else:
            self.owns_solver = True
            self.osi = cbclib.Osi_newSolver()
        self.__relaxed = False

        # name indexes, created if necessary
        self.colNames = None
        self.rowNames = None
        self._objconst = 0.0
        self.osi_cutsp = ffi.NULL
        self.__x = EmptyVarSol(model)
        self.__rc = EmptyVarSol(model)
        self.__pi = EmptyRowSol(model)
        self.__obj_val = None

        if cbclib.Osi_isProvenOptimal(self.osi):
            self.__x = cbclib.Osi_getColSolution(self.osi)
            self.__rc = cbclib.Osi_getReducedCost(self.osi)
            self.__pi = cbclib.Osi_getRowPrice(self.osi)
            self.__obj_val = cbclib.Osi_getObjValue(self.osi)
github coin-or / python-mip / mip / gurobi.py View on Github external
# default number of threads
        self.__threads = 0

        # fine grained control of what is changed
        # for selective call on model.update
        self.__n_cols_buffer = 0
        self.__n_int_buffer = 0
        self.__n_rows_buffer = 0
        self.__n_modified_cols = 0
        self.__n_modified_rows = 0
        self.__updated = True
        self.__name_space = ffi.new("char[{}]".format(MAX_NAME_SIZE))
        self.__log = []

        # where solution will be stored
        self.__x = EmptyVarSol(model)
        self.__rc = EmptyVarSol(model)
        self.__pi = EmptyRowSol(model)
        self.__obj_val = None
github coin-or / python-mip / mip / gurobi.py View on Github external
attr = "X".encode("utf-8")
                    st = GRBgetdblattrarray(
                        self._model, attr, 0, self.num_cols(), self.__x
                    )
                    if st:
                        raise ParameterNotAvailable("Error querying Gurobi solution")

                    return OptimizationStatus.FEASIBLE

                return OptimizationStatus.NO_SOLUTION_FOUND

        if status == 1:  # LOADED
            return OptimizationStatus.LOADED
        if status == 2:  # OPTIMAL
            if isinstance(self.__x, EmptyVarSol):
                self.__obj_val = self.get_dbl_attr("ObjVal")

                self.__x = ffi.new("double[{}]".format(self.num_cols()))
                attr = "X".encode("utf-8")
                st = GRBgetdblattrarray(self._model, attr, 0, self.num_cols(), self.__x)
                if st:
                    raise ParameterNotAvailable("Error quering Gurobi solution")

                if (self.num_int() + self.get_int_attr("NumSOS")) == 0 or (relax):
                    self.__pi = ffi.new("double[{}]".format(self.num_rows()))
                    attr = "Pi".encode("utf-8")
                    st = GRBgetdblattrarray(
                        self._model, attr, 0, self.num_rows(), self.__pi
                    )
                    if st:
                        raise ParameterNotAvailable("Error quering Gurobi solution")
github coin-or / python-mip / mip / gurobi.py View on Github external
def __clear_sol(self):
        model = self.model
        self.__x = EmptyVarSol(model)
        self.__rc = EmptyVarSol(model)
        self.__pi = EmptyRowSol(model)
        self.__obj_val = None
github coin-or / python-mip / mip / gurobi.py View on Github external
self.__threads = 0

        # fine grained control of what is changed
        # for selective call on model.update
        self.__n_cols_buffer = 0
        self.__n_int_buffer = 0
        self.__n_rows_buffer = 0
        self.__n_modified_cols = 0
        self.__n_modified_rows = 0
        self.__updated = True
        self.__name_space = ffi.new("char[{}]".format(MAX_NAME_SIZE))
        self.__log = []

        # where solution will be stored
        self.__x = EmptyVarSol(model)
        self.__rc = EmptyVarSol(model)
        self.__pi = EmptyRowSol(model)
        self.__obj_val = None