thoth.adviser.predictors package

Submodules

thoth.adviser.predictors.annealing module

Implementation of Adaptive Simulated Annealing (ASA) used to resolve software stacks.

class thoth.adviser.predictors.annealing.AdaptiveSimulatedAnnealing(*, keep_history=None, temperature_history: List[Tuple[float, bool, float, int]] = NOTHING, temperature: float = 0.0)[source]

Bases: thoth.adviser.predictor.Predictor

Implementation of adaptive simulated annealing looking for stacks based on the scoring function.

plot() → matplotlib.figure.Figure[source]

Plot temperature history of adaptive simulated annealing.

pre_run() → None[source]

Initialization before the actual annealing run.

run() → Tuple[thoth.adviser.state.State, Tuple[str, str, str]][source]

Run adaptive simulated annealing on top of beam.

thoth.adviser.predictors.hill_climbing module

Implementation of hill climbing in the state space.

class thoth.adviser.predictors.hill_climbing.HillClimbing(history: List[Tuple[float, int]] = NOTHING, *, keep_history=None)[source]

Bases: thoth.adviser.predictor.Predictor

Implementation of hill climbing in the state space.

plot() → matplotlib.figure.Figure[source]

Plot score of the highest rated stack during hill climbing.

pre_run() → None[source]

Initialization before the actual hill climbing run.

run() → Tuple[thoth.adviser.state.State, Tuple[str, str, str]][source]

Get top state from the beam for the next resolution round.

thoth.adviser.predictors.latest module

Implementation of predictor used for resolving latest stacks in the state space.

class thoth.adviser.predictors.latest.ApproximatingLatest(history: List[Tuple[float, int]] = NOTHING, hop: bool = False, hop_logged: bool = False, *, keep_history=None)[source]

Bases: thoth.adviser.predictors.hill_climbing.HillClimbing

Implementation of predictor used for resolving latest stacks in the state space.

This predictor approximates resolution to the latest software stack. The resolution to the latest is approximated using continuous resolution with an optional randomness not to get stuck in a “trap” if resolution to all latest cannot be satisfied.

pre_run() → None[source]

Initialize local variables before each predictor run per resolver.

run() → Tuple[thoth.adviser.state.State, Tuple[str, str, str]][source]

Get last state expanded and expand first unresolved dependency.

set_reward_signal(state: thoth.adviser.state.State, package_tuple: Tuple[str, str, str], reward: float) → None[source]

Set hop to True if we did not get resolve any stack with latest.

thoth.adviser.predictors.random_walk module

Implementation of a Random Walk based dependency graph sampling predictor.

class thoth.adviser.predictors.random_walk.RandomWalk(history: List[Tuple[float, int]] = NOTHING, *, keep_history=None)[source]

Bases: thoth.adviser.predictor.Predictor

Implementation of a Random Walk based dependency graph sampling predictor.

plot() → matplotlib.figure.Figure[source]

Plot score of the highest rated stack during sampling.

pre_run() → None[source]

Initialization before the random walk run.

run() → Tuple[thoth.adviser.state.State, Tuple[str, str, str]][source]

Generate stacks using random walking.

thoth.adviser.predictors.sampling module

Implementation of a random sampling of the state space.

class thoth.adviser.predictors.sampling.Sampling(history: List[Tuple[float, int]] = NOTHING, *, keep_history=None)[source]

Bases: thoth.adviser.predictor.Predictor

Implementation of a random sampling of the state space.

plot() → matplotlib.figure.Figure[source]

Plot score of the highest rated stack during sampling.

pre_run() → None[source]

Initialization before the sampling run.

run() → Tuple[thoth.adviser.state.State, Tuple[str, str, str]][source]

Get random state and random unresolved dependency from the beam for the next resolution round.

Module contents

Implementation of predictors used with resolver..

class thoth.adviser.predictors.AdaptiveSimulatedAnnealing(*, keep_history=None, temperature_history: List[Tuple[float, bool, float, int]] = NOTHING, temperature: float = 0.0)[source]

Bases: thoth.adviser.predictor.Predictor

Implementation of adaptive simulated annealing looking for stacks based on the scoring function.

plot() → matplotlib.figure.Figure[source]

Plot temperature history of adaptive simulated annealing.

pre_run() → None[source]

Initialization before the actual annealing run.

run() → Tuple[thoth.adviser.state.State, Tuple[str, str, str]][source]

Run adaptive simulated annealing on top of beam.

class thoth.adviser.predictors.ApproximatingLatest(history: List[Tuple[float, int]] = NOTHING, hop: bool = False, hop_logged: bool = False, *, keep_history=None)[source]

Bases: thoth.adviser.predictors.hill_climbing.HillClimbing

Implementation of predictor used for resolving latest stacks in the state space.

This predictor approximates resolution to the latest software stack. The resolution to the latest is approximated using continuous resolution with an optional randomness not to get stuck in a “trap” if resolution to all latest cannot be satisfied.

pre_run() → None[source]

Initialize local variables before each predictor run per resolver.

run() → Tuple[thoth.adviser.state.State, Tuple[str, str, str]][source]

Get last state expanded and expand first unresolved dependency.

set_reward_signal(state: thoth.adviser.state.State, package_tuple: Tuple[str, str, str], reward: float) → None[source]

Set hop to True if we did not get resolve any stack with latest.

class thoth.adviser.predictors.HillClimbing(history: List[Tuple[float, int]] = NOTHING, *, keep_history=None)[source]

Bases: thoth.adviser.predictor.Predictor

Implementation of hill climbing in the state space.

plot() → matplotlib.figure.Figure[source]

Plot score of the highest rated stack during hill climbing.

pre_run() → None[source]

Initialization before the actual hill climbing run.

run() → Tuple[thoth.adviser.state.State, Tuple[str, str, str]][source]

Get top state from the beam for the next resolution round.

class thoth.adviser.predictors.RandomWalk(history: List[Tuple[float, int]] = NOTHING, *, keep_history=None)[source]

Bases: thoth.adviser.predictor.Predictor

Implementation of a Random Walk based dependency graph sampling predictor.

plot() → matplotlib.figure.Figure[source]

Plot score of the highest rated stack during sampling.

pre_run() → None[source]

Initialization before the random walk run.

run() → Tuple[thoth.adviser.state.State, Tuple[str, str, str]][source]

Generate stacks using random walking.

class thoth.adviser.predictors.Sampling(history: List[Tuple[float, int]] = NOTHING, *, keep_history=None)[source]

Bases: thoth.adviser.predictor.Predictor

Implementation of a random sampling of the state space.

plot() → matplotlib.figure.Figure[source]

Plot score of the highest rated stack during sampling.

pre_run() → None[source]

Initialization before the sampling run.

run() → Tuple[thoth.adviser.state.State, Tuple[str, str, str]][source]

Get random state and random unresolved dependency from the beam for the next resolution round.