using UnityEngine;
namespace Unity.MLAgents
{
///
/// A class holding the capabilities flags for Reinforcement Learning across C# and the Trainer codebase.
///
public class UnityRLCapabilities
{
///
/// Base RL capabilities.
///
public bool BaseRLCapabilities;
///
/// Concatenated PNG observations.
///
public bool ConcatenatedPngObservations;
///
/// Compressed channel mapping.
///
public bool CompressedChannelMapping;
///
/// Hybrid actions.
///
public bool HybridActions;
///
/// Training analytics.
///
public bool TrainingAnalytics;
///
/// Variable length observation.
///
public bool VariableLengthObservation;
///
/// Multi-agent groups.
///
public bool MultiAgentGroups;
///
/// A class holding the capabilities flags for Reinforcement Learning across C# and the Trainer codebase. This
/// struct will be used to inform users if and when they are using C# / Trainer features that are mismatched.
///
/// Base RL capabilities.
/// Concatenated PNG observations.
/// Compressed channel mapping.
/// Hybrid actions.
/// Training analytics.
/// Variable length observation.
/// Multi-agent groups.
public UnityRLCapabilities(
bool baseRlCapabilities = true,
bool concatenatedPngObservations = true,
bool compressedChannelMapping = true,
bool hybridActions = true,
bool trainingAnalytics = true,
bool variableLengthObservation = true,
bool multiAgentGroups = true)
{
BaseRLCapabilities = baseRlCapabilities;
ConcatenatedPngObservations = concatenatedPngObservations;
CompressedChannelMapping = compressedChannelMapping;
HybridActions = hybridActions;
TrainingAnalytics = trainingAnalytics;
VariableLengthObservation = variableLengthObservation;
MultiAgentGroups = multiAgentGroups;
}
///
/// Will print a warning to the console if Python does not support base capabilities and will
/// return true if the warning was printed.
///
/// True if the warning was printed, False if not.
public bool WarnOnPythonMissingBaseRLCapabilities()
{
if (BaseRLCapabilities)
{
return false;
}
Debug.LogWarning("Unity has connected to a Training process that does not support" +
"Base Reinforcement Learning Capabilities. Please make sure you have the" +
" latest training codebase installed for this version of the ML-Agents package.");
return true;
}
}
}