Serialization#
JijModeling models can be easily serialized to Protobuf using the jijmodeling.to_protobuf() function or the Problem.to_protobuf method.
import jijmodeling as jm
problem = jm.Problem("my problem")
N = problem.Placeholder("N", dtype=jm.DataType.NATURAL)
x = problem.BinaryVar("x", shape=(N,))
problem += x.sum()
serialized = problem.to_protobuf()
To deserialize, use jijmodeling.from_protobuf() or Problem.from_protobuf.
deserialized = jm.from_protobuf(serialized)