/** * The plan body. */ public void body() { Object[] cfps = getParameterSet("history").getValues(); Double newcfp = Double.valueOf(((Double)cfps[cfps.length-1]).doubleValue()+5); getParameter("cfp").setValue(newcfp); }
/** * The plan body. */ public void body() { Object[] cfps = getParameterSet("history").getValues(); Double newcfp = Double.valueOf(((Double)cfps[cfps.length-1]).doubleValue()-5); if(newcfp.doubleValue()<100) fail(); getParameter("cfp").setValue(newcfp); } }
/** * The plan body. */ public void body() { ICandidateInfo[] apps = (ICandidateInfo[])getParameterSet("applicables").getValues(); getLogger().info("Meta-level reasoning selects: " + apps[0]); getParameterSet("result").addValue(apps[0]); } }
/** * 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()); } }
/** * 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()); } }
Object[] proposals = (Object[])getParameterSet("proposals").getValues();
/** * Get an object from the map. * @param key The key * @return The value. */ public Object get(Object key) { String name = (String)key; Object ret = null; if(hasParameter(name)) { ret = getParameter(name).getValue(); } else if(hasParameterSet(name)) { ret = getParameterSet(name).getValues(); } else { throw new RuntimeException("Unknown parameter/set: "+name); } return ret; }
/** * The body method is called on the * instatiated plan instance from the scheduler. */ public void body() { String[] outs = (String[])getParameterSet("outs").getValues(); // System.out.println("Found: "+SUtil.arrayToString(outs)); for(int i=0; i<outs.length; i++) { getParameter(outs[i]).setValue("set"); // System.out.println("Setted: "+outs[i]); waitFor(100); } // System.out.println("Plan end."); } }
/** * 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(); IProposalEvaluator evaluator = (IProposalEvaluator)cfp_info; ParticipantProposal[] acceptables = evaluator.evaluateProposals(cfp, cfp_info, history, proposals); getParameterSet("acceptables").addValues(acceptables); } }
/** * The plan body. */ public void body() { //System.out.println("Meta"); ICandidateInfo[] apps = (ICandidateInfo[])getParameterSet("applicables").getValues(); assert apps.length>0; ICandidateInfo sel = null; IBoard board = (IBoard)getBeliefbase().getBelief("board").getFact(); String ml = (String)getBeliefbase().getBelief("ml").getFact(); if(ml.equals("none")) sel = apps[0]; else if(ml.equals("short")) sel = selectPlan(apps, board, true, false, false, true); else if(ml.equals("long")) sel = selectPlan(apps, board, true, true, false, true); else if(ml.equals("same_long")) sel = selectPlan(apps, board, true, true, true, true); else if(ml.equals("alter_long")) sel = selectPlan(apps, board, false, true, true, true); else throw new RuntimeException("Wrong meta-level strategy."); getParameterSet("result").addValue(sel); }
ICandidateInfo[] apps = (ICandidateInfo[])getParameterSet("applicables").getValues(); getLogger().info("Meta-level reasoning chooses between: "); for(int i=0; i<apps.length; i++)
public void body() { TestReport report = new TestReport("check_values", "Checks if the goal contains the correct parameter set <values>."); Object[] vals = getParameterSet("names").getValues(); if("[a, b, c]".equals(SUtil.arrayToString(vals))) report.setSucceeded(true); else report.setReason("Values should be [a, b, c], but were: "+SUtil.arrayToString(vals)); getBeliefbase().getBeliefSet("testcap.reports").addFact(report); report = new TestReport("check_value", "Checks if the goal contains the correct parameter set <value>s."); vals = getParameterSet("morenames").getValues(); if("[d, e, f]".equals(SUtil.arrayToString(vals))) report.setSucceeded(true); else report.setReason("Values should be [d, e, f], but were: "+SUtil.arrayToString(vals)); getBeliefbase().getBeliefSet("testcap.reports").addFact(report); } }
this.values = getParameterSet("values").getValues(); if(hasParameter("time")) this.time = ((Long)getParameter("time").getValue()).longValue();
/** * 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)); } }
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);
String[] receivers = (String[])getParameterSet("receivers").getValues();
if(MParameter.Direction.OUT.equals(dir) || MParameter.Direction.INOUT.equals(dir)) Object[] vals = paramset.getValues(); ret = vals.length>0; if(!ret)