How to use the openjij.sampler.sampler.Response function in openjij

To help you get started, we’ve selected a few openjij examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OpenJij / OpenJij / openjij / sampler / sampler.py View on Github external
def _sampling(self, ising_dense_graph, spin_type):
        response = Response(spin_type=spin_type, indices=self.indices)
        sa_system = cj.system.ClassicalIsing(ising_dense_graph)
        for _ in range(self.iteration):
            sa_system.initialize_spins()
            sa_system.simulated_annealing(self.beta_min, self.beta_max, self.step_length, self.step_num)
            state = sa_system.get_spins()
            response.add_state_energy(state, ising_dense_graph.calc_energy(state) + self.energy_bias)
        return response
github OpenJij / OpenJij / openjij / sampler / sampler.py View on Github external
def _sampling(self, ising_dense_graph, spin_type):
        response = Response(spin_type=spin_type, indices=self.indices)
        system = cj.system.QuantumIsing(ising_dense_graph, num_trotter_slices=self.trotter)
        for _ in range(self.iteration):
            system.initialize_spins()
            system.simulated_quantum_annealing(
                self.beta, 
                self.gamma,
                self.step_length, self.step_num)
            q_state = system.get_spins()
            energies = [ising_dense_graph.calc_energy(state) + self.energy_bias for state in q_state]
            response.add_quantum_state_energy(q_state, energies)
        return response