/** * Plan body. */ public void body() { Object cfp = getParameter("cfp").getValue(); Object cfp_info = getParameter("cfp_info").getValue(); NegotiationRecord[] history = (NegotiationRecord[])getParameterSet("history").getValues(); ParticipantProposal[] proposals = (ParticipantProposal[])getParameterSet("proposals").getValues(); IQueryNextroundInfo qnri = (IQueryNextroundInfo)cfp_info; IQueryNextroundInfo.NextroundInfo nri = new IQueryNextroundInfo.NextroundInfo(cfp, cfp_info, history[history.length-1].getParticipants()); boolean iterate = qnri.queryNextroundInfo(nri, history, proposals); getParameter("cfp").setValue(nri.getCfp()); getParameter("cfp_info").setValue(nri.getCfpInfo()); getParameterSet("participants").removeValues(); getParameterSet("participants").addValues(nri.getParticipants()); getParameter("iterate").setValue(Boolean.valueOf(iterate)); } }
/** * The plan body. */ public void body() { ParticipantProposal[] proposals = (ParticipantProposal[])getParameterSet("proposals").getValues(); // Accept all proposals >= 5 List acceptables = new ArrayList(); for(int i=0; i<proposals.length; i++) { if(((Number)proposals[i].getProposal()).intValue()>=5) { // Insert acceptable proposal in descending order. int j; for(j=0; j<acceptables.size(); j++) { if(((Number)proposals[i].getProposal()).intValue() > ((Number)((ParticipantProposal)acceptables.get(j)).getProposal()).intValue()) break; } acceptables.add(j, proposals[i]); } } getParameterSet("acceptables").addValues(acceptables.toArray()); } }
MParameter.Direction dir = ((MParameter)paramset.getModelElement()).getDirection(); if(MParameter.Direction.OUT.equals(dir) || MParameter.Direction.INOUT.equals(dir)) res.put(paramset.getName(), paramset.getValues());
sel.getParameter("cfp").setValue(nr.getCFP()); sel.getParameter("cfp_info").setValue(nr.getCFPInfo()); sel.getParameterSet("history").addValues(getParameterSet("history").getValues()); sel.getParameterSet("proposals").addValue(nr.getProposals()[i]); if(sel.getParameterSet("proposals").size()>0) acceptables = (ParticipantProposal[])sel.getParameterSet("acceptables").getValues(); nr.setCFPInfo(sel.getParameter("cfp_info").getValue()); getLogger().info(getComponentName()+" (I)CNPPlan determined acceptables: "+SUtil.arrayToString(acceptables));
getParameterSet(targetpara).removeValues(); Object[] vals = rplan.getParameterSet(mparam.getName()).getValues(); for(Object val: vals) getParameterSet(targetpara).addValue(val);
sel.getParameter("cfp").setValue(nr.getCFP()); sel.getParameter("cfp_info").setValue(nr.getCFPInfo()); sel.getParameterSet("participants").addValues(nr.getParticipants()); sel.getParameterSet("proposals").addValues(nr.getProposals()); sel.getParameterSet("history").addValues(getParameterSet("history").getValues()); try IComponentIdentifier[] participants = (IComponentIdentifier[])sel.getParameterSet("participants").getValues(); ret = new NegotiationRecord(cfp, cfp_info, participants, getTime()); getParameterSet("history").addValue(ret); getLogger().info("ICNP: perform further negotiation round");
achieve.getParameterSet("blocks").addValues(table.getAllBlocks()); dispatchSubgoalAndWait(achieve);
me.getParameterSet(SFipa.RECEIVERS).removeValues(); me.getParameterSet(SFipa.RECEIVERS).addValue(agents.get(0)); sendMessage(me).get(); tr.setSucceeded(true);
if(!((MParameter)paramset.getModelElement()).isOptional()) Direction dir = ((MParameter)paramset.getModelElement()).getDirection(); if(MParameter.Direction.OUT.equals(dir) || MParameter.Direction.INOUT.equals(dir)) Object[] vals = paramset.getValues(); ret = vals.length>0; if(!ret)
try getParameterSet("paramset").addValue("result"); report.setSucceeded(true); try getParameterSet("paramset").removeValue("testvalue 1"); report.setSucceeded(true);
IParameterSet rec = inform.getParameterSet("receivers"); for(int i=0; i<players.length; i++) if(!rec.containsValue(players[i].getAgentID())) rec.addValue(players[i].getAgentID()); sendMessage(inform);
/** * The plan body. */ public void body() { // Allow at most 3 negotiation rounds and do not alter cfp, cfp_info or participants. if(getParameterSet("history").size()<3) { getParameter("iterate").setValue(Boolean.TRUE); } else { getParameter("iterate").setValue(Boolean.FALSE); } } }
public void resultAvailable(Void result) { // The plans ensure that the force is guaranteed to be not duty when the goal is finished. // System.out.println("removing unit from busy list " + force); getParameterSet("units").removeValue(force); busy.removeFact(provid); }
/** * Add a parameterset. * @param paramset The parameterset. */ public void addParameterSet(IParameterSet paramset) { if(parametersets==null) parametersets = new HashMap<String, IParameterSet>(); parametersets.put(paramset.getName(), paramset); }
if(((MParameter)param.getModelElement()).getEvaluationMode()==EvaluationMode.PUSH) if(((MParameter)param.getModelElement()).getDirection()==Direction.OUT)