How to use the openjij.sampler.BaseSampler 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 / sqa_sampler.py View on Github external
import numpy as np
import openjij
from openjij.sampler import measure_time
from openjij.sampler import BaseSampler
import cxxjij


class SQASampler(BaseSampler):
    """Sampler with Simulated Quantum Annealing (SQA).

    Inherits from :class:`openjij.sampler.sampler.BaseSampler`.

    Args:
        beta (float):
            Inverse temperature.

        gamma (float):
            Amplitude of quantum fluctuation.

        trotter (int):
            Trotter number.

        step_length (int):
            Length of Monte Carlo step.
github OpenJij / OpenJij / openjij / sampler / cmos_annealer.py View on Github external
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import requests
import json

from openjij.sampler import BaseSampler, Response
from openjij.model import KingGraph

import numpy as np

class CMOSAnnealer(BaseSampler):
    """Sampler with CMOS Annealer.

    Inherits from :class:`openjij.sampler.sampler.BaseSampler`.

    To get More details about CMOS Annealer API,
    please access the reference (https://annealing-cloud.com/web-api/reference.html).

    Args:
        token (str):
            API token of COMS Annealer.

        machine_type (str):
            Type of CMOS Annealer: 'ASIC' or 'FPGA'.

        beta_min (float):
            Minimum beta (inverse temperature).
github OpenJij / OpenJij / openjij / sampler / sa_sampler.py View on Github external
import numpy as np
import openjij
from openjij.sampler import measure_time
from openjij.sampler import BaseSampler
from openjij.utils.decorator import deprecated_alias
from openjij.model import BinaryHigherOrderModel
from .hubo_simulated_annealing import hubo_simulated_annealing, default_schedule
import time
import cxxjij


class SASampler(BaseSampler):
    """Sampler with Simulated Annealing (SA).

    Inherits from :class:`openjij.sampler.sampler.BaseSampler`.

    Args:
        beta_min (float):
            Minmum beta (inverse temperature).
            You can overwrite in methods .sample_*.

        beta_max (float):
            Maximum beta (inverse temperature).
            You can overwrite in methods .sample_*.

        num_reads (int):
            number of sampling (algorithm) runs. defaults None.
            You can overwrite in methods .sample_*.
github OpenJij / OpenJij / examples / python / sample_model.py View on Github external
import openjij as oj
import numpy as np
import openjij
from openjij.sampler import measure_time
from openjij.sampler import BaseSampler
import cxxjij


class SQASampler(BaseSampler):
    """Sampler with Simulated Quantum Annealing (SQA).

    Inherits from :class:`openjij.sampler.sampler.BaseSampler`.

    Args:
        beta (float):
            Inverse temperature.

        gamma (float):
            Amplitude of quantum fluctuation.

        trotter (int):
            Trotter number.

        step_length (int):
            Length of Monte Carlo step.