- 浏览: 135090 次
- 性别:
- 来自: 福建省莆田市
文章分类
最新评论
-
houruiming:
tks for your info which helps m ...
setcontent和setcontentobject用的是同一片内存 -
turingfellow:
in.tftpd -l -s /home/tmp -u ro ...
commands -
turingfellow:
LINUX下的网络设置 ifconfig ,routeLINU ...
commands -
turingfellow:
安装 linux loopbackyum install um ...
commands
<!--
<H3>The buyer agent that purchases books for its user.</H3>
The buyer agent comes with a user interface in which the
human user can enter its purchase book orders consisting of
a title, start price, price limit and a deadline. The agent
subsequently tries to buy the book and changes the price
according to the deadline.
-->
<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="Buyer" package="jadex.examples.booktrading.buyer">
<imports>
<import>jadex.examples.booktrading.common.*</import>
<import>jadex.adapter.fipa.SFipa</import>
<import>java.util.*</import>
<import>jadex.runtime.impl.*</import>
<import>jadex.planlib.*</import>
</imports>
<capabilities>
<capability name="procap" file="jadex.planlib.Protocols"/>
<capability name="dfcap" file="jadex.planlib.DF"/>
</capabilities>
<beliefs>
<beliefset name="orders" class="Order">
<facts evaluationmode="dynamic">
select $g.getParameter("order").getValue()
from IRGoal $g in $goalbase.getGoals("purchase_book")
</facts>
</beliefset>
<belief name="time" class="long" updaterate="1000">
<fact>System.currentTimeMillis()</fact>
</belief>
<belief name="initial_orders" class="Order[]" exported="true"/>
<beliefset name="negotiation_reports" class="NegotiationReport"/>
<belief name="gui" class="Gui"/>
</beliefs>
<goals>
<!-- Initiate negotiation rounds every 10 secs. -->
<achievegoal name="purchase_book" recur="true" recurdelay="10000">
<parameter name="order" class="Order">
<bindingoptions>$beliefbase.initial_orders</bindingoptions>
</parameter>
<unique/>
<creationcondition>$beliefbase.initial_orders!=null</creationcondition>
<targetcondition>Order.DONE.equals($goal.order.getState())</targetcondition>
<failurecondition>$beliefbase.time > $goal.order.getDeadline().getTime()</failurecondition>
</achievegoal>
<achievegoalref name="df_search">
<concrete ref="dfcap.df_search"/>
</achievegoalref>
<achievegoalref name="cnp_initiate">
<concrete ref="procap.cnp_initiate"/>
</achievegoalref>
<querygoalref name="cnp_evaluate_proposals">
<concrete ref="procap.cnp_evaluate_proposals"/>
</querygoalref>
</goals>
<plans>
<plan name="purchase_book_plan">
<parameter name="order" class="Order">
<goalmapping ref="purchase_book.order"/>
</parameter>
<body class="PurchaseBookPlan" />
<!-- <body>new PurchaseBookPlan()</body> -->
<trigger>
<goal ref="purchase_book"/>
</trigger>
</plan>
<plan name="evaluate_proposals_plan">
<parameter name="cfp" class="Object">
<goalmapping ref="cnp_evaluate_proposals.cfp"/>
</parameter>
<parameter name="cfp_info" class="Object" optional="true">
<goalmapping ref="cnp_evaluate_proposals.cfp_info"/>
</parameter>
<parameterset name="proposals" class="Object">
<goalmapping ref="cnp_evaluate_proposals.proposals"/>
</parameterset>
<parameterset name="history" class="NegotiationRecord" optional="true">
<goalmapping ref="cnp_evaluate_proposals.history"/>
</parameterset>
<parameterset name="acceptables" class="Object" direction="out">
<goalmapping ref="cnp_evaluate_proposals.acceptables"/>
</parameterset>
<body class="EvaluateProposalsPlan" />
<trigger>
<goal ref="cnp_evaluate_proposals"/>
</trigger>
</plan>
</plans>
<expressions>
<expression name="search_reports">
select NegotiationReport $nr from $beliefbase.negotiation_reports
where $nr.getOrder().equals($order)
order by $nr.getTime()
<parameter name="$order" class="Order"/>
</expression>
</expressions>
<properties>
<property name="service_seller">
SFipa.createAgentDescription(null, SFipa.createServiceDescription(null, "service_seller", null))
</property>
<!--<property name="logging.level">java.util.logging.Level.FINE</property>-->
<!--<property name="debugging">true</property>-->
</properties>
<configurations>
<configuration name="default">
<beliefs>
<initialbelief ref="gui">
<fact>new Gui($agent.getExternalAccess(), true)</fact>
</initialbelief>
</beliefs>
<goals>
<!--<initialgoal ref="purchase_book">
<parameter ref="order">
<value>new Order("All about agents",
new Date(System.currentTimeMillis()+60000), 75, 110, true)</value>
</parameter>
</initialgoal>-->
</goals>
</configuration>
</configurations>
</agent>package jadex.examples.booktrading.buyer;
import jadex.planlib.ParticipantProposal;
import jadex.runtime.Plan;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
* Evaluate the received proposals.
*/
public class EvaluateProposalsPlan extends Plan
{
/**
* The plan body.
*/
public void body()
{
// Get order properties and calculate acceptable price.
int acceptable_price = ((Integer)getParameter("cfp_info").getValue()).intValue();
ParticipantProposal[] proposals = (ParticipantProposal[])getParameterSet("proposals").getValues();
// Determine acceptables
List accs = new ArrayList();
for(int i=0; i<proposals.length; i++)
{
if(((Integer)proposals[i].getProposal()).intValue() <= acceptable_price)
accs.add(proposals[i]);
}
// Sort acceptables by price.
if(accs.size()>1)
{
Collections.sort(accs, new Comparator()
{
public int compare(Object arg0, Object arg1) {
return ((Comparable) ((ParticipantProposal)arg0).getProposal())
.compareTo(((ParticipantProposal)arg1).getProposal());
}
});
}
if(accs.size()>0)
getParameterSet("acceptables").addValue(accs.get(0));
}
}package jadex.examples.booktrading.buyer;
import jadex.adapter.fipa.AgentDescription;
import jadex.adapter.fipa.AgentIdentifier;
import jadex.examples.booktrading.common.NegotiationReport;
import jadex.examples.booktrading.common.Order;
import jadex.planlib.NegotiationRecord;
import jadex.planlib.ParticipantProposal;
import jadex.planlib.Selector;
import jadex.runtime.GoalFailureException;
import jadex.runtime.IGoal;
import jadex.runtime.Plan;
import jadex.util.SUtil;
import java.util.Comparator;
import java.util.Date;
/**
* The plan tries to purchase a book.
*/
public class PurchaseBookPlan extends Plan
{
//-------- methods --------
/**
* The body method is called on the
* instatiated plan instance from the scheduler.
*/
public void body()
{
// Get order properties and calculate acceptable price.
Order order = (Order)getParameter("order").getValue();
double time_span = order.getDeadline().getTime() - order.getStartTime();
double elapsed_time = System.currentTimeMillis() - order.getStartTime();
double price_span = order.getLimit() - order.getStartPrice();
int acceptable_price = (int)(price_span * elapsed_time / time_span)
+ order.getStartPrice();
// Find available seller agents.
IGoal df_search = createGoal("df_search");
df_search.getParameter("description").setValue(getPropertybase().getProperty("service_seller"));
dispatchSubgoalAndWait(df_search);
AgentDescription[] result = (AgentDescription[])df_search
.getParameterSet("result").getValues();
if(result.length == 0)
fail();
AgentIdentifier[] sellers = new AgentIdentifier[result.length];
for(int i = 0; i < result.length; i++)
sellers[i] = result[i].getName();
//System.out.println("found: "+SUtil.arrayToString(sellers));
// Initiate a call-for-proposal.
IGoal cnp = createGoal("cnp_initiate");
cnp.getParameter("cfp").setValue(order.getTitle());
cnp.getParameter("cfp_info").setValue(new Integer(acceptable_price));
cnp.getParameterSet("receivers").addValues(sellers);
try
{
dispatchSubgoalAndWait(cnp);
NegotiationRecord rec = (NegotiationRecord)cnp.getParameterSet("history").getValues()[0];
generateNegotiationReport(order, rec, acceptable_price);
// If contract-net succeeds, store result in order object.
order.setExecutionPrice((Integer)(cnp.getParameterSet("result").getValues()[0]));
order.setExecutionDate(new Date());
}
catch(GoalFailureException e)
{
NegotiationRecord rec = (NegotiationRecord)cnp.getParameterSet("history").getValues()[0];
generateNegotiationReport(order, rec, acceptable_price);
fail();
}
//System.out.println("result: "+cnp.getParameter("result").getValue());
}
/**
* Generate and add a negotiation report.
*/
protected void generateNegotiationReport(Order order, NegotiationRecord rec, double acceptable_price)
{
String report = "Accepable price: "+acceptable_price+", proposals: ";
ParticipantProposal[] proposals = rec.getProposals();
for(int i=0; i<proposals.length; i++)
{
report += proposals[i].getProposal()+"-"+proposals[i].getParticipant().getLocalName();
if(i+1<proposals.length)
report += ", ";
}
NegotiationReport nr = new NegotiationReport(order, report, rec.getStarttime());
//System.out.println("REPORT of agent: "+getAgentName()+" "+report);
getBeliefbase().getBeliefSet("negotiation_reports").addFact(nr);
}
}
发表评论
-
protocols
2011-04-03 19:22 924<!-- The protocols capabilit ... -
dfcap
2011-04-03 19:15 874<!-- The df capability has a ... -
booktrading /seller
2011-03-29 23:19 927<html><head><tit ... -
booktrading / manager
2011-03-29 23:18 1086<html><head><tit ... -
booktrading / common
2011-03-29 23:17 985<html><head><tit ... -
tomcat的context说明书
2011-03-20 17:39 803http://tomcat.apache.org/tomcat ... -
msyql的select语法
2010-09-13 22:52 107513.2.7. SELECT语法 13.2.7.1. ... -
zotero与word集成
2010-09-11 08:50 1765Manually Installing the Zotero ... -
university 2/n
2010-08-24 07:54 896Chapter 1.Introduction of regis ... -
university 1/n
2010-08-24 07:53 938chapter? Introduction ?.?The st ... -
Sun Java Bugs that affect lucene
2010-08-23 08:59 734Sometimes Lucene runs amok of b ... -
Snowball分词
2010-08-22 13:07 1222using System; using Lucene.Net. ... -
penn tree bank 6/6
2010-08-20 07:09 91811 This use of 12 Contact the - ... -
penn tree bank 5/n
2010-08-19 07:40 920always errs on the side of caut ... -
penn tree bank 4/n
2010-08-19 07:39 8164. Bracketing 4.1 Basic Methodo ... -
penn tree bank 3/n
2010-08-15 23:31 8182.3.1 Automated Stage. During t ... -
penn tree bank 2/n
2010-08-15 23:30 1503Mitchell P Marcus et al. Buildi ... -
capabilities 3/3
2010-08-11 22:58 77401<capability xmlns="ht ... -
capabilities 2/3
2010-08-11 22:57 737Fig.3.Element creation cases:a) ... -
capabilities 1/3
2010-08-11 22:56 947Extending the Capability Concep ...
相关推荐
没有作品/buyer/me GET 在标头中使用必需的承载JWT令牌调用API。 返回除私有细节(如密码)外的整个买家细节。 是作品/buyer/me PATCH 使用标头中的必需承载JWT令牌以及要更改的详细信息来调用API。 返回除私有细节...
服务端)小程序端技术栈mpvue + mpvue-router-patch + mpvue-entry + vuex + webpack + ES6/7 + flyio + mpvue-wxparse项目运行微信开发中工具选中mpvue-xbyjShop/buyer作为项目目录即可功能列表页面 首页 -- 完成 ...
kitchens :trophy: springboot springdata 接口调用说明api 全局 var NewApiKitcUrl = 'localhost:8080/kit/'; 所有在售的商品其中按商品类划分... PayCreate: NewApiKitcUrl + 'weixin/buyer/order/cancel',//支付创建
### SAP Enterprise Buyer 3.5 Configuration (SRM210) 关键知识点解析 #### 一、课程目标与概述 本课程旨在使学习者能够掌握 SAP Enterprise Buyer (EBP) 3.5 版本的核心配置知识和技术应用要求,以便在实际项目...
ByteartRetailV3源码 功能介绍: Byteart Retail是一个基于.NET开发的企业级应用程序,...buyer/buyer:以采购人员角色登录,可以管理商品分类和商品信息 ?daxnet/daxnet:普通用户角色,不能对系统进行任何管理操作
Oracle Supplier Network Buyer’s Guide to Connecting 11i Release 4.3 Part No. B19153-01
- url:https://30paotui.com/buyer/product/list - 请求方式:get - 返回数据格式如下 ``` { "code": 100, "msg": "成功", "data": [ { "name": "热销", "type": 1, "foods": [ { "id": "5", "name": ...
js 图形验证码制作 实际效果 第一步我们来到要展示验证码的页面,当我们按下营业执照的时候让其,弹出一...//1-在路由层进行设置,页面跳转到根目录下/buyer/vshop/info.ejs页面进行跳转,然后在回调函数中进行接口的调
Oracle Procurement Buyer’s Guide to Punchout and Transparent Punchout 是一份为使用Oracle采购系统的买家提供的指南,专注于两种电子采购技术:Punchout 和 Transparent Punchout。这些技术是企业间电子商务...
语言:日本語 买方@ amazon是一种方便使用的扩展。 从Amazon的产品页面创建一个单击的关联链接。 请使用“支持”选项卡进行评论。 买方@Amazon是一种方便使用的扩展。 从Amazon的产品页面创建一个单击的关联链接。...
数据集被称为`buyer_favorite1`,包含了买家ID、商品ID以及收藏日期三个字段,这些字段之间用制表符(`\t`)进行分隔。下面我们将详细探讨如何设计并实现这样的MapReduce程序,以及在实施过程中可能遇到的关键步骤和...
This Buyer’s Guide presents a series of guidelines that you can use when searching for the essential Hadoop infrastructure that will be sustaining your organization for years to come.
Steam-Bulk-Card-Buyer 此用户脚本会在您的 Steam 徽章页面上添加一个按钮,让您可以立即从 Steam 市场购买完成徽章所需的所有卡片。警告的话! 我的版本是单击即可完成所有操作。 这意味着单击购买将购买卡片、重新...
标题中的"Buyer.rar_VHDL/FPGA/Verilog_VHDL_"暗示了这是一个与电子设计自动化(EDA)相关的项目,特别关注于使用VHDL和Verilog编程语言在FPGA(Field-Programmable Gate Array)上实现的自动售货机系统。...
在当今高度电子化和自动化的社会中,电磁兼容性(EMC)已成为衡量电子产品和系统性能的重要指标。电磁兼容确保各类电气和电子设备能在复杂多变的电磁环境中稳定运行,避免相互干扰,保障了设备和系统的可靠性与安全...
欧盟的ECALL系统是一项交通紧急呼叫系统,旨在提高交通事故发生时的救援效率,减少救援时间,降低事故后果的严重性。ECALL系统的法规要求主要体现在以下几个方面: 1. 法规的适用范围和背景:根据描述,欧盟已经...
"纯担保交易接口-create_partner_trade_by_buyer"是支付宝提供的一种特定服务,旨在帮助网站所有者集成支付宝支付功能,尤其适用于非网店论坛系统的独立技术开发的网站。此接口允许买家在商家网站上进行购物时,资金...
关于一个仓库管理系统的完整程序... char buyer[12]; //采购员 char btel[12]; char provider[12];//供应商 char p_tel[13];//供应商电话 char return_date[11]; //归还时间 char out_date[11];//出库时间 };
string transport, string ordinary_fee, string express_fee, string readonlys, string buyer_msg, string buyer, string buyer_name, string buyer_address, string buyer_zipcode, string buyer_tel, string ...
这个查询会返回一个结果集,其中包含buyers表中的buyer_name,与sales表中的buyer_id和qty,只有当buyers表中的buyer_id与sales表中的buyer_id相匹配时才会显示。结果集中不会包含任何在其中一张表中没有对应匹配项...