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))
class Violation:
total_violation
expr_values
name
class EvaluationResult:
objective
constraints
penalties
class VarType:
CONTINUOUS = VarType.CONTINUOUS
INTEGER = VarType.INTEGER
BINARY = VarType.BINARY
class SparseVarValues:
def from_array(name, array, var_type=Ellipsis):
def to_dense(self, /):
var_type
values
name
shape
class SolvingTime:
def total(self, /):
compiling_time
decoding_time
transpiling_time
postprocess_time
preprocess_time
solving_time
class SystemTime:
request_queuing_time
fetching_problem_time
posting_time
fetching_result_time
deserialize_time
class MeasuringTime:
def total(self, /):

Returns the total time measurred, across both SolvingTime and SystemTime.

def view_solving_time(self, /):

Returns a readonly view of the internal SolvingTime field.

def view_system_time(self, /):

Returns a readonly view of the internal SystemTime field.

class Sample:

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.

def from_dense_arrays(dict, num_occurrences=1, var_types=None, run_id=None, meta_info=None):
def is_feasible(self, /, epsilon=1e-08):
def to_dense(self, /):
def from_dict(dict):

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.

def to_dict(self, /):

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), ...].

num_occurrences
run_id
var_values
eval
run_info
class SampleSet:
def from_array(samples):

Builds a SampleSet from a list of dictionaries, where each entry is interpreted as a sample.

Args

  • samples(list[dict[str, list | numpy.ndarray]])
def concat(family):

Creates a single SampleSet by concatenating a list of multiple SampleSets.

Args

  • family (list[SampleSet])
def from_dict(dict):

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.

def to_dict(self, /):

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), ...].

def feasibles(self, /, epsilon=1e-08):

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.
def separate(self, /):

Splits this SampleSet based on the run_id of the samples.

In other words, for each distinct run_id among the Samples contained in this instance, a new SampleSet is created to store all Samples with that ID.

Returns

  • sets (dict[str, SampleSet]): The separated SampleSets. Keys are the run IDs.
def lowest(self, /, epsilon=1e-08):

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.

run_info
set_id
measuring_time
set_info
run_times
data