⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fig17_6.pl

📁 超多的prolog源代码 具体内容见压缩包里面的programs.txt
💻 PL
字号:
%   Figure 17.6  A means-ends planner with goal protection. 
%   Predicates satisfied, select, achieves and apply are as in Figure 17.5.

%   A means-ends planner with goal protection

plan( InitialState, Goals, Plan, FinalState)  :-
  plan( InitialState, Goals, [], Plan, FinalState).

%   plan( InitialState, Goals, ProtectedGoals, Plan, FinalState):
%     Goals true in FinalState, ProtectedGoals never destroyed by Plan

plan( State, Goals, _, [], State)  :-
  satisfied( State, Goals).                     % Goals true in State

plan( State, Goals, Protected, Plan, FinalState)  :-
  conc( PrePlan, [Action | PostPlan], Plan),    % Divide plan
  select( State, Goals, Goal),                  % Select an unsatisfied goal
  achieves( Action, Goal),
  can( Action, Condition),
  preserves( Action, Protected),                % Do not destroy protected goals
  plan( State, Condition, Protected, PrePlan, MidState1),
  apply( MidState1, Action, MidState2),
  plan( MidState2, Goals, [Goal | Protected], PostPlan, FinalState).

% preserves( Action, Goals): Action does not destroy any one of Goals

preserves( Action, Goals)  :-       % Action does not destroy Goals
  deletes( Action, Relations),
  not (member( Goal, Relations),
       member( Goal, Goals) ).


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -