Release Notes

0.11.0

New Features

  • Add the ability to specify a default variable type and bounds for missing variables when calling QuadraticModel.add_linear() and QuadraticModel.add_linear_from().

  • Add QuadraticModel::swap() and BinaryQuadraticModel::swap() methods to the C++ code. See #928.

  • Add lp.loads() and lp.load() functions.

  • Improve the performance of the ConstrainedQuadraticModel.from_lp_file() method.

  • Improve the performance of iteration over Variables objects.

Upgrade Notes

  • Drop support for Numpy 1.19

  • Some malformed LP-files that previously caused ConstrainedQuadraticModel.from_lp_file() to emit a warning now raise an error instead.

  • Provide manylinux2014 wheels for Python 3.10 rather than manylinux2010.

Deprecation Notes

  • Deprecate ConstrainedQuadraticModel.from_lp_file() method. Users should use the more explicit lp.loads() and lp.load() functions instead. The ConstrainedQuadraticModel.from_lp_file() will be removed in dimod 0.13.0.

  • The default_lower_bounds and default_upper_bounds keyword arguments for ConstrainedQuadraticModel.from_lp_file() are deprecated and do nothing.

Bug Fixes

  • In the cqm_to_bqm function, set the Lagrange multiplier to one if the maximum absolute bias is zero.

  • dimod.variables.Variables objects now correctly raise an IndexError when given negative indices that are out of range.

0.10.17

New Features

  • Add BinaryQuadraticModel::lower_bound() and BinaryQuadraticModel::upper_bound() methods to the C++ code.

  • Improve the performance of the QuadraticModel.update() method.

  • Improve the performance of the ConstrainedQuadraticModel.set_objective() method.

  • QuadraticModel.update() now accepts binary quadratic models in addition to quadratic models.

  • Add QuadraticModel.add_variables_from_model() method. See #1157.

0.11.0rc1

Prelude

Add support for real-valued variables.

New Features

  • Improved deprecation warnings and documentation. See #192.

  • Add C++ Vartype::REAL, a new variable type for real-valued variables.

  • Support variables with Vartype::REAL in C++ QuadraticModel.

  • Add Vartype.REAL, a new variable type for real-valued variables.

  • Add Real() and Reals() functions for creating quadratic models with a single real-valued variable.

  • Support variables with Vartype.REAL in QuadraticModel.

  • ConstrainedQuadraticModel.to_file() now uses serialization format 1.2. This format is backwards compatibile.

  • Add vartype and linear_only arguments to ConstrainedQuadraticModel.num_biases().

  • Add vartype and include_objective arguments to ConstrainedQuadraticModel.num_quadratic_variables().

  • Add check_header keyword-only argument to ConstrainedQuadraticModel.from_file().

  • Add a global flag dimod.REAL_INTERACTIONS. When this flag is set to False, variables with variable type Vartype.REAL cannot have interactions. dimod.REAL_INTERACTIONS is set to False by default.

Upgrade Notes

  • Remove .vartypes, .lower_bounds, and .upper_bounds attributes from ConstrainedQuadraticModel.variables. These were previously deprecated in dimod 0.10.6.

  • Remove .vartype() method from ConstrainedQuadraticModel.variables. It was previously deprecated in dimod 0.10.6.

  • Remove bqm_index_labelled_input decorator. It was previously deprecated in dimod 0.10.8.

  • Remove SampleSet.is_writeable attribute.

  • Remove dimod.generators.knapsack(). It was previously deprecated in dimod 0.10.6.

  • Remove dimod.generators.multi_knapsack(). It was previously deprecated in dimod 0.10.6.

  • Remove dimod.generators.bin_packing(). It was previously deprecated in dimod 0.10.6.

  • Remove HigherOrderComposite.sample_ising() method. It was previously scheduled to be removed in dimod 0.10.0.

  • Remove PolySampler.sample(), PolySampler.sample_ising(), and PolySampler.sample_qubo() methods. These were previously scheduled to be removed in dimod 0.10.0.

  • AdjVectorBQM and AdjDictBQM are now aliases for BinaryQuadraticModel and DictBQM respectively rather than having their own implementation with a slightly different API. They were previously deprecated in dimod 0.10.0.

  • The dimod.bqm namespace has been removed.

  • The dimod.core.bqm namespace has been removed.

  • dimod::AdjVectorBQM has been removed from the C++ code.

  • Some composites were migrated to dwave-preprocessing in dimod0.10.0. Trying to import and use these composites from dimod now raises an exception rather than a warning. The affected composites:

    • ClipComposite

    • ConnectedComponentsComposite

    • FixedVariableComposite

    • RoofDualityComposite

    • ScaleComposite

    • SpinReversalTransformComposite

  • The fix_variables() was migrated to dwave-preprocessing in dimod 0.10.0. Trying to import and use it now raises an exception rather than a warning.

  • Packages that require binary compatibility with dimod and that were compiled with 0.10.0 will not work with 0.11.0.

