| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1258 人关注过本帖
标题:两道算法题,我们老师说没人能写出来
只看楼主 加入收藏
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.
搜索更多相关主题的帖子: 算法 return 老师 Target While 
2021-06-29 17:09
快速回复:两道算法题,我们老师说没人能写出来
数据加载中...
 
   



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

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