区块链技术博客
www.b2bchain.cn

标题: 两道算法题,我们老师说没人能写出来

b2bchain.cn区块链技术社区提供第20484篇技术文章标题: 两道算法题,我们老师说没人能写出来
问题解答:

两道算法题,我们老师说没人能写出来

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.

标题: 两道算法题,我们老师说没人能写出来 由www.b2bchain.cn 提供
文章整理自网络,只为个人学习与分享使用
链接地址https://www.b2bchain.cn/?p=20484

赞(0) 打赏
部分文章转自网络,侵权联系删除b2bchain区块链学习技术社区 » 标题: 两道算法题,我们老师说没人能写出来
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

b2b链

联系我们联系我们