Deprecation Notes

  • Deprecate support for the ConstrainedQuadraticModel.add_variable(v, vartype) argument order. Use ConstrainedQuadraticModel.add_variable(vartype, v) instead. See #969.

  • In the future, ConstrainedQuadraticModel.num_quadratic_variables() will also include the objective towards the count by default.

Bug Fixes

  • Fixes performance regression on energy calculations introduced in 0.10.0. See #1025

0.10.16

New Features

  • Add SampleSet.from_samples_cqm() method.

Bug Fixes

  • ExactCQMSolver.sample_cqm now uses SampleSet.from_samples_cqm. This corrects a small error in the calculation of constraint satisfaction.

  • dimod.generators.random_knapsack() and dimod.generators.random_bin_packing() no longer use a fixed seed by default.

  • ConstrainedQuadraticModel.add_discrete(), ConstrainedQuadraticModel.add_constraint_from_iterable(), and ConstrainedQuadraticModel.add_discrete_from_model() now correctly raise an error when given a binary variable that overlaps with an existing discrete constraint. See #1149.

  • SampleSet.from_samples_bqm now handles empty list input correctly.

0.10.15

Deprecation Notes

  • Deprecate cls parameter in dimod.serialization.coo.load() and dimod.serialization.coo.loads().

Bug Fixes

  • Fix energy calculations for quadratic models with squared terms. See #1136.

  • dimod.serialization.fileview.load() now correctly propagates KeyError from the loading function.

0.10.14

New Features

  • Add Polynomial to dimod.typing.

  • Add Comparison.to_polystring() method.

  • Printing Comparison objects now returns an equation representation of the comparison as a string.

  • Add ConstrainedQuadraticModel.relabel_constraints() method. See #1066.

  • Add ConstrainedQuadraticModel.remove_constraint() method. See #1104.

  • Add methods to report memory usage of quadratic models:

    • Add QuadraticModel.nbytes() method.

    • Add BinaryQuadraticModel.nbytes() method.

    • Add QuadraticModel::nbytes() method to C++ the code.

    • Add BinaryQuadraticModel::nbytes() method to C++ the code.

    See #668

Deprecation Notes

  • Deprecate cls parameter in dimod.generators.random.gnm_random_bqm(), dimod.generators.random.gnp_random_bqm(), dimod.generators.random.uniform(), dimod.generators.random.ran_r(), dimod.generators.random.randint(), and dimod.generators.random.doped().

Bug Fixes

  • Comparison.__repr__() now correctly returns a representation that can be passed to eval().

  • Fix dimod.typing.Bias to correctly exclude numpy.complexfloating.

  • Attempting to relabel two model variables to the same target will now correctly raise a ValueError. See #1110.

0.10.13

New Features

  • Add ConstrainedQuadraticModel.add_discrete_from_comparison() method.

  • Add ConstrainedQuadraticModel.add_discrete_from_iterable() method.

  • Add ConstrainedQuadraticModel.add_discrete_from_model() method.

  • ConstrainedQuadraticModel.add_discrete() now supports additional argument types.

  • Add QuadraticModel.flip_variable() method.

  • Add ConstrainedQuadraticModel.flip_variable() method.

  • Support iterator inputs to as_samples(). See #543.

  • Add SamplesLike and SampleLike to dimod.typing. See #1008.

  • Add dimod::vartype_limits to C++ code for compile-time information about variable types.

  • Add dimod::vartype_info to C++ code for runtime information about variable types.

  • Add vartype_info() function.

  • BinaryQuadraticModel.resize() now returns the difference in the number of variables between the current and previous binary quadratic model. Previously it always returned 0. See #1091

  • Add BinaryQuadraticModel.maximum_energy_delta() method.

  • Add ConstrainedQuadraticModel.set_lower_bound() method. See #1105.

  • Add ConstrainedQuadraticModel.set_upper_bound() method. See #1105.

