コード例 #1
0
 def __init__(self,
              operator: WeightedPauliOperator,
              timelimit: int = 600,
              thread: int = 1,
              display: int = 2) -> None:
     """
     Args:
         operator: The Ising Hamiltonian as an Operator
         timelimit: A time limit in seconds for the execution
         thread: The number of threads that CPLEX uses. Setting this 0 lets CPLEX decide the
             number of threads to allocate, but this may not be ideal for small problems for
             which the default of 1 is more suitable.
         display: Decides what CPLEX reports to the screen and records in a log during
             mixed integer optimization. This value must be between 0 and 5 where the
             amount of information displayed increases with increasing values of this parameter.
     """
     validate_min('timelimit', timelimit, 1)
     validate_min('thread', thread, 0)
     validate_range('display', display, 0, 5)
     super().__init__()
     self._ins = IsingInstance()
     self._ins.parse(operator.to_dict()['paulis'])
     self._timelimit = timelimit
     self._thread = thread
     self._display = display
     self._sol = None
コード例 #2
0
 def __init__(self,
              operator: WeightedPauliOperator,
              timelimit: int = 600,
              thread: int = 1,
              display: int = 2) -> None:
     validate_min('timelimit', timelimit, 1)
     validate_min('thread', thread, 0)
     validate_range('display', display, 0, 5)
     super().__init__()
     self._ins = IsingInstance()
     self._ins.parse(operator.to_dict()['paulis'])
     self._timelimit = timelimit
     self._thread = thread
     self._display = display
     self._sol = None