How to use the mip.exceptions.SolutionNotAvailable 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 / var.py View on Github external
def x(self) -> float:
        """Value of this variable in the solution."""
        if self.__model.status == OptimizationStatus.LOADED:
            raise SolutionNotAvailable('Model was not optimized, \
                solution not available.')
        elif (self.__model.status == OptimizationStatus.INFEASIBLE
              or self.__model.status == OptimizationStatus.CUTOFF):
            raise SolutionNotAvailable('Infeasible __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.UNBOUNDED:
            raise SolutionNotAvailable('Unbounded __model, solution not \
                available.')
        elif self.__model.status == OptimizationStatus.NO_SOLUTION_FOUND:
            raise SolutionNotAvailable('Solution not found \
                during optimization.')

        return self.__model.solver.var_get_x(self)
github coin-or / python-mip / mip / var.py View on Github external
def xi(self, i: int) -> float:
        """Value for this variable in the :math:`i`-th solution from
        the solution pool."""
        if self.__model.status == OptimizationStatus.LOADED:
            raise SolutionNotAvailable('Model was not optimized, \
                solution not available.')
        elif (self.__model.status == OptimizationStatus.INFEASIBLE or
              self.__model.status == OptimizationStatus.CUTOFF):
            raise SolutionNotAvailable('Infeasible __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.UNBOUNDED:
            raise SolutionNotAvailable('Unbounded __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.NO_SOLUTION_FOUND:
            raise SolutionNotAvailable('Solution not found \
                during optimization.')

        return self.__model.solver.var_get_xi(self, i)
github coin-or / python-mip / mip / var.py View on Github external
def xi(self, i: int) -> float:
        """Value for this variable in the :math:`i`-th solution from
        the solution pool."""
        if self.__model.status == OptimizationStatus.LOADED:
            raise SolutionNotAvailable('Model was not optimized, \
                solution not available.')
        elif (self.__model.status == OptimizationStatus.INFEASIBLE or
              self.__model.status == OptimizationStatus.CUTOFF):
            raise SolutionNotAvailable('Infeasible __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.UNBOUNDED:
            raise SolutionNotAvailable('Unbounded __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.NO_SOLUTION_FOUND:
            raise SolutionNotAvailable('Solution not found \
                during optimization.')

        return self.__model.solver.var_get_xi(self, i)
github coin-or / python-mip / mip / var.py View on Github external
def x(self) -> float:
        """Value of this variable in the solution."""
        if self.__model.status == OptimizationStatus.LOADED:
            raise SolutionNotAvailable('Model was not optimized, \
                solution not available.')
        elif (self.__model.status == OptimizationStatus.INFEASIBLE
              or self.__model.status == OptimizationStatus.CUTOFF):
            raise SolutionNotAvailable('Infeasible __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.UNBOUNDED:
            raise SolutionNotAvailable('Unbounded __model, solution not \
                available.')
        elif self.__model.status == OptimizationStatus.NO_SOLUTION_FOUND:
            raise SolutionNotAvailable('Solution not found \
                during optimization.')

        return self.__model.solver.var_get_x(self)
github coin-or / python-mip / mip / var.py View on Github external
def x(self) -> float:
        """Value of this variable in the solution."""
        if self.__model.status == OptimizationStatus.LOADED:
            raise SolutionNotAvailable('Model was not optimized, \
                solution not available.')
        elif (self.__model.status == OptimizationStatus.INFEASIBLE
              or self.__model.status == OptimizationStatus.CUTOFF):
            raise SolutionNotAvailable('Infeasible __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.UNBOUNDED:
            raise SolutionNotAvailable('Unbounded __model, solution not \
                available.')
        elif self.__model.status == OptimizationStatus.NO_SOLUTION_FOUND:
            raise SolutionNotAvailable('Solution not found \
                during optimization.')

        return self.__model.solver.var_get_x(self)
github coin-or / python-mip / mip / var.py View on Github external
def x(self) -> float:
        """Value of this variable in the solution."""
        if self.__model.status == OptimizationStatus.LOADED:
            raise SolutionNotAvailable('Model was not optimized, \
                solution not available.')
        elif (self.__model.status == OptimizationStatus.INFEASIBLE
              or self.__model.status == OptimizationStatus.CUTOFF):
            raise SolutionNotAvailable('Infeasible __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.UNBOUNDED:
            raise SolutionNotAvailable('Unbounded __model, solution not \
                available.')
        elif self.__model.status == OptimizationStatus.NO_SOLUTION_FOUND:
            raise SolutionNotAvailable('Solution not found \
                during optimization.')

        return self.__model.solver.var_get_x(self)
github coin-or / python-mip / mip / gurobi.py View on Github external
def var_get_x(self, var: Var):
        if self._cb_sol == ffi.NULL:
            raise SolutionNotAvailable("Solution not available")

        return self._cb_sol[var.idx]
github coin-or / python-mip / mip / var.py View on Github external
def xi(self, i: int) -> float:
        """Value for this variable in the :math:`i`-th solution from
        the solution pool."""
        if self.__model.status == OptimizationStatus.LOADED:
            raise SolutionNotAvailable('Model was not optimized, \
                solution not available.')
        elif (self.__model.status == OptimizationStatus.INFEASIBLE or
              self.__model.status == OptimizationStatus.CUTOFF):
            raise SolutionNotAvailable('Infeasible __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.UNBOUNDED:
            raise SolutionNotAvailable('Unbounded __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.NO_SOLUTION_FOUND:
            raise SolutionNotAvailable('Solution not found \
                during optimization.')

        return self.__model.solver.var_get_xi(self, i)
github coin-or / python-mip / mip / var.py View on Github external
def xi(self, i: int) -> float:
        """Value for this variable in the :math:`i`-th solution from
        the solution pool."""
        if self.__model.status == OptimizationStatus.LOADED:
            raise SolutionNotAvailable('Model was not optimized, \
                solution not available.')
        elif (self.__model.status == OptimizationStatus.INFEASIBLE or
              self.__model.status == OptimizationStatus.CUTOFF):
            raise SolutionNotAvailable('Infeasible __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.UNBOUNDED:
            raise SolutionNotAvailable('Unbounded __model, \
                solution not available.')
        elif self.__model.status == OptimizationStatus.NO_SOLUTION_FOUND:
            raise SolutionNotAvailable('Solution not found \
                during optimization.')

        return self.__model.solver.var_get_xi(self, i)
github coin-or / python-mip / mip / var.py View on Github external
def rc(self) -> float:
        """Reduced cost, only available after a linear programming model (only
        continuous variables) is optimized"""
        if self.__model.status != OptimizationStatus.OPTIMAL:
            raise SolutionNotAvailable('Solution not available.')

        return self.__model.solver.var_get_rc(self)