AABB
AlignmentBehavior
ArriveBehavior
AStar
BFS
BoundingSphere
BVH
BVHNode
Cell
CellSpacePartitioning
CohesionBehavior
CompositeGoal
ConvexHull
Corridor
CostTable
DFS
Dijkstra
Edge
EntityManager
EvadeBehavior
EventDispatcher
Behavior
FollowPathBehavior
FuzzyAND
FuzzyCompositeTerm
FuzzyFAIRLY
FuzzyModule
FuzzyOR
FuzzyRule
FuzzySet
FuzzyTerm
FuzzyVariable
FuzzyVERY
GameEntity
Goal
GoalEvaluator
Graph
GraphUtils
HalfEdge
HeuristicPolicyDijkstra
HeuristicPolicyEuclid
HeuristicPolicyEuclidSquared
HeuristicPolicyManhattan
InterposeBehavior
LeftSCurveFuzzySet
LeftShoulderFuzzySet
LineSegment
Logger
MathUtils
Matrix3
Matrix4
MemoryRecord
MemorySystem
MeshGeometry
MessageDispatcher
MovingEntity
NavEdge
NavMesh
NavMeshLoader
NavNode
Node
NormalDistFuzzySet
OBB
ObstacleAvoidanceBehavior
OffsetPursuitBehavior
OnPathBehavior
Path
Plane
Polygon
Polyhedron
PriorityQueue
PursuitBehavior
Quaternion
Ray
RectangleTriggerRegion
Regular
RightSCurveFuzzySet
RightShoulderFuzzySet
SAT
SeekBehavior
SeparationBehavior
SingletonFuzzySet
Smoother
SphericalTriggerRegion
State
StateMachine
SteeringBehavior
SteeringManager
Task
TaskQueue
Telegram
Think
Time
TriangularFuzzySet
Trigger
TriggerRegion
Vector3
Vehicle
Version
WanderBehavior

antecedent

Yuka js库中,FuzzyRule的antecedent表示模糊规则的前提条件,它决定了该规则是否应该被触发。

一个FuzzyRule的antecedent由一个或多个FuzzyTerm组成,可以使用逻辑运算符AND或OR来组合它们。

例如,以下是一个由两个FuzzyTerm组成的antecedent:

const antecedent = new FuzzyAND(
  new FuzzyTerm('health', 0.5, 'low'),
  new FuzzyTerm('distance', 0.8, 'far')
);

它表示在“health”模糊变量的值为“low”且“distance”模糊变量的值为“far”时,该规则应该被触发。

你也可以将多个antecedent组合成一个FuzzyRuleSet,则只要一个antecedent被触发,则整个FuzzyRuleSet就会被触发。

const ruleset = new FuzzyRuleSet();

ruleset.addRule(
  new FuzzyRule(
    new FuzzyOR(
      new FuzzyTerm('health', 0.5, 'low'),
      new FuzzyTerm('distance', 0.8, 'far')
    ),
    new FuzzyTerm('output', 0.7, 'high')
  )
);

在上面的例子中,只要“health”模糊变量的值为“low”或“distance”模糊变量的值为“far”,规则就会被触发。

总之,FuzzyRule的antecedent在模糊逻辑中承担着重要的角色,它为模糊推理提供了基础,并使得Yuka js库的人工智能能够更好地应用于各种实际问题中。