Class SupplierModel

java.lang.Object
  extended by SupplierModel

public class SupplierModel
extends java.lang.Object

Keeps track of a single supplier and component. There will be two objects per supplier (e.g., pintel will have one both CPU types). Reputation is tracked, predictions can be made about prices the supplier will offer in response to RFQs, and deliveries can be predicted. The ComponentInfo object will update this object at the start of each day with information about offers made and components delivered, and at the end of each day with the offers accepted.


Field Summary
private  int basePrice
           
private  double capacity
           
private  int componentIndex
           
(package private) static double cpuAPR
           
private  int date
           
private  double[] fractionCommitted
           
private  int[] fractionCommittedDates
           
(package private) static int initialAverageCapacity
           
(package private) static int initialReputationQuantity
           
private  java.util.Hashtable myOrders
           
private  java.lang.String name
           
(package private) static double otherAPR
           
private  int productId
           
private static java.util.Hashtable quantityOffered
           
private static java.util.Hashtable quantityOrdered
           
private  double reputation
           
(package private) static int reputationRecovery
           
 
Constructor Summary
SupplierModel(int componentIndex, int productId, java.lang.String name, int basePrice)
           
 
Method Summary
 void addDelivery(OrderInfo order, int todaysDate)
          Records a delivery from the supplier.
 void addOrder(OrderInfo order, int todaysDate)
          Record an order from this supplier, and update reputation.
 double calculatePrice(int dueDate, double quantity)
          Predicts the price (per component) that will be offered for an RFQ with the given due date and quantity.
 int[] getExpectedDeliveries()
          Returns an array indicating the expected future deliveries from the supplier.
 java.lang.String getName()
          Returns the supplier's name.
 int getProductID()
          Returns the product ID
 double getSpareOffers()
          Returns the amount by which offers could be increased without the reputation dropping below 1.
 void processMarketReport(se.sics.tasim.props.MarketReport mr)
          Processes a periodic (every 20 days) market report.
 void update(int date, java.util.Vector offers)
          Updates estimates of the supplier's fraction of capacity used.
 void updateReputation(java.util.Vector orders, java.util.Vector offers)
          Updates the reputation with this supplier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialAverageCapacity

static final int initialAverageCapacity
See Also:
Constant Field Values

initialReputationQuantity

static final int initialReputationQuantity
See Also:
Constant Field Values

cpuAPR

static final double cpuAPR
See Also:
Constant Field Values

otherAPR

static final double otherAPR
See Also:
Constant Field Values

reputationRecovery

static final int reputationRecovery
See Also:
Constant Field Values

componentIndex

private int componentIndex

productId

private int productId

name

private java.lang.String name

basePrice

private int basePrice

capacity

private double capacity

quantityOrdered

private static java.util.Hashtable quantityOrdered

quantityOffered

private static java.util.Hashtable quantityOffered

reputation

private double reputation

fractionCommitted

private double[] fractionCommitted

fractionCommittedDates

private int[] fractionCommittedDates

myOrders

private java.util.Hashtable myOrders

date

private int date
Constructor Detail

SupplierModel

public SupplierModel(int componentIndex,
                     int productId,
                     java.lang.String name,
                     int basePrice)
Parameters:
componentIndex - index (0-9)
productId - (e.g., 301)
name - supplier name
basePrice - the component's base price
Method Detail

getName

public java.lang.String getName()
Returns the supplier's name.

Returns:
name

getProductID

public int getProductID()
Returns the product ID

Returns:
ID

update

public void update(int date,
                   java.util.Vector offers)
Updates estimates of the supplier's fraction of capacity used.

Parameters:
date - today's date
offers - a vector of offers

processMarketReport

public void processMarketReport(se.sics.tasim.props.MarketReport mr)
Processes a periodic (every 20 days) market report. Currently, this only records the supplier's reported capacity, which is actually the average capacity over the period.

Parameters:
mr - the market report

addOrder

public void addOrder(OrderInfo order,
                     int todaysDate)
Record an order from this supplier, and update reputation.

Parameters:
order - a single order
todaysDate - the date

updateReputation

public void updateReputation(java.util.Vector orders,
                             java.util.Vector offers)
Updates the reputation with this supplier.

Parameters:
orders - a vector with the day's orders
offers - a vector with the day's offers

getSpareOffers

public double getSpareOffers()
Returns the amount by which offers could be increased without the reputation dropping below 1.

Returns:
offer quantity

addDelivery

public void addDelivery(OrderInfo order,
                        int todaysDate)
Records a delivery from the supplier.

Parameters:
order - the order that was delivered
todaysDate -

calculatePrice

public double calculatePrice(int dueDate,
                             double quantity)
Predicts the price (per component) that will be offered for an RFQ with the given due date and quantity. The prediction is based on past offers from the supplier, and takes into account the quantity requested in the RFQ will raise the price.

Parameters:
dueDate - when delivery is requested
quantity - the quantity requested
Returns:
predicted cost per component

getExpectedDeliveries

public int[] getExpectedDeliveries()
Returns an array indicating the expected future deliveries from the supplier. The array has a length of 220, and a delivery on day d is indicated at index d.

Returns:
array of deliveries