[[CogModel]] *問題文 [#yaa8bf1c] 2つの滑車、2つのおもり、何本かのひもがあります。 それらは次のように配置されています。 - はじめのおもりAはプーリーAとロープPで結ばれています。プーリーAはロープRとロープQによって支えられています。ロープQは天井とつながっています。ロープRはプーリーBとつながっています。プーリーBは天井とつながり、ロープSを支えます。ロープSはおもりBを支えます。 1番目のおもりが100gだとしたときの2番目のおもりのおもさを求めなさい。ただし、滑車やひもの重さ、滑車の摩擦を考えないものとします。 #ref(kassya1.jpg,,center,wrap,around,80%); #ref(kassya1.jpg,,center,wrap,around,50%); *ワーキングメモリ [#h2b2e2ff] #Statement - (Support RopeP WeightA) - (Support PulleyA RopeP) - (Support RopeQ PulleyA) - (Support Ceil RopeQ) - (Support RopeR PulleyA) - (Support PulleyB RopeR) - (Support PulleyB RopeS) - (Support RopeS WeightB) #Problem - (Value WeightA 100) - (Value WeightB KARA) - (Value RopeP KARA) - (Value RopeQ KARA) - (Value RopeR KARA) - (Value RopeS KARA) - (Pulley PulleyA) - (Pulley PulleyB) *ルール [#vf67f602] - name: Rope-Pulley if: - (Support ?Pulley ?Rope1) - (Support ?Pulley ?Rope2) - (*test-not-equal ?Rope1 ?Rope2) - (Support ?Rope3 ?Pulley) - (Value ?Rope1 ?n1) - (*test-not-equal ?n1 KARA) - (Value ?Rope2 ?n2) - (*test-not-equal ?n2 KARA) - (Value ?Rope3 KARA) then: - (*delete (Value ?Rope3 KARA)) - (*deposit (Value ?Rope3 (*addition ?n1 ?n2))) - name: two-Rope-Weight if: - (Value ?Weight KARA) - (Support ?Rope1 ?Weight) - (Value ?Rope1 ?n2) - (*test-not-equal ?n2 KARA) - (Support ?Rope2 ?Weight) - (Value ?Rope2 ?n1) - (*test-not-equal ?n1 KARA) - (*test-not-equal ?Rope2 ?Rope1) then: - (*delete (Value ?Weight KARA)) - (*deposit (Value ?Weight (*addition ?n1 ?n2))) - name: Pulley-two-Rope if: - (Support ?Pulley ?Rope1) - (Support ?Pulley ?Rope2) - (*test-not-equal ?Rope1 ?Rope2) - (Value ?Rope2 KARA) - (Value ?Rope1 ?n) - (*test-not-equal ?n KARA) then: - (*delete (Value ?Rope2 KARA)) - (*deposit (Value ?Rope2 ?n)) - name: two-Rope-Pulley if: - (Pulley ?Pulley) - (Support ?Rope1 ?Pulley) - (Support ?Rope2 ?Pulley) - (Value ?Rope1 ?n1) - (*test-not-equal ?n1 KARA) - (Value ?Rope2 KARA) then: - (*delete (Value ?Rope2 KARA)) - (*deposit (Value ?Rope2 ?n1)) - name: two-Rope-Pulley2 if: - (Pulley ?Pulley) - (Support ?Rope1 ?Pulley) - (Support ?Rope2 ?Pulley) - (Support ?Pulley ?Rope3) - (Value ?Rope3 100) - (Value ?Rope1 KARA) - (Value ?Rope2 KARA) - (*test-not-equal ?Rope1 ?Rope2) then: - (*delete (Value ?Rope1 KARA)) - (*deposit (Value ?Rope1 50)) - (*delete (Value ?Rope2 KARA)) - (*deposit (Value ?Rope2 50)) - name: Single-Rope-Weight if: - (Value ?Weight ?n) - (*test-not-equal ?n KARA) - (Value ?Rope KARA) - (Support ?Rope ?Weight) then: - (*delete (Value ?Rope KARA)) - (*deposit (Value ?Rope ?n)) - name: single-Rope-Weight2 if: - (Value ?Weight KARA) - (Value ?Rope ?n1) - (*test-not-equal ?n1 KARA) - (Support ?Rope ?Weight) then: - (*delete (Value ?Weight KARA)) - (*deposit (Value ?Weight ?n1)) *メモ [#p942ce77] Larkin & Simonの問題を解くモデルを転移させることで作成。 two-Rope-Pulley2を修正し、single-Rope-Weight2を追加。 修正したところは、ルール中での変数の位置のみ。 割り算の関数があれば、汎用的になるのだけれど。