def __init__(self, name: 'std::string const &', problem_type: 'operations_research::MPSolver::OptimizationProblemType'):
this = _pywraplp.new_Solver(name, problem_type)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
python类Exception()的实例源码
def __init__(self):
this = _pywraplp.new_MPSolverParameters()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except __builtin__.Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
def __init__(self, *args):
this = _pywrapknapsack_solver.new_KnapsackSolver(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self):
this = _pywrapcp.new_DefaultPhaseParameters()
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self, *args):
this = _pywrapcp.new_Solver(*args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
self.__python_constraints = []
def __init__(self):
if self.__class__ == BaseObject:
_self = None
else:
_self = self
this = _pywrapcp.new_BaseObject(_self, )
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self, s: 'Solver'):
if self.__class__ == PropagationBaseObject:
_self = None
else:
_self = self
this = _pywrapcp.new_PropagationBaseObject(_self, s)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self):
if self.__class__ == Decision:
_self = None
else:
_self = self
this = _pywrapcp.new_Decision(_self, )
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self):
if self.__class__ == Demon:
_self = None
else:
_self = self
this = _pywrapcp.new_Demon(_self, )
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self, solver: 'Solver'):
if self.__class__ == Constraint:
_self = None
else:
_self = self
this = _pywrapcp.new_Constraint(_self, solver)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self, s: 'Solver'):
if self.__class__ == SearchMonitor:
_self = None
else:
_self = self
this = _pywrapcp.new_SearchMonitor(_self, s)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self, val: 'long long const &'):
this = _pywrapcp.new_RevInteger(val)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self, val: 'long long const &'):
this = _pywrapcp.new_NumericalRevInteger(val)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self, *args):
if self.__class__ == IntVarLocalSearchOperator:
_self = None
else:
_self = self
this = _pywrapcp.new_IntVarLocalSearchOperator(_self, *args)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self, vars: 'std::vector< operations_research::IntVar *,std::allocator< operations_research::IntVar * > > const &'):
if self.__class__ == BaseLns:
_self = None
else:
_self = self
this = _pywrapcp.new_BaseLns(_self, vars)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self, vars: 'std::vector< operations_research::IntVar *,std::allocator< operations_research::IntVar * > > const &'):
if self.__class__ == ChangeValue:
_self = None
else:
_self = self
this = _pywrapcp.new_ChangeValue(_self, vars)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def __init__(self, vars: 'std::vector< operations_research::IntVar *,std::allocator< operations_research::IntVar * > > const &'):
if self.__class__ == IntVarLocalSearchFilter:
_self = None
else:
_self = self
this = _pywrapcp.new_IntVarLocalSearchFilter(_self, vars)
try:
self.this.append(this)
except __builtin__.Exception:
self.this = this
def ApplyWrapper(self, solver):
try:
self.Apply(solver)
except Exception as e:
if 'CP Solver fail' in str(e):
solver.ShouldFail()
else:
raise
def NextWrapper(self, solver):
try:
return self.Next(solver)
except Exception as e:
if 'CP Solver fail' in str(e):
return solver.FailDecision()
else:
raise