Upgrade Notes

  • as_samples() no longer always casts input sample values to integers.

  • QuadraticModel.energies() and BinaryQuadraticModel.energies() now return a NumPy array with dtype np.float64 be default. Previously they defaulted to match the dtype of the model.

  • Bounds for integer variables are no longer rounded to the nearest int in QuadraticModel and ConstrainedQuadraticModel.

Deprecation Notes

  • Deprecate support for a 2-tuple of (dict, list) as a samples-like. E.g. ({'a': 1, 'b': 0}, ['a', 'b']) is no longer supported. (array_like, labels) is still supported, as is a dictionary. Support will be removed in dimod 0.12.0.

Bug Fixes

  • QuadraticModel.energies() and BinaryQuadraticModel.energies() will return the correct energy when given samples with non-integer values.

  • It is no longer possible to add an integer variables to a quadratic model with bounds that do not include at least one integer between them. E.g. qm.add_variable('INTEGER', 'v', lower_bound=1.2, upper_bound=1.5) will now raise a ValueError.

  • ConstrainedQuadraticModel.add_variable() now correctly raises an error when a variable is added twice with inconsistent bounds.

  • ConstrainedQuadraticModel.add_variable() now correctly returns the variable label when a variable is added twice.

0.10.12

New Features

  • Add cascade keyword argument to ConstrainedQuadraticModel.fix_variable() and ConstrainedQuadraticModel.fix_variables(). These methods also now return any variables fixed using the cascade keyword argument.

  • Add QuadraticModel::swap_variables() and BinaryQuadraticModel::swap_variables() methods to the C++ code.

  • Reintroduce BinaryQuadraticModel.to_serializable() and BinaryQuadraticModel.from_serializable() methods that were previously removed in dimod 0.10.0, see #847.

Upgrade Notes

  • ConstrainedQuadraticModel.fix_variable() and ConstrainedQuadraticModel.fix_variables() now raise a ValueError if given a variable not in the model.

  • Make use_bytes and bytes_type keyword-only arguments in BinaryQuadraticModel.to_serializable(). Note that BinaryQuadraticModel.to_serializable() was removed in 0.10.0 but restored in 0.10.12.

  • The bias_dtype keyword-only argument in BinaryQuadraticModel.to_serializable() now does nothing. Note that BinaryQuadraticModel.to_serializable() was removed in 0.10.0 but restored in 0.10.12.

Bug Fixes

  • Fix QuadraticModel.fix_variable() to correctly update the vartypes and bounds of of variables that are not fixed.

  • Fix QuadraticModel.fix_variable() when fixing the last variable in the quadratic model. Previously it would incorrectly raise an AttributeError.

0.10.11

New Features

  • Add .fix_variable() and .fix_variables() methods to ConstrainedQuadraticModel.

  • Add .fix_variable() and .fix_variables() methods to QuadraticModel.

  • Add QuadraticModel::resize() method in C++ code.

  • Speed up printing sample sets with a large number of variables. See #1068.

  • Add ability to pass a slice to Variables.__getitem__. This allows for syntax like variables[:5] which will return a new Variables object. See #1069.

  • Add BinaryQuadraticModel.iter_linear() method.

  • Add BinaryQuadraticModel.to_polystring() method.

  • Add QuadraticModel.iter_linear() method.

  • Add QuadraticModel.to_polystring() method.

  • Introduces variable array methods dimod.BinaryArray, dimod.SpinArray, and dimod.IntegerArray. These methods build numpy object arrays from their respective generator methods dimod.Binaries, dimod.Spins and dimod.Integers.

Upgrade Notes

  • QuadraticViewsMixin now has .add_linear() as an abstract method.

  • BinaryQuadraticModel.fix_variable() no longer raises a ValueError when given a value that does not match the variable type.

  • Python 3.6 is no longer supported.

  • NumPy 1.17 and 1.18 are no longer supported.

  • dimod.views.quadratic.QuadraticModelMixin now has an abstract property .offset.

Bug Fixes

  • Fix setting linear and quadratic biases on vartype views when the relevant variable or interaction does not already exist.

  • multiplcation_circuit now adds the carry from the most significant column in a row into the most significant column of the next row.

