blocksworld.java

<!--
<H3>The blocksword agent.</H3>

Creates a blocks-world and moves blocks based on goals.
Its objective is to establish a given stack model.

<H4>Blocksword benchmark (use "benchmark" configuration).</H4>

Uses the blocksworld scenario to measure Jadex performance.

<pre>
<font face="Arial, Helvetica, sans-serif">
Benchmarks (grouped by system, newest benchmark first):

P4 3 GHz (HyperThreading), JADE 3.2, Java 1.4.2_01

Jadex 0.94beta (jibx+janino)
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 100
Standard deviation of runs (millis): 8
Benchmark: 10 runs with 50 goals each.
Avg. time per run (millis): 460
Standard deviation of runs (millis): 47

Jadex 0.94beta (jibx+javacc)
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 132
Standard deviation of runs (millis): 8

Jadex 0.94beta (enter jibx)
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 143
Standard deviation of runs (millis): 15

Jadex 0.93 (release):
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 156
Standard deviation of runs (millis): 0

Jadex 0.93beta (deliberation):
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 204
Standard deviation of runs (millis): 5

Jadex 0.93beta (pre_deliberation):
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 290
Standard deviation of runs (millis): 8

Jadex 0.93beta (clean_membrane):
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 196
Standard deviation of runs (millis): 8

Jadex-0.93beta (JBind patch):
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 331
Standard deviation of runs (millis): 5

Jadex-0.93beta (JBind):
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 342
Standard deviation of runs (millis): 5

Jadex-0.921:
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 267
Standard deviation of runs (millis): 5


P4M 1,5 GHz (Centrino), JADE 3.2/3.3, Java 1.4.2_01

Jadex 0.94beta (jibx+janino)
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 70
Standard deviation of runs (millis): 18
Benchmark: 10 runs with 50 goals each.
Avg. time per run (millis): 338
Standard deviation of runs (millis): 24

Jadex 0.94beta (enter jibx)
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 110
Standard deviation of runs (millis): 19

Jadex 0.93beta (deliberation_jan)
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 143
Standard deviation of runs (millis): 5

Jadex 0.93beta (JBind)
Benchmark: 10 runs with 10 goals each.
Avg. time per run (millis): 287
Standard deviation of runs (millis): 5
</font>
</pre>

-->

<agent xmlns="http://jadex.sourceforge.net/jadex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jadex.sourceforge.net/jadex
http://jadex.sourceforge.net/jadex-0.96.xsd"
name="Blocksworld"
package="jadex.examples.blocksworld">

<imports>
<import>jadex.runtime.*</import>
<import>jadex.runtime.impl.*</import>
<import>jadex.*</import>
<import>java.awt.Color</import>
</imports>

<beliefs>
<!-- The stack mode, can be normal, step or slow. -->
<belief name="mode" class="String">
<fact>StackBlocksPlan.MODE_NORMAL</fact>
</belief>
<!-- The flag for turning on/off output. -->
<belief name="quiet" class="boolean" />
<!-- The table for the blocks.-->
<belief name="table" class="Table">
<fact>new Table()</fact>
</belief>
<!-- The bucket for currently unused blocks. -->
<belief name="bucket" class="Table">
<fact>new Table("Bucket", Color.lightGray)</fact>
</belief>
<!-- The currently existing blocks. -->
<beliefset name="blocks" class="Block">
<fact>new Block(new Color(240, 16, 16), (Table)$beliefbase.table)</fact>
<fact>new Block(new Color(16, 16, 240), (Table)$beliefbase.table)</fact>
<fact>new Block(new Color(240, 240, 16), ((Table)$beliefbase.table).getAllBlocks()[0])</fact>
<fact>new Block(new Color(16, 240, 16), ((Table)$beliefbase.table).getAllBlocks()[2])</fact>
<fact>new Block(new Color(240, 16, 240), (Table)$beliefbase.bucket)</fact>
<fact>new Block(new Color(16, 240, 240), (Table)$beliefbase.bucket)</fact>
<fact>new Block(new Color(240, 240, 240), (Table)$beliefbase.bucket)</fact>
</beliefset>

<!-- The gui (if any). -->
<belief name="gui" class="BlocksworldGui"/>
</beliefs>

<goals>
<!-- Clear one block. -->
<achievegoal name="clear">
<parameter name="block" class="Block" />
<targetcondition>$goal.block.isClear()</targetcondition>
</achievegoal>
<!-- Achieve that one block is on a some target block or the table. -->
<achievegoal name="stack">
<parameter name="block" class="Block" />
<parameter name="target" class="Block" />
<targetcondition>$goal.block.getLower()==$goal.target</targetcondition>-->
</achievegoal>
<!-- Achieve a certain configuration of blocks. -->
<achievegoal name="configure">
<parameter name="configuration" class="Table" />
<targetcondition>
$beliefbase.table.configurationEquals($goal.configuration)
<relevantbeliefset ref="blocks"/>
</targetcondition>
</achievegoal>
</goals>

<plans>
<!-- plan to clear a block, by moving to the table whats on top of it. -->
<plan name="clear">
<parameter name="block" class="Block">
<bindingoptions>
select Block $block from $beliefbase.blocks
where $block.getLower()==$goal.block
</bindingoptions>
</parameter>
<parameter name="target" class="Block">
<value>$beliefbase.table</value>
</parameter>
<body>new StackBlocksPlan($beliefbase.mode, $beliefbase.quiet)</body>
<trigger>
<goal ref="clear"/>
</trigger>
</plan>
<!-- Stack one block on another one. -->
<plan name="stack">
<parameter name="block" class="Block">
<goalmapping ref="stack.block"/>
</parameter>
<parameter name="target" class="Block">
<goalmapping ref="stack.target"/>
</parameter>
<body>new StackBlocksPlan($beliefbase.mode, $beliefbase.quiet)</body>
<trigger>
<goal ref="stack"/>
</trigger>
</plan>
<!-- Plan for stacking towards a certain configuration. -->
<plan name="configure">
<parameter name="configuration" class="Table">
<goalmapping ref="configure.configuration"/>
</parameter>
<body class="ConfigureBlocksPlan" />
<!-- <body>new ConfigureBlocksPlan()</body>-->
<trigger>
<goal ref="configure"/>
</trigger>
</plan>
<!-- Plan for running test benchmarks. -->
<plan name="benchmark">
<parameter name="runs" class="int">
<value>10</value>
</parameter>
<parameter name="goals" class="int">
<value>10</value>
</parameter>
<body class="BenchmarkPlan" />
<!-- <body>new BenchmarkPlan()</body> -->
</plan>
</plans>

<events>
<!-- Event that indicates an execution step can be done. -->
<internalevent name="step"/>
</events>

<configurations>
<!-- GUI configuration. Uses gui plan to show frame, and verbose stack plans. -->
<configuration name="gui">
<beliefs>
<initialbelief ref="quiet">
<fact>false</fact>
</initialbelief>
<initialbelief ref="gui">
<fact>new BlocksworldGui($agent.getExternalAccess())</fact>
</initialbelief>
</beliefs>
</configuration>

<!-- Benchmark configuration. Uses benchmark plan to perform runs, and quiet stack plans. -->
<configuration name="benchmark(runs=10, goals=10)">
<beliefs>
<initialbelief ref="quiet">
<fact>true</fact>
</initialbelief>
</beliefs>
<plans>
<initialplan ref="benchmark" />
</plans>
</configuration>

<!-- Benchmark configuration. Uses benchmark plan to perform runs, and quiet stack plans. -->
<configuration name="benchmark(runs=10, goals=50)">
<beliefs>
<initialbelief ref="quiet">
<fact>true</fact>
</initialbelief>
</beliefs>
<plans>
<initialplan ref="benchmark">
<parameter ref="goals">
<value>50</value>
</parameter>
</initialplan>
</plans>
</configuration>

<!-- Benchmark configuration. Uses benchmark plan to perform runs, and quiet stack plans. -->
<configuration name="benchmark(runs=10, goals=500)">
<beliefs>
<initialbelief ref="quiet">
<fact>true</fact>
</initialbelief>
</beliefs>
<plans>
<initialplan ref="benchmark">
<parameter ref="goals">
<value>500</value>
</parameter>
</initialplan>
</plans>
</configuration>
</configurations>
</agent>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值