/* * Author: Marcos Dias de Assunção * Date: March 2006 * Description: A simple program to demonstrate of how to use GridSim * auction extension package. * This example shows how to create user, resource, auctioneer * and auction entities connected via a network topology, * using link and router. * * This class was adapted from examples on network * package developed by: Anthony Sulistio * */ import eduni.simjava.Sim_event; import eduni.simjava.distributions.Sim_uniform_obj; import gridsim.GridSim; import gridsim.GridSimTags; import gridsim.Gridlet; import gridsim.GridletList; import gridsim.auction.ReverseDutchAuction; import gridsim.auction.ReverseEnglishAuction; import gridsim.auction.ReverseFirstPriceSealedBidAuction; import gridsim.net.SimpleLink; import java.util.LinkedList; /** * This class basically creates Gridlets and submits them to a * particular Broker in a network topology. */ class NetUser extends GridSim { private int myId_; // my entity ID private LinkedList auctions; // list of auctions to be posted private GridletList jobs; // list of jobs to be executed private GridletList receiveJobs; // list of received Gridlets private Broker broker; /** * Creates a new NetUser object * @param name this entity name * @param totalGridlet total number of Gridlets to be created * @param baud_rate the baud rate of the link to which this user is attached * @param delay the delay of the link * @param MTU the maximum transfer unit of the link * @param broker the broker associated with this user * @throws Exception This happens when name is null or haven't * initialized GridSim. */ NetUser(String name, int totalGridlet, double baud_rate, double delay, int MTU, Broker broker) throws Exception { super( name, new SimpleLink(name+"_link",baud_rate,delay, MTU) ); this.receiveJobs = new GridletList(); this.jobs = new GridletList(); this.broker = broker; this.auctions = new LinkedList(); // Gets an ID for this entity this.myId_ = super.getEntityId(name); // Creates a list of Gridlets or Tasks for this grid user this.createGridlet(myId_, totalGridlet); long seed = 11L*13*17*19*23+1; Sim_uniform_obj genReservePrice = new Sim_uniform_obj("price",1, 90, seed); try{ int choice = 1; for(int i=0; i