0.10.10

Bug Fixes

  • Fix energy calculation in binary quadratic models and quadratic models with no variables. Previously an empty sample would incorrectly raise an error.

  • bqm_structured decorator now correctly raises a BinaryQuadraticModelStructureError error in cases where nodes of the structured sampler do not include all BQM variables.

0.10.9

New Features

  • You can now install dwave-preprocessing as part of the dimod install with pip install dimod[all]

  • Add ConstrainedQuadraticModel.relabel_variables() method to relabel the variables in the objective and constraints.

  • Add drop_variables() and keep_variables() functions that allow the user to create a new sample set from an old one, retaining only a subset of the variables.

  • Backport the use of dimod.views.quadratic.Adjacency, dimod.views.quadratic.Linear, and dimod.views.quadratic.Quadratic for use with the deprecated AdjVectorBQM and AdjDictBQM binary quadratic model classes.

  • Backport iter_neighborhood(), reduce_linear(), reduce_neighborhood(), and reduce_quadratic() methods for use with the deprecated AdjVectorBQM and AdjDictBQM binary quadratic model classes.

Upgrade Notes

  • dwave-preprocessing is no longer a direct dependency. It can still be installed with pip install dimod[all].

Bug Fixes

  • Fix instance and subclass testing between deprecated and modern binary quadratic model views. For example instance(bqm.quadratic, dimod.core.bqm.BQMView) now returns True for modern binary quadratic models.

0.10.8

New Features

  • Add ExactCQMSolver class with solve_cqm method to reference solvers.

  • Add multiplication_circuit(), a binary quadratic model generator for multiplication circuits.

  • Add optional second parameter to multiplication_circuit() enabling the multiplying arguments of different sizes.

  • dimod.testing.load_sampler_bqm_tests() now also tests the deprecated BQM subclasses, namely AdjVectorBQM and AdjDictBQM.

  • Return a named tuple from BinaryQuadraticModel.to_numpy_vectors().

  • Added make_quadratic_cqm() - like make quadratic, but returns a CQM treating auxillary variable constraints as proper constraints instead of adding them to the objective.

  • Add independent_set, maximum_independent_set, and maximum_weight_independent_set functions to dimod.generators.

  • Add official support for Python 3.10.

  • Add aarch64 wheels for linux and universal wheels for osx.

  • Added reduce_binary_polynomial() that factors out a common basis for make_quadratic() and a future make_quadratic_cqm(). Given a BinaryPolynomial it return a list of reduced terms using auxillary variables and a list of constraints on them.

Deprecation Notes

  • Deprecate dimod.decorators.bqm_index_labelled_input() decorator.

Bug Fixes

  • Fix ConstrainedQuadraticModel.add_discrete() to correctly accept an iterator of variables as documented rather than instead requiring a collection.

  • Fixed edge case bug when determining dtype in as_sample().

  • No longer throw a TypeError from ConstrainedQuadraticModel.from_lp_file when adding a integer quadratic term from constraints.

  • Binary quadratic models with object data type now correctly support energy calculations where the given samples contain a superset of the variables in the model. This makes them consistent with binary quadratic models with np.float32 and np.float64 data types.

  • Fix BinaryQuadraticModel.add_linear_from to work correctly with iterables. Before linear had to be a mapping or (incorrectly) an iterator.

0.10.7

New Features

  • Add ConstrainedQuadraticModel.is_equal() and ConstrainedQuadraticModel.is_almost_equal() methods. See #1012

  • Add QuadraticModel.is_almost_equal() method

  • Support equality checks between quadratic models and binary quadratic models in BinaryQuadraticModel.is_equal(), BinaryQuadraticModel.is_almost_equal(), QuadraticModel.is_equal(), and QuadraticModel.is_almost_equal() methods.

  • Add GraphLike type hint to dimod.typing.

  • Add ConstrainedQuadraticModel.iter_constraint_data(), ConstrainedQuadraticModel.iter_violations() and ConstrainedQuadraticModel.violations() methods. See 971.

  • Added from_lp_file classmethod to ConstrainedQuadraticModel that reads input LP file and converts it to CQM instance.

  • ConstrainedQuadraticModel.set_objective now accepts an iterable.

  • Add ConstrainedQuadraticModel.check_feasible method.

  • Add random_bin_packing function with the same functionality as the (now deprecated) bin_packing.

  • Allow BinaryQuadraticModel and QuadraticModel to be divided by a scalar or squared. See #864, #984.

  • Add SampleSet.filter() method that returns a sample set with data rows filtered by a given predicate.

  • Add .to_dict() and .from_dict() methods to the sample inverter returned by the cqm_to_bqm function. The methods return a json serializable representation of the inversion for storage if needed. See 977.

  • Add random_multi_knapsack function with the same functionality as the (now deprecated) multi_knapsack.

  • Add random_knapsack function with the same functionality as the (now deprecated) knapsack.

  • Allow the offset of a BinaryQuadraticModel to be specified as a keyword argument.

  • Add PEP 561 compatibility to allow tools like mypy to auto-detect typing hints. See #980.

