Пример #1
0
    def sample_bqm(self, bqm, num_reads=1, **kwargs):
        problem_id = str(uuid4())
        problem_label = kwargs.pop('label', None)
        info = dict(timing={
            'total_real_time': 11511.0,
            'anneal_time_per_run': 20.0,
            'post_processing_overhead_time': 2042.0,
            'qpu_sampling_time': 164.0,
            'readout_time_per_run': 123.0,
            'qpu_delay_time_per_sample': 21.0,
            'qpu_anneal_time_per_sample': 20.0,
            'total_post_processing_time': 2042.0,
            'qpu_programming_time': 8740.0,
            'run_time_chip': 164.0,
            'qpu_access_time': 11511.0,
            'qpu_readout_time_per_sample': 123.0
        },
                    problem_id=problem_id)
        if problem_label:
            info.update(problem_label=problem_label)

        samples = np.random.choice(tuple(bqm.vartype.value),
                                   size=(num_reads, len(bqm)))

        future = Future()
        ss = dimod.SampleSet.from_samples_bqm((samples, bqm.variables),
                                              bqm,
                                              info=info)
        future.sampleset = ss
        future.id = problem_id
        future.label = problem_label

        return future