citoolkit.improvisers package

Submodules

citoolkit.improvisers.classic_ci module

Contains the ClassicCI class, which acts as an improviser for the Classic CI problem.

class citoolkit.improvisers.classic_ci.ClassicCI(hard_constraint, soft_constraint, length_bounds, epsilon, prob_bounds)[source]

Bases: citoolkit.improvisers.improviser.Improviser

An improviser for the “Control Improvisation” problem.

Parameters
  • hard_constraint (Spec) – A specification that must accept all improvisations

  • soft_constraint (Spec) – A specification that must accept improvisations with probability 1 - epsilon.

  • length_bounds (Tuple[int, int]) – A tuple containing lower and upper bounds on the length of a generated word.

  • epsilon (float) – The allowed tolerance with which we can not satisfy the soft constraint.

  • prob_bounds (Tuple[float, float]) – A tuple containing lower and upper bounds on the probability with which we can generate a word.

Raises
  • ValueError – If passed parameters are not of the correct type.

  • InfeasibleImproviserError – If the resulting improvisation problem is not feasible.

Return type

None

improvise()[source]

Improvise a single word.

Returns

A single improvised word.

Return type

Tuple[str, …]

citoolkit.improvisers.improviser module

Contains the Improviser class, from which all CI improvisers should inherit.

class citoolkit.improvisers.improviser.Improviser[source]

Bases: object

The Improviser class is a parent class to all CI improvisers.

generator()[source]

Create a generator that continually improvises words.

Returns

An iterable that will indefinitely improvise words.

Return type

Iterator[Tuple[str, …]]

improvise()[source]

Improvise a single word.

Returns

A single improvised word.

Return type

Tuple[str, …]

exception citoolkit.improvisers.improviser.InfeasibleImproviserError[source]

Bases: Exception

An exception raised when an improvisation problem is infeasible.

Module contents