Upgrade Notes

  • The cls keyword argument of the chimera_anticluster function now does nothing.

Deprecation Notes

  • Deprecate cls keyword argument of the chimera_anticluster function.

  • Deprecate bin_packing function in favour of random_bin_packing.

  • Deprecate multi_knapsack function in favour of random_multi_knapsack.

  • Deprecate knapsack function in favour of random_knapsack.

Bug Fixes

  • QuadraticModel can now be multiplied by a number in place.

  • Fix energy calculations for integer variables with large values. See #982.

  • Make dimod.BinaryQuadraticModel a virtual subclass of dimod.core.bqm.BQM.

0.10.6

New Features

  • Add Binaries, Spins and Integers functions. See #918.

  • Add DiscreteQuadraticModel.get_cases method to match CaseLabelDQM.get_cases.

  • Implement QuadraticModel.remove_interaction method, previously it raised a NotImplementedError error.

  • Add linear option as a new slack_method for DiscreteQuadraticModel.add_linear_inequality_constraint method. This will add only one discrete variable to an inequality constraint with linear number of cases, according to right hand side value of the constraint.

  • Add quicksum function for faster summation of QuadraticModel and BinaryQuadraticModel. Python’s built-in sum continues to work, but quicksum will generally be faster when adding many objects.

  • Add a generator, dimod.generators.binary_encoding, to create a binary quadratic model that encodes an integer.

  • Add methods to construct a constrained quadratic model from other model types:

    • ConstrainedQuadraticModel.from_discrete_quadratic_model with an alias ConstrainedQuadraticModel.from_dqm

    • ConstrainedQuadraticModel.from_quadratic_model with two aliases ConstrainedQuadraticModel.from_qm and ConstrainedQuadraticModel.from_bqm

    See #866.

  • Add QuadraticModel.add_quadratic_from() method.

  • Add QuadraticModel.add_linear_from() method.

  • Add ConstrainedQuadraticModel.lower_bound() and ConstrainedQuadraticModel.upper_bound() methods.

  • Add cqm_to_bqm function.

  • Add ConstrainedQuadraticModel.substitute_self_loops method that replaces integer self-loops by introducing a new variable and adding a constraint.

  • Add copy_always parameter to Initialized.parse_initial_states.

  • Add new binary quadratic model generators for simple logic gates:

    • dimod.generators.and_gate

    • dimod.generators.fulladder_gate

    • dimod.generators.halfadder_gate

    • dimod.generators.or_gate

    • dimod.generators.xor_gate

    See #951.

  • QuadraticModel.energies, QuadraticModel.energy, BinaryQuadraticModel.energies, and BinaryQuadraticModel.energy now all support samples containing a superset of the variables in the model. Any variables not in the model are ignored when calculating the energy.

  • Labels for dimod.Spin, dimod.Binary, and dimod.Integer are no longer required positional arguments. By default, unique labels are applied via the uuid module.

Upgrade Notes

  • QuadraticModel.objective is now always a QuadraticModel. Previously it could either be a BinaryQuadraticModel or a QuadraticModel.

  • QuadraticModel.objective now contains all variables in the constrained quadratic model. Previously it could contain a subset of the variables.

Deprecation Notes

  • Deprecate ConstrainedQuadraticModel.variables.vartypes, ConstrainedQuadraticModel.variables.lower_bounds, and ConstrainedQuadraticModel.variables.upper_bounds attributes.

  • Deprecate ConstrainedQuadraticModel.variables.vartype() method.

Bug Fixes

  • dimod::QuadraticModelBase.remove_interaction now correctly returns true when removing a self-loop.

  • Return bool rather than numpy.bool_ from QuadraticModel.is_equal and BinaryQuadraticModel.is_equal when comparing empty models to numbers.

  • Fix as_samples and Initialized.parse_initial_states by ensuring that the copy argument is not ignored in as_samples and Initialized.parse_initial_states does not modify any input data. See #861.

  • Remove unused ConstrainedQuadraticModel.labels instance variable.

  • Fix adding constraints with integer variables via ConstrainedQuadraticModel.add_constraint_from_iterable when those integer variables have pre-existing lower or upper bounds. See #943.

  • Correctly account for the offset when multiplying binary quadratic models

  • BinaryQuadraticModel.energies now has consistent behaviour accross all data types when given samples containing a superset of the variables in the model. Previously binary quadratic models with object data type would allow a superset of variables, while float64 and float32 would not.

0.10.5

New Features

  • Add QuadraticModel.set_upper_bound and QuadraticModel.set_lower_bound methods.

Upgrade Notes

  • The preprocessing extra install argument has been removed.

  • Remove dimod.meta namespace. Its functionality, SamplerABCMeta and samplemixinmethod, has been migrated to the dimod.core.sampler namespace.

Bug Fixes

  • When a QuadraticModel already has an integer variable, adding it with QuadraticModel.add_variable with different lower or upper bounds now correctly raises an exception. Likewise, adding or multiplying the same variable symbolically with different bounds will also raise an exception.

  • When a ConstrainedQuadraticModel already has an integer variable, adding it as part of a constraint or objective with different lower or upper bounds now correctly raises an exception.

  • Make dimod.INTEGER correctly deepcopy-able.

  • Fix (deprecated) AdjVectorBQM.to_file and AdjVectorBQM.from_file. See #898.

  • Fix BinaryQuadraticModel.energies for a BQM with dtype=object and a single variable with an integer bias. Previously it would raise a numpy.core._exceptions._UFuncOutputCastingError.

  • Promote dwave-preprocessing to a full dependency of dimod to avoid issues that occur when dimod is a required package but dwave-preprocessing is not.

0.10.4

Bug Fixes

  • Fix QuadraticModel.energies when given samples with values greater than the maximum value representable by an 8 bit integer. Previously samples were incorrectly cast to 8 bit integers.

  • Fix energy calculation when the lower bound (lb) equals the upper bound (lb) in DiscreteQuadraticModel.add_linear_inequality_constraint and BinaryQuadraticModel.add_linear_inequality_constraint.

0.10.3

New Features

  • Add QuadraticModel.change_vartype() method.

  • Add C++ dimod::QuadraticModel::change_vartype() method. Also add non-const versions of dimod::QuadraticModel::vartype(), dimod::QuadraticModel::lower_bound(), and dimod::QuadraticModel::upper_bound().

Bug Fixes

  • Fix QuadraticModel.spin_to_binary not correctly updating the variable type of the changed variables.

0.10.2

Bug Fixes

  • Fix case where adding linear and quadratic biases whose class requires arguments on construction to a BinaryQuadraticModel with object dtype could fail.

0.10.1

New Features

  • Add an optional label keyword argument to ConstrainedQuadraticModel.add_discrete. The method also now returns the assigned label, whether supplied or generated. This is consistent with ConstrainedQuadraticModel.add_constraint.

  • cyBQM and cyQM fused types can now be cimported from the dimod namespace.

  • Add .data() method to cyQM_template and cyBQM_template that returns a const pointer to the underlying C++ QuadraticModel and BinaryQuadraticModel respectively.

Upgrade Notes

  • BinaryQuadraticModel.data.vartype() is now accessed as a method rather than as an attribute. This is consistent with QuadraticModel.data.vartype().

  • from dimod cimport cyBQM now is a fused type containing cyBQM_float32 and cyBQM_float64. You can use the cyBQM containing cyAdjVectorBQM with from dimod.bqm cimport cyBQM.

Bug Fixes

  • Fix wrong behaviour when the lower bound (lb) equals the upper bound (lb) in add_linear_equality_constraint. Correct behaviour is to add constraint as eqaulity when lb is equal ub.

0.10.0rc1

New Features

  • Add num_quadratic_variables to the header of the file created by ConstrainedQuadraticModel.to_file. This increments the version to 1.1.

  • You can now install preprocessing as part of the dimod install with pip install dimod[preprocessing]

Deprecation Notes

  • Some composites have been migrated to dwave-preprocessing. The affected composites:

    • ClipComposite

    • ConnectedComponentsComposite

    • FixedVariableComposite

    • RoofDualityComposite

    • ScaleComposite

    • SpinReversalTransformComposite

    you no longer can use the composites without having dwave-preprocessing installed. Using them with it installed results in a deprecation warning.

0.10.0.dev8

New Features

  • Add bin_packing, knapsack and multi_knapsack constrained quadratic model generators.

  • Add BinaryQuadraticModel.is_almost_equal method for testing approximate equality to other binary quadratic models.

  • Add Variables.copy method, implemented as a cpdef method for Cython and Python access.

  • Support specifying lower and upper bounds for integer variables in quadratic models:

    • Add lower_bound and upper_bound keyword arguments to QuadraticModel.add_variable.

    • Add QuadraticModel.lower_bound and QuadraticModel.upper_bound methods.

Upgrade Notes

  • Remove dimod.utils.LockableDict and dimod.decorators.lockable_method. Also SampleSet.is_writeable can no longer be set to False.

Deprecation Notes

  • AdjVectorBQM and AdjDictBQM are deprecated and will be removed in dimod 0.11.0. Use BinaryQuadraticModel with dtype=np.float64 and dtype=object respectively.

  • SampleSet.is_writeable is deprecated and now always returns True.

Bug Fixes

  • Add support for AdjVectorBQM and AdjDictBQM in ConstrainedQuadraticModel.

  • Fix shallow copies of Variables objects when using copy.copy.

  • Implement rule of five for dimod::NeighborhoodIterator, dimod::ConstNeighborhoodIterator, and dimod::ConstQuadraticIterator. This fixes double frees caused by the default copy constructor copying information that is not intended to be shared.

  • Fix shallow copies of BinaryQuadraticModel with object dtype when using copy.copy.

0.10.0.dev7

Prelude

Add QuadraticModel implementation to Python, Cython and C++. Quadratic models can be represented by a degree 2 polynomial over binary, spin and integer variables.

We began using Reno as a changelog tool after the release of 0.10.0.dev6. Content added before that release is not included. See releases for previous release notes.

New Features

  • Add ConstrainedQuadraticModel.add_discrete method. This allows users to create a discrete variable via a one-hot constraint. A disjoint set of discrete variables are tracked by the CQM and serialized.

  • Add support for quadratic model objectives and constraints in constrained quadratic models. Previously CQMs only supported binary quadratic models.

  • Add new QuadraticModel class for creating quadratic models.

  • Add CaseLabelDQM class. Provides means of labeling cases of discrete variables.

  • Begin using reno for changelog.

  • Add BinaryQuadraticModel.add_linear_inequality_constraint and DiscreteQuadraticModel.add_linear_inequality_constraint methods.

  • Create dimod/libcpp.pxd Cython header file. This allows user to cimport C++ classes and functions defined in dimod/include/

  • Use C++ BinaryQuadraticModel rather than AdjVectorBQM as the underlying object in cyDiscreteQuadraticModel. This means that the underlying implementation is now version controlled.

  • Add new Vartype.INTEGER variable type.

  • Add QuadraticModelBase::scale method. Scales offset, linear biases, and quadratic biases by a provided scale factor.

Upgrade Notes

  • Symbolically multiplying, subtracting and adding BinaryQuadraticModel`s with different vartypes now creates a `QuadraticModel rather than raising an error.

  • Use C++ BinaryQuadraticModel rather than AdjVectorBQM as the underlying object in cyDiscreteQuadraticModel. Any code that relied on the old AdjVectorBQM implementation will need to be upgraded.

  • Make dimod.vartypes.ExtendedVartype an alias for dimod.vartypes.Vartype. Also remove ExtendedVartypeLike from dimod.vartypes and dimod.typing.

Bug Fixes

  • Fix subtracting a BinaryQuadraticModel from a number. Before it would return bqm - 1 rather than correctly returning 1 - bqm.

  • Stop using deprecated numpy aliases like np.int, np.float, and np.complex.