jijmodeling.experimental
1# `jijmodeling.jijmodeling` is a module corresponding to the shared library created by PyO3, 2# and `jijmodeling.jijmodeling.experimental` is its submodule defined dynamically 3# while the initialization of the shared library. 4# 5# This file defines a new sub-module `jijmodeling.experimental`, 6# and exposes all the components in `jijmodeling.jijmodeling.experimental` 7# 8 9from ._jijmodeling import experimental as _experimental # type: ignore 10import sys 11 12for component in _experimental.__all__: 13 setattr(sys.modules[__name__], component, getattr(_experimental, component))
A Sample representing an individual solution found by running the mathematical optimization model.
Variables in var_values
are stored in instances of SparseVarValues
. This uses a dictionary
style, retaining only non-zero elements. For example, if the values for a two-dimensional
decision variable are x = [[0, 1, 2], [1, 0, 0]]
, they will be stored as
{(0,1): 1, (0,2): 2, (1,0): 1}
. To retrieve this, use sample.var_values["x"].values
.
If you want a dense array of decision variables, you can use the to_dense()
method.
run_id
is a unique identifier of the run in which this sample was found.
Note that this is not the same as a unique identifier of the Sample.
Converts a python dictionary into a SampleSet.
This is intended to be used primarily with dictionaries generated by
the to_dict()
method. As such sparse value maps must be represented as
association lists.
Converts this SampleSet into a regular python dictionary.
Note that this dictionary has a slightly different structure to better support JSON
serialization of the output dictionary: sparse values are stored differently. Any mapping
with tuples as keys is transformed into an association list of key-value pairs,
that is, [(k1, v1), (k2, v2), ...]
.
Builds a SampleSet from a list of dictionaries, where each entry is interpreted as a sample.
Args
samples
(list[dict[str, list | numpy.ndarray]]
)
Creates a single SampleSet by concatenating a list of multiple SampleSets.
Args
family
(list[SampleSet]
)
Converts a python dictionary into a SampleSet.
This is intended to be used primarily with dictionaries generated by
the to_dict()
method. As such sparse value maps must be represented as
association lists.
Converts this SampleSet into a regular python dictionary.
Note that this dictionary has a slightly different structure to better support JSON
serialization of the output dictionary: sparse values are stored differently. Any mapping
with tuples as keys is transformed into an association list of key-value pairs,
that is, [(k1, v1), (k2, v2), ...]
.
Returns a SampleSet containing only the feasible samples.
Args
epsilon
(float
, optional): Tolerance threshold for constraint violations. Defaults to $1e-8$.
Returns
SampleSet
: a feasible subset of the current set.
Returns a list of the feasible samples which have the lowest objective value. If there are no feasible solutions, this returns an empty list.
Args
epsilon
(float
, optional): Tolerance threshold. Objective values within this tolerance are included, even if not exactly the minimum value. Defaults to $1e-8$.
Returns
lowest_samples
: A list of Sample objects with the lowest ojective value in this SampleSet.