GAMechanism

class negmas.ga.GAMechanism(*args, n_population: int = 100, mutate_rate: float = 0.1, **kwargs)[source]

Bases: negmas.mechanisms.Mechanism

Naive GA-based mechanism that assume multi-issue discrete domains.

Parameters
  • *args – positional arguments to be passed to the base Mechanism

  • **kwargs – keyword arguments to be passed to the base Mechanism

  • n_population – The number of outcomes for each generation

  • mutate_rate – The rate of mutation

Methods Summary

crossover(outcome1, outcome2)

Uniform crossover

extra_state()

Returns any extra state information to be kept in the state and history properties

generate(n)

mutate(outcome)

Uniform crossover with random outcome

next_generation(parents)

Generate the next generation from parents

round()

Implements a single step of the mechanism.

select(outcomes)

Select Pareto optimal outcomes

update_dominant_outcomes()

Return dominant outcomes of population

update_ranks()

Methods Documentation

crossover(outcome1: Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]], outcome2: Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]])Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]][source]

Uniform crossover

extra_state()[source]

Returns any extra state information to be kept in the state and history properties

generate(n: int)List[Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]]][source]
mutate(outcome: Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]])Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]][source]

Uniform crossover with random outcome

next_generation(parents: List[Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]]])List[Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]]][source]

Generate the next generation from parents

round()negmas.mechanisms.MechanismRoundResult[source]

Implements a single step of the mechanism. Override this!

Returns

MechanismRoundResult giving whether the negotiation was broken or timedout and the agreement if any.

select(outcomes: List[Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]]])List[Union[negmas.outcomes.OutcomeType, Tuple[Union[int, float, str, list]], Dict[Union[int, str], Union[int, float, str, list]]]][source]

Select Pareto optimal outcomes

update_dominant_outcomes()[source]

Return dominant outcomes of population

update_ranks()[source]