예제 #1
0
파일: json.py 프로젝트: todun/dimod
def dimod_object_hook(obj):
    """JSON-decoding for dimod objects.

    See Also:
        :class:`json.JSONDecoder` for using custom decoders.

    """
    if _is_sampleset_v2(obj):
        # in the future we could handle subtypes but right now we just have the
        # one
        return SampleSet.from_serializable(obj)
    elif _is_bqm(obj):
        # in the future we could handle subtypes but right now we just have the
        # one
        return BinaryQuadraticModel.from_serializable(obj)
    return obj
예제 #2
0
 def __init__(self, fujitsu_answer):
     sampleset = SampleSet.from_serializable(fujitsu_answer)
     Response.__init__(self, sampleset)
     self.timing = self.sampleset.info["timing"]
예제 #3
0
 def __init__(self, dwave_answer):
     sampleset = SampleSet.from_serializable(dwave_answer)
     Response.__init__(self, sampleset)
예제 #4
0
 def __init__(self, dimod_answer):
     solution = SampleSet.from_serializable(dimod_answer)
     Response.__init__(self, solution)