浏览代码

Light proofreading.

/2.0-verified
Chris Goy 4 年前
当前提交
83c7ed74
共有 5 个文件被更改,包括 28 次插入28 次删除
  1. 6
      com.unity.ml-agents/Documentation~/com.unity.ml-agents.md
  2. 8
      com.unity.ml-agents/Runtime/Actuators/IDiscreteActionMask.cs
  3. 36
      com.unity.ml-agents/Runtime/Integrations/Match3/AbstractBoard.cs
  4. 2
      com.unity.ml-agents/Runtime/Sensors/GridSensorComponent.cs
  5. 4
      com.unity.ml-agents/Runtime/Sensors/ISensor.cs

6
com.unity.ml-agents/Documentation~/com.unity.ml-agents.md


The _ML-Agents_ package contains the primary C# SDK for the [Unity ML-Agents
Toolkit].
The package allows you to convert any Unity scene to into a learning environment
The package allows you to convert any Unity scene into a learning environment
and train character behaviors using a variety of machine learning algorithms.
Additionally, it allows you to embed these trained behaviors back into Unity
scenes to control your characters. More specifically, the package provides the

are entities that generate observations (through sensors), take actions, and
receive rewards from the environment.
- Define Behaviors: entities that specifiy how an agent should act. Multiple
- Define Behaviors: entities that specify how an agent should act. Multiple
agents can share the same Behavior and a scene may have multiple Behaviors.
- Record demonstrations of an agent within the Editor. You can use
demonstrations to help train a behavior for that agent.

[installation instructions] on our [GitHub repository].
### Advanced Installation
With the changes to Unity Package Manager in 2021, experimental packages will not show up in package list and have to be installed manually. There are two recommended ways to install the package manually:
With the changes to Unity Package Manager in 2021, experimental packages will not show up in the package list and have to be installed manually. There are two recommended ways to install the package manually:
#### Github via Package Manager

8
com.unity.ml-agents/Runtime/Actuators/IDiscreteActionMask.cs


/// <remarks>
/// By default, all discrete actions are allowed.
/// If isEnabled is false, the agent will not be able to perform the actions passed as argument
/// at the next decision for the specified action branch. The actionIndex correspond
/// at the next decision for the specified action branch. The actionIndex corresponds
/// [Agents - Actions]: https://github.com/Unity-Technologies/ml-agents/blob/release_17_docs/docs/Learning-Environment-Design-Agents.md#actions
/// [Agents - Actions]: https://github.com/Unity-Technologies/ml-agents/blob/release_17_docs/docs/Learning-Environment-Design-Agents.md#masking-discrete-actions
/// <param name="actionIndex">Index of the action</param>
/// <param name="isEnabled">Whether the action is allowed or now.</param>
/// <param name="actionIndex">Index of the action.</param>
/// <param name="isEnabled">Whether the action is allowed or not.</param>
void SetActionEnabled(int branch, int actionIndex, bool isEnabled);
}
}

36
com.unity.ml-agents/Runtime/Integrations/Match3/AbstractBoard.cs


/// <param name="lhs"></param>
/// <param name="rhs"></param>
/// <returns>True if all fields are less than or equal.</returns>
public static bool operator <=(BoardSize lhs, BoardSize rhs)
public static bool operator<=(BoardSize lhs, BoardSize rhs)
lhs.NumSpecialTypes <= rhs.NumSpecialTypes;
lhs.NumSpecialTypes <= rhs.NumSpecialTypes;
}
/// <summary>

/// <param name="rhs"></param>
/// <returns>True if all fields are greater than or equal.</returns>
public static bool operator >=(BoardSize lhs, BoardSize rhs)
public static bool operator>=(BoardSize lhs, BoardSize rhs)
lhs.NumSpecialTypes >= rhs.NumSpecialTypes;
lhs.NumSpecialTypes >= rhs.NumSpecialTypes;
}
/// <summary>

/// <summary>
/// Return the current size of the board. The values must less than or equal to the values returned from
/// GetMaxBoardSize().
/// By default, this will return GetMaxBoardSize(); if your board doesn't change size, you don't need to
/// <see cref="GetMaxBoardSize"/>.
/// By default, this will return <see cref="GetMaxBoardSize"/>; if your board doesn't change size, you don't need to
/// override it.
/// </summary>
/// <returns></returns>

/// <summary>
/// Check whether the particular Move is valid for the game.
/// The actual results will depend on the rules of the game, but we provide SimpleIsMoveValid()
/// The actual results will depend on the rules of the game, but we provide <see cref="SimpleIsMoveValid(Move)"/>
/// Moves that would go outside of GetCurrentBoardSize() are filtered out before they are
/// Moves that would go outside of <see cref="GetCurrentBoardSize"/> are filtered out before they are
/// <param name="m"></param>
/// <param name="m">The move to check.</param>
/// Instruct the game to make the given Move. Returns true if the move was made.
/// Instruct the game to make the given <see cref="Move"/>. Returns true if the move was made.
/// <param name="m"></param>
/// <param name="m">The move to carry out.</param>
/// <returns></returns>
public abstract bool MakeMove(Move m);

public Action OnNoValidMovesAction;
/// <summary>
/// Iterate through all Moves on the board.
/// Iterate through all moves on the board.
/// </summary>
/// <returns></returns>
public IEnumerable<Move> AllMoves()

}
/// <summary>
/// Iterate through all valid Moves on the board.
/// Iterate through all valid moves on the board.
/// </summary>
/// <returns></returns>
public IEnumerable<Move> ValidMoves()

}
/// <summary>
/// Returns true if swapped the cells specified by the move would result in
/// Returns true if swapping the cells specified by the move would result in
/// to be moved; to add extra logic, incorporate it into you IsMoveValid() method.
/// to be moved; to add extra logic, incorporate it into your <see cref="IsMoveValid"/> method.
/// </summary>
/// <param name="move"></param>
/// <returns></returns>

{
var moveVal = GetCellType(move.Row, move.Column);
var (otherRow, otherCol) = move.OtherCell();
var(otherRow, otherCol) = move.OtherCell();
var oppositeVal = GetCellType(otherRow, otherCol);
// Simple check - if the values are the same, don't match

/// <summary>
/// Check if one of the cells that is swapped during a move matches 3 or more.
/// Since these checks are similar for each cell, we consider the Move as two "half moves".
/// Since these checks are similar for each cell, we consider the move as two "half moves".
/// </summary>
/// <param name="newRow"></param>
/// <param name="newCol"></param>

}
/// <summary>
/// Make sure that the current BoardSize isn't larger than the original value of GetMaxBoardSize().
/// Make sure that the current BoardSize isn't larger than the original value of <see cref="GetMaxBoardSize"/>.
/// If it is, log a warning.
/// </summary>
/// <param name="originalMaxBoardSize"></param>

2
com.unity.ml-agents/Runtime/Sensors/GridSensorComponent.cs


[HideInInspector, SerializeField]
protected internal string m_SensorName = "GridSensor";
/// <summary>
/// Name of the generated <see cref="GridSensor"/> object.
/// Name of the generated GridSensor object.
/// Note that changing this at runtime does not affect how the Agent sorts the sensors.
/// </summary>
public string SensorName

4
com.unity.ml-agents/Runtime/Sensors/ISensor.cs


/// Returns a description of the observations that will be generated by the sensor.
/// See <see cref="ObservationSpec"/> for more details, and helper methods to create one.
/// </summary>
/// <returns></returns>
/// <returns>An object describing the observation.</returns>
ObservationSpec GetObservationSpec();
/// <summary>

/// Return information on the compression type being used. If no compression is used, return
/// <see cref="CompressionSpec.Default()"/>.
/// </summary>
/// <returns>CompressionSpec used by the sensor.</returns>
/// <returns>The type of compression used by the sensor.</returns>
CompressionSpec GetCompressionSpec();
/// <summary>

正在加载...
取消
保存