scml.oneshot.context
Module Contents
Classes
Basic Parameters you can assume about a context. Returned by |
|
A context used for generating worlds satisfying predefined conditions and testing for them |
|
A context that generates oneshot worlds with agents of a given |
|
Generates a world limiting the range of the agent level, production capacity |
|
Generates a world limiting the range of the agent level, production capacity |
|
An agent that has no competitors in the same level as themselves |
|
A world in which every level has exactly one factory and the agent is a supplier |
|
An unrealistic context in which the agent is the only one in its level and all other agents are nice. |
|
An unrealistic context in which the agent is the only supplier and all consumers are nice. |
|
An unrealistic context in which the agent is the only consumer and all suppliers are nice. |
|
Generates a world limiting the range of the agent level, production capacity |
|
Generates a oneshot world with no constraints except compatibility with a specific ANAC competition year. |
|
Generates a oneshot world limiting the range of the agent level, production capacity |
|
Generates a oneshot world with no constraints except compatibility with a specific ANAC competition year. |
|
A world context that can generate any world compatible with the observation manager |
|
A supplier with almost many consumers relative to competitors |
|
A supplier with almost same number of consumers as competitors |
|
A supplier with few consumers relative to competitors |
|
A world context that can generate any world compatible with the observation manager |
|
A consumer with almost many suppliers relative to competitors |
|
A consumer with almost same number of suppliers as competitors |
|
A consumer with few suppliers relative to competitors |
|
Encapsulates one or more configs and switches between them when asked to generate or make something. |
- class scml.oneshot.context.ContextParams[source]
Basic Parameters you can assume about a context. Returned by
extract_context_params
- class scml.oneshot.context.Context[source]
Bases:
abc.ABC
A context used for generating worlds satisfying predefined conditions and testing for them
- abstract generate(types: tuple[type[scml.oneshot.agent.OneShotAgent], Ellipsis] | None = None, params: tuple[dict[str, Any], Ellipsis] | None = None, name: str | None = None) tuple[scml.oneshot.world.SCMLBaseWorld, tuple[scml.oneshot.agent.OneShotAgent]] [source]
Generates a world with one or more agents to be controlled externally and returns both
- Parameters:
agent_types – The types of a list of agents to be guaranteed to exist in the world
agent_params – The parameters to pass to the constructors of these agents. None means no parameters for any agents
name – The name of the worlds to generate. Uses a random name if not given
- Returns:
The constructed world and a tuple of the agents created corresponding (in order) to the given agent types/params
- abstract is_valid_world(world: scml.oneshot.world.SCMLBaseWorld) bool [source]
Checks that the given world could have been generated from this context
- abstract is_valid_awi(awi: scml.oneshot.awi.OneShotAWI) bool [source]
Checks that the given AWI is connected to a world that could have been generated from this context
- abstract contains_context(context: Context) bool [source]
Checks that the any world generated from the given
context
could have been generated from this context
- __contains__(other: SCMLBaseWorld | OneShotAWI | Context) bool [source]
- class scml.oneshot.context.GeneralContext[source]
Bases:
BaseContext
A context that generates oneshot worlds with agents of a given
types
with predetermined structure and settings- make_predefined_config(agent_types: list[type[scml.oneshot.agent.OneShotAgent]], agent_processes: list[int], agent_params: list[dict[str, Any]], n_agents_per_process: list[int]) dict[str, Any] [source]
Generates a config for a world
- contains_context(context: Context, raise_on_failure: bool = False, warn_on_failure: bool = False, n_tests: int = NTESTS) bool [source]
Checks that the any world generated from the given
context
could have been generated from this context
- is_valid_world(world: scml.oneshot.world.SCMLBaseWorld, raise_on_failure: bool = False, warn_on_failure: bool = False, types: tuple[str | type[scml.oneshot.agent.OneShotAgent], Ellipsis] | None = None) bool [source]
Checks that the given world could have been generated from this context
- contains_general_context(context: GeneralContext) bool [source]
Checks that the any world generated from the given
context
could have been generated from this context
- class scml.oneshot.context.LimitedPartnerNumbersContext[source]
Bases:
GeneralContext
Generates a world limiting the range of the agent level, production capacity and the number of suppliers, consumers, and optionally same-level competitors.
- find_test_agents(world: scml.oneshot.world.SCMLBaseWorld, types: tuple[type[scml.oneshot.agent.OneShotAgent], Ellipsis] | None = None) list[str] [source]
- is_valid_world(world: scml.oneshot.world.SCMLBaseWorld, types: tuple[type[scml.oneshot.agent.OneShotAgent], Ellipsis] | None = None, raise_on_failure: bool = False, warn_on_failure: bool = False) bool [source]
Checks that the given world could have been generated from this context
- class scml.oneshot.context.FixedPartnerNumbersContext[source]
Bases:
LimitedPartnerNumbersContext
Generates a world limiting the range of the agent level, production capacity and the number of suppliers, consumers, and optionally same-level competitors.
- class scml.oneshot.context.MonopolicContext[source]
Bases:
LimitedPartnerNumbersContext
An agent that has no competitors in the same level as themselves
- class scml.oneshot.context.SingleAgentPerLevelSupplierContext[source]
Bases:
MonopolicContext
A world in which every level has exactly one factory and the agent is a supplier
- class scml.oneshot.context.EutopiaContext[source]
Bases:
MonopolicContext
An unrealistic context in which the agent is the only one in its level and all other agents are nice.
- class scml.oneshot.context.EutopiaSupplierContext[source]
Bases:
EutopiaContext
An unrealistic context in which the agent is the only supplier and all consumers are nice.
- class scml.oneshot.context.EutopiaConsumerContext[source]
Bases:
EutopiaContext
An unrealistic context in which the agent is the only consumer and all suppliers are nice.
- class scml.oneshot.context.FixedPartnerNumbersOneShotContext[source]
Bases:
FixedPartnerNumbersContext
Generates a world limiting the range of the agent level, production capacity and the number of suppliers, consumers, and optionally same-level competitors.
- class scml.oneshot.context.ANACContext[source]
Bases:
GeneralContext
Generates a oneshot world with no constraints except compatibility with a specific ANAC competition year.
- class scml.oneshot.context.LimitedPartnerNumbersOneShotContext[source]
Bases:
LimitedPartnerNumbersContext
Generates a oneshot world limiting the range of the agent level, production capacity and the number of suppliers, consumers, and optionally same-level competitors.
- class scml.oneshot.context.ANACOneShotContext[source]
Bases:
ANACContext
Generates a oneshot world with no constraints except compatibility with a specific ANAC competition year.
- class scml.oneshot.context.SupplierContext(*args, **kwargs)[source]
Bases:
LimitedPartnerNumbersOneShotContext
A world context that can generate any world compatible with the observation manager
- class scml.oneshot.context.StrongSupplierContext(*args, **kwargs)[source]
Bases:
SupplierContext
A supplier with almost many consumers relative to competitors
- class scml.oneshot.context.BalancedSupplierContext(*args, **kwargs)[source]
Bases:
SupplierContext
A supplier with almost same number of consumers as competitors
- class scml.oneshot.context.WeakSupplierContext(*args, **kwargs)[source]
Bases:
SupplierContext
A supplier with few consumers relative to competitors
- class scml.oneshot.context.ConsumerContext(*args, **kwargs)[source]
Bases:
LimitedPartnerNumbersOneShotContext
A world context that can generate any world compatible with the observation manager
- class scml.oneshot.context.StrongConsumerContext(*args, **kwargs)[source]
Bases:
ConsumerContext
A consumer with almost many suppliers relative to competitors
- class scml.oneshot.context.BalancedConsumerContext(*args, **kwargs)[source]
Bases:
ConsumerContext
A consumer with almost same number of suppliers as competitors
- class scml.oneshot.context.WeakConsumerContext(*args, **kwargs)[source]
Bases:
ConsumerContext
A consumer with few suppliers relative to competitors
- class scml.oneshot.context.RepeatingContext[source]
Bases:
BaseContext
Encapsulates one or more configs and switches between them when asked to generate or make something.
- make_config(types: tuple[type[scml.oneshot.agent.OneShotAgent], Ellipsis] = DEFAULT_PLACEHOLDER_AGENT_TYPES, params: tuple[dict[str, Any], Ellipsis] | None = None) dict[str, Any] [source]
Generates a config for a world
- classmethod from_context(context: BaseContext, n: int = 1, types: tuple[type[scml.oneshot.agent.OneShotAgent]] = DEFAULT_PLACEHOLDER_AGENT_TYPES, rename: bool = False, randomize: bool = False)[source]
- contains_repeating_context(context: RepeatingContext, raise_on_failure: bool = False, warn_on_failure: bool = False)[source]
- is_valid_world(world: scml.oneshot.world.SCMLBaseWorld, raise_on_failure=RAISE_ON_FAILURE, warn_on_failure=WARN_ON_FAILURE, types: tuple[str | type[scml.oneshot.agent.OneShotAgent], Ellipsis] | None = None) bool [source]
Checks that the given world could have been generated from this context