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

defuzzify

defuzzify() 是Yuka JS库的FuzzyModule中的一个函数,用于将参与计算的模糊成员函数的结果聚合成一个离散值。

语法

defuzzify( members );

参数

  • members:一个数组,包含用于聚合的所有模糊成员函数的结果。

返回值

  • 一个数字类型的值,表示成员函数的聚合结果。

描述

模糊逻辑是模拟人类的自然语言处理和推理过程,并处理模糊或不确定知识的一种数学方法。在模糊逻辑中,模糊变量和模糊集合是基本的概念。

defuzzify() 函数将进入模糊库进行推理的一组已模糊化的变量值聚合为一个数字。通过将所有值相加,除以聚合的变量个数,可以计算出聚合后的值。这个值就是推理结果,表示一个确定的或确定性的事实。

实例

下面的示例演示了如何使用 defuzzify() 函数聚合模糊集合的结果,以便计算模糊逻辑中的参数。

let fuzzyModule = new FuzzyModule();
let inputVariable = new FuzzyVariable();

let low = inputVariable.addTerm(new LeftShoulderFuzzySet(0, 25, 50));
let med = inputVariable.addTerm(new TriangularFuzzySet(25, 50, 75));
let high = inputVariable.addTerm(new RightShoulderFuzzySet(50, 75, 100));

fuzzyModule.addVariable(inputVariable);

let rule1 = new FuzzyRule(inputVariable.getTermByName('low'), "AND", fuzzyModule.output, "MIN");
let rule2 = new FuzzyRule(inputVariable.getTermByName('med'), "AND", fuzzyModule.output, "MIN");
let rule3 = new FuzzyRule(inputVariable.getTermByName('high'), "AND", fuzzyModule.output, "MIN");

fuzzyModule.addRule(rule1);
fuzzyModule.addRule(rule2);
fuzzyModule.addRule(rule3);

fuzzyModule.fuzzify({inputVariable: 30});

let defuzzifiedValue = fuzzyModule.defuzzify(fuzzyModule.output.getMemberFunctions());

参考