标题:两道算法题,我们老师估计没人能写
只看楼主
yang158
Rank: 1
等 级:新手上路
帖 子:47
专家分:0
注 册:2019-3-12
结帖率:16.67%
 问题点数:0 回复次数:0 
两道算法题,我们老师估计没人能写
1.前向搜索规划伪代码
ForwardSearching(KB, InitState, GoalState)
Input:KB, state space and action modes;
        InitState, start state;
        GoalState, objective;
Output:an action sequence or failure;

currState <-- {InitState};
plan <-- { };
Respeat
    if currState satisfies GoalState
        return plan;
    applicable <-- {a | a is a ground operator in KB that Precond(a) is true in currState};
    if applicable =  Ø
        return failure;
    a = ChooseAction(applicable);
    currState <-- Effect(a);
    plan <-- plan ∪ a;
    Utill Maximum Iteration.

2.FOLL算法伪代码
FOLLAlg(Target, TrainData)
Input:Target, post - condition predicate;
        TrainData, training samples;
Output:Rules.

PosSamples <-- Positive Samples of TrainData;
NegSamples <-- Negative Samples of TrainData;
Rules <-- { };
While PosSamples is not empty, do
    Clause <-- Target with empty pre - condition;
NewNegSamples <-- NegSamples;
While NewNegSamples is not empty, do
    LiteralCan <-- GetLiteralCandidates(TrainData);
    BestLiteral <-- arg max I ∈ LiteraICan Gain(I, TrainData, Clause);
    Add BestLiteral to the pre - condition of Clause;
    Remove samples from NewNegSamples that satisfy Clause;
Rules <-- Rules + Clause;
Remove samples from PosSamples that satisfy Rules;
Reurn Rules.
搜索更多相关主题的帖子: Target 算法 return While 老师 
2021-06-29 17:08



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-506126-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.348442 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved