# dimod.reference.composites.HigherOrderComposite.sample_poly¶

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

Sample from the given binary polynomial.

Takes the given binary polynomial, introduces penalties, reduces the higher-order problem into a quadratic problem and sends it to its child sampler.

Parameters: 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 is True. if False will remove the variables used for penalty from the samples discard_unsatisfied (bool, optional) – default is False. If True will discard 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 child sampler. (the) – dimod.SampleSet