Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
def __clear_sol(self):
model = self.model
self.__x = EmptyVarSol(model)
self.__rc = EmptyVarSol(model)
self.__pi = EmptyRowSol(model)
self.__obj_val = None
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
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
self.__verbose = 1
# pre-allocate temporary space to query names
self.__name_space = ffi.new("char[{}]".format(MAX_NAME_SIZE))
# in cut generation
self.__name_spacec = ffi.new("char[{}]".format(MAX_NAME_SIZE))
self.__log = (
[]
) # type: List[Tuple[numbers.Real, Tuple[numbers.Real, numbers.Real]]]
self.set_problem_name(name)
self.__pumpp = DEF_PUMPP
# where solution will be stored
self.__x = EmptyVarSol(model)
self.__rc = EmptyVarSol(model)
self.__pi = EmptyRowSol(model)
self.__slack = EmptyRowSol(model)
self.__obj_val = None
self.__obj_bound = None
self.__num_solutions = 0
def __clear_sol(self: "SolverOsi"):
self.__x = EmptyVarSol(self.model)
self.__rc = EmptyVarSol(self.model)
self.__pi = EmptyRowSol(self.model)
self.__obj_val = None
# 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