factoriax.engine.envs.science_tiers#
ScienceTiers-v1: a throughput reward over a science economy of three tiers.
This scenario has one currency. A lab consumes a science pack of any tier, and every pack pays a reward of 1 on the tick where the lab consumes it. There are no achievement bits and no per-tier reward weights. The tier ladder lives in the recipe book alone. There, the ore cost doubles with each tier while the pack output goes up by a factor of four:
tier |
recipe |
ore cost |
output |
science/ore |
|---|---|---|---|---|
1 |
coal + limestone |
2 |
1 |
0.5 |
2 |
tier-1 pack + wire |
4 |
4 |
1.0 |
3 |
tier-2 pack + motor |
8 |
16 |
2.0 |
A wire is iron plus tin ore. A motor is a wire plus a frame. A frame is copper plus silicon ore. Every half-fabricate therefore ends in raw ore, and the ore costs in the table above are exact.
Each tier consumes the pack of the tier below it. To climb, an agent must give up packs that it can spend at once. The steady throughput for each unit of ore doubles with each tier, but the return arrives only after the longer chain runs. That tension is the research target: an agent that stops at a lower tier against an agent that invests through it.
The world is the shared 16x16 six-patch map, with one 2x2 patch for each ore. One science lab stands on the tile that the player faces at the start, so an agent can find the consume-for-reward loop and does not first have to work out that labs exist. An agent can craft more labs, miners, assemblers, belts, and arms from raw ore.
The observation defaults match the miner curriculum: the egocentric
superficial_local with radius 7. A policy network therefore transfers
between the two.
Module Attributes
Length of an episode. |
|
The three packs that a lab consumes, in tier order. |
|
Raw-ore cost of one pack craft, by tier. |
|
Packs that one craft produces, by tier. |
- factoriax.engine.envs.science_tiers.SCIENCE_TIERS_MAX_TIMESTEPS: int = 1000#
Length of an episode. It is longer than the 300 steps of the curriculum, because the tier-3 chain must pay back its setup time before it earns more than tier-1 hand play.
- factoriax.engine.envs.science_tiers.TIER_ORE_COSTS: tuple[int, ...] = (2, 4, 8)#
Raw-ore cost of one pack craft, by tier. Each half-fabricate counts as the ore that it costs.
- factoriax.engine.envs.science_tiers.TIER_OUTPUTS: tuple[int, ...] = (1, 4, 16)#
Packs that one craft produces, by tier. The ore cost doubles with each tier and the output goes up by a factor of four, so the science for each unit of ore doubles: 0.5, then 1.0, then 2.0.
- factoriax.engine.envs.science_tiers.TIER_PACKS: tuple[int, ...] = (16, 17, 23)#
The three packs that a lab consumes, in tier order.
- factoriax.engine.envs.science_tiers.science_tiers(*, obs: str = 'superficial_local', obs_radius: int = 7) tuple[FactoriaxEnv, EnvParams]#
Build the ScienceTiers-v1 environment.
The player starts with an empty inventory on the six-patch map, and one lab already stands on it. The reward is the number of packs that the labs consume in each tick. The score has no upper limit, and the episode runs the full 1000 ticks.
- Parameters:
obs – Observation variant. The function passes it to
FactoriaxEnv.obs_radius – Half-width of the egocentric local window. The default radius 7 gives a 15x15 view on the 16x16 map. A
_globalvariant ignores it.
- factoriax.engine.envs.science_tiers.science_tiers_reward(prev_state: EnvState, new_state: EnvState, params: EnvParams) Array#
Count the packs that the labs consumed in this tick, 1 for every tier.
science_consumed_stepis the consumption delta of one tick, and the step sets it to zero at its start. This reward is therefore a dense throughput reward with no latch. More science is always more reward, and the extra value of a higher tier comes from the output counts in the recipe book alone.