package agents.anac.y2015.TUDMixedStrategyAgent; import java.util.ArrayList; import java.util.List; import genius.core.AgentID; import genius.core.Bid; import genius.core.BidHistory; import genius.core.DeadlineType; import genius.core.actions.Accept; import genius.core.actions.Action; import genius.core.actions.DefaultAction; import genius.core.actions.Offer; import genius.core.bidding.BidDetails; import genius.core.parties.AbstractNegotiationParty; import genius.core.parties.NegotiationInfo; import genius.core.utility.AdditiveUtilitySpace; /** * This is your negotiation party. */ public class TUDMixedStrategyAgent extends AbstractNegotiationParty { private int roundN = 0; // Number of the round we are in private Bid lastbid; // LastBid we received from someone private List bidhistorylist; // List of the lists of Bids // received, one list for every // agent private List partylist; // List of Agents private ArrayList possibleBids; // List of all possible Bids in this // utility Space private ArrayList alreadyProposed; // List of all Bids, we received and // then reproposed private ArrayList agentUtilsList; // List of AgentUtils that are objects that model the opponents utility // function and give their utility to a specific Bid /** * Please keep this constructor. This is called by genius. * * @param utilitySpace * Your utility space. * @param deadlines * The deadlines set for this negotiation. * @param timeline * Value counting from 0 (start) to 1 (end). * @param randomSeed * If you use any randomization, use this seed for it. */ @Override public void init(NegotiationInfo info) { // Make sure that this constructor calls it's parent. super.init(info); // Initialize the lists bidhistorylist = new ArrayList(); partylist = new ArrayList(); alreadyProposed = new ArrayList(); possibleBids = BidGenerator .BidList(((AdditiveUtilitySpace) utilitySpace)); agentUtilsList = new ArrayList(); } /** * Each round this method gets called and ask you to accept or offer. The * first party in the first round is a bit different, it can only propose an * offer. * * @param validActions * Either a list containing both accept and offer or only offer. * @return The chosen action. */ @Override public Action chooseAction(List> validActions) { roundN++; // Update the round number // System.out.println("Round N� "+ roundN); // System.out.println("I am " + this.getPartyId().toString()); if (!validActions.contains(Accept.class)) { // No Offer on the table yet // Generate all possible bids for this utility space double[] utils = BidGenerator.utilitylist(possibleBids, this); // for(int i=0;i getAgentUtilsList() { return agentUtilsList; } public int roundDeadline() { return getDeadlines().getType() == DeadlineType.ROUND ? getDeadlines().getValue() : 0; } public int getRoundN() { return roundN; } public List getPartylist() { return partylist; } public Bid getLastbid() { return lastbid; } public BidHistory getBidhistory(AgentID Agent) { return bidhistorylist.get(partylist.indexOf(Agent)); } public ArrayList getAlreadyProposed() { return alreadyProposed; } public ArrayList getPossibleBids() { return possibleBids; } @Override public String getDescription() { return "ANAC2015"; } }