Class MultiAgentEnvironment
java.lang.Object
neqsim.process.ml.multiagent.MultiAgentEnvironment
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SeparatorCompressorMultiAgentEnv
Multi-agent environment for coordinated process control.
Manages multiple agents that each control a subset of process equipment while respecting global constraints. Supports various multi-agent paradigms:
- Independent - Agents act independently with local observations
- Centralized Training Decentralized Execution (CTDE) - Shared critic during training
- Communicating - Agents exchange messages before acting
Usage Example:
MultiAgentEnvironment env = new MultiAgentEnvironment(processSystem);
env.addAgent(separatorAgent);
env.addAgent(compressorAgent);
env.setSharedConstraints(globalConstraints);
Map<String, double[]> obs = env.reset();
while (!env.isDone()) {
Map<String, double[]> actions = getActionsFromPolicies(obs);
MultiAgentStepResult result = env.step(actions);
obs = result.observations;
}
- Version:
- 1.0
- Author:
- ESOL
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumCoordination mode for multi-agent systems.static classStep result for multi-agent environment. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StateVectorprivate intprivate intprivate final ProcessSystemprivate static final longprivate ConstraintManagerprivate booleanprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionMultiAgentEnvironment(ProcessSystem process) Create a multi-agent environment. -
Method Summary
Modifier and TypeMethodDescriptionAdd an agent to the environment.protected doublecomputeTeamReward(StateVector state, Map<String, double[]> actions) Compute team reward for cooperative mode.Get a specific agent.Get agent IDs in order.Get current global state.intGet current step.protected StateVectorGet global state from process.intGet number of agents.Get the process system.booleanisDone()Check if episode is done.reset()Reset the environment.Set coordination mode.setMaxEpisodeSteps(int maxSteps) Set maximum episode steps.setSharedConstraints(ConstraintManager constraints) Set shared constraints for all agents.Take a step with all agents' actions.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
process
-
agents
-
agentOrder
-
coordinationMode
-
currentStep
private int currentStep -
maxEpisodeSteps
private int maxEpisodeSteps -
terminated
private boolean terminated -
truncated
private boolean truncated -
currentGlobalState
-
messages
-
-
Constructor Details
-
MultiAgentEnvironment
Create a multi-agent environment.- Parameters:
process- the process system
-
-
Method Details
-
addAgent
Add an agent to the environment.- Parameters:
agent- the agent to add- Returns:
- this environment for chaining
-
setCoordinationMode
Set coordination mode.- Parameters:
mode- coordination mode- Returns:
- this environment for chaining
-
setMaxEpisodeSteps
Set maximum episode steps.- Parameters:
maxSteps- maximum steps- Returns:
- this environment for chaining
-
reset
-
step
Take a step with all agents' actions.- Parameters:
actions- map of agent ID to action array- Returns:
- step result
-
getGlobalState
-
computeTeamReward
Compute team reward for cooperative mode.- Parameters:
state- global stateactions- all agent actions- Returns:
- team reward
-
isDone
public boolean isDone()Check if episode is done.- Returns:
- true if terminated or truncated
-
getNumAgents
public int getNumAgents()Get number of agents.- Returns:
- agent count
-
getAgentIds
-
getAgent
-
getCurrentGlobalState
-
getProcess
-
getCurrentStep
public int getCurrentStep()Get current step.- Returns:
- step count
-