/** * Generate and add a negotiation report. */ protected void generateNegotiationReport(Order order, Tuple2<IBuyBookService, Integer>[] proposals, double acceptable_price) { String report = "Accepable price: "+acceptable_price+", proposals: "; if(proposals!=null) { for(int i=0; i<proposals.length; i++) { report += proposals[i].getSecondEntity()+"-"+proposals[i].getFirstEntity().toString(); if(i+1<proposals.length) report += ", "; } } else { report += "No seller found, purchase failed."; } NegotiationReport nr = new NegotiationReport(order, report, getScope().getTime()); //System.out.println("REPORT of agent: "+getAgentName()+" "+report); getBeliefbase().getBeliefSet("negotiation_reports").addFact(nr); }
/** * Generate and add a negotiation report. */ protected void generateNegotiationReport(Order order, NegotiationRecord rec, double acceptable_price) { String report = "Accepable price: "+acceptable_price+", proposals: "; if(rec!=null) { 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 += ", "; } } else { report += "No seller found, purchase failed."; } NegotiationReport nr = new NegotiationReport(order, report, rec!=null ? rec.getStarttime() : getScope().getTime()); //System.out.println("REPORT of agent: "+getAgentName()+" "+report); getBeliefbase().getBeliefSet("negotiation_reports").addFact(nr); } }