HigherOrderComposite.sample_poly(poly, penalty_strength=1.0, keep_penalty_variables=False, discard_unsatisfied=False, **parameters)[source]#

Sample from the given binary polynomial.

Introduces penalties to reduce the given higher-order binary polynomial to a quadratic problem and sends it to its child sampler.

  • poly (BinaryPolynomial) – A binary polynomial.

  • penalty_strength (float, optional) – Strength of the reduction constraint. Insufficient strength can result in the binary quadratic model not having the same minimization as the polynomial.

  • keep_penalty_variables (bool, optional, default=True) – Setting to False removes the variables used for penalty from the samples.

  • discard_unsatisfied (bool, optional, default=False) – Setting to True discards samples that do not satisfy the penalty conditions.

  • initial_state (dict, optional) – Only accepted when the child sampler accepts an initial state. The initial state is given in terms of the variables in the binary polynomial. The corresponding initial values are populated for use by the child sampler.

  • **parameters – Parameters for the sampling method, specified by the child sampler.