예제 #1
0
 def __init__(self, objective, constraints=None):
     if constraints is None:
         constraints = []
     # Check that objective is Minimize or Maximize.
     if not isinstance(objective, (Minimize, Maximize)):
         raise error.DCPError(
             "Problem objective must be Minimize or Maximize.")
     # Constraints and objective are immutable.
     self._objective = objective
     self._constraints = [c for c in constraints]
     self._value = None
     self._status = None
     self._solution = None
     # The intermediate and solving chains to canonicalize and solve the problem
     self._intermediate_chain = None
     self._solving_chain = None
     self._cached_chain_key = None
     # List of separable (sub)problems
     self._separable_problems = None
     # Information about the shape of the problem and its constituent parts
     self._size_metrics = None
     # Benchmarks reported by the solver:
     self._solver_stats = None
     self.args = [self._objective, self._constraints]
     # Cache for warm start.
     self._solver_cache = {}
예제 #2
0
 def __init__(self, objective, constraints=None):
     if constraints is None:
         constraints = []
     # Check that objective is Minimize or Maximize.
     if not isinstance(objective, (Minimize, Maximize)):
         raise error.DCPError("Problem objective must be Minimize or Maximize.")
     # Constraints and objective are immutable.
     self._objective = objective
     self._constraints = [c for c in constraints]
     self._value = None
     self._status = None
     self._solution = None
     self._cache = Cache()
     self._solver_cache = {}
     # Information about the shape of the problem and its constituent parts
     self._size_metrics = None
     # Benchmarks reported by the solver:
     self._solver_stats = None
     self.args = [self._objective, self._constraints]