SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Resource Allocation in an
Artificial Electronic Market
Final Report
Matthew Mun-Yui Yee
5/9/2008
The allocationof resourcesina large organisationcanbe an inefficientexercise constrainedbypoor
sourcesof informationandassortedhuman factors. Marketsand financial instrumentssuchas
derivativesexhibitdesirablepropertiesinconveyinginformationtomarketparticipantsaswell as
mitigatingrisk. Anautomatedsystemforsimulatingthe trade andconsumptionof futuresresource
contracts betweensoftware agentsispresentedandimplemented. The performance of different
transactionsisshowand a relationshipbetweenatradingconstraintandtrading activityare presented
as results.
Contents
1 Introduction................................................................................................................................4
1.1 What advantage does a Market based solution hold over a centrally planned solution?....Error!
Bookmark not defined.
1.1.1 The Producer................................................................................................................5
1.1.2 The Consumer..............................................................................................................5
1.1.3 What are the problemsassociatedwithcentrallybasedresource allocationinalarge
organisation?..................................................................................Error! Bookmark not defined.
1.2 A Market-Based Solution: TAC market Design Competition ....................................................7
2 Simulation System Design............................................................................................................8
2.1 Workflow............................................................................................................................9
2.2 Agent Roles.........................................................................................................................9
2.2.1 Producer......................................................................................................................9
2.2.2 Buyer...........................................................................................................................9
2.2.3 Seller.........................................................................................................................10
2.3 The Contract......................................................................................................................10
2.3.1 Contract States...........................................................................................................10
2.3.2 Agent Contract Operations..........................................................................................10
2.4 Funds................................................................................................................................11
2.5 Resources..........................................................................................................................11
2.6 Decision Processing............................................................................................................11
2.6.1 The Definition of Slack ................................................................................................11
2.6.2 Decision Cycle ............................................................................................................12
2.6.3 Execution...................................................................................................................13
2.7 Implementation.................................................................................................................14
2.7.1 Agent roles.................................................................................................................15
2.7.2 Database handling......................................................................................................15
2.7.3 Agents implementation...............................................................................................15
2.7.4 Contract Implementation............................................................................................15
2.7.5 Contract States...........................................................................................................17
2.7.6 Agent Operations .......................................................................................................18
2.7.7 Agent Resources Implementation................................................................................19
2.7.8 Funds Implementation................................................................................................19
2.8 Slack Implementation ........................................................................................................19
3 Simulation Results.....................................................................................................................19
3.1.1 Simulations................................................................................................................19
3.1.2 Constant Consumption ...............................................................................................20
3.1.3 Contract Discharge .....................................................................................................23
3.1.4 Random Consumption Function...................................................................................24
3.1.5 Varying the lower slack limit........................................................................................27
4 Conclusion................................................................................................................................30
5 Bibliography..............................................................................................................................31
1 Introduction
The allocationof resourcesina large organisationisacomplicatedtaskfraughtwithinefficiency. For
example,computingresourcessuchasdiskstorage are costly1
andrequire specialistknowledge.
Planningforcapacityisoftenimperfectandsubjecttoperiodsof laginprocurementanddeployment. A
solutionmaybe found inmitigatingthe riskof makingpoordecisionsbyusingfinancial instrumentssuch
as futurescontracts.
The value of futurescontracts lie intheirabilitytohelptheir buyersmake longtermdecisionstohedge
againstfluctuatingpricesof resources. Futurescontractscanbe especiallyvaluable inthe acquisitionof
resourceswithpricesthatfluctuate inlarge values. Buyersandsellersof thistype of derivative create a
marketwhere riskcan be offsetforfinancial consideration.
For example,anairlineknowshowmuchfuel itwill needtobuyinsix monthsand alsoknowshowmuch
moneyitcan spend. The airline knowsthatthe price of fuel isextremelyvariable andisnearly
impossible topredictwithinareasonablemarginatthe conclusionof six months. If the presentprice of
fuel is$5/L the airline mayhedge againstthe riskdearerfuel costsbypurchasing acontract to buy fuel
insix monthsat a cost of $5.10/L. Atthe conclusionof six monthsthe airlinewillhave saveditself
considerable moneyif the costof fuel hasrisentosome amountgreaterthan $5.10/L.
Thisprojectinvestigatesthe constructionandapplicationof amarket,similartoa commodities trading
exchange toan organisationthatmayconsistof several organisationalunits. The implementationof a
marketfor futurescontractswithinalarge organisationisexploredinthisprojectbybuildingasoftware
systemtosimulate theirtrade betweensoftware agents thatrepresentorganisational units. Simple
strategiesare appliedtothese agentstobuyandsell contracts,basedupontheirownsupplyof
resources andthe supplyof resourcesinthe artificiallycreatedmarket.
The rest of thissectiondiscussessome backgroundbehindthe principlesincreatingamarketbased
solutionaswell asthe TAC competition. Itisconcludedwithadescriptionof some goalsforthe system
to achieve these principles. The restof the reportisorganisedintoa descriptionof the system’sdesign
whichaspirestogive the readermore detail intohow the simulationsystemwill operate,followedbya
descriptionof the implementationandthe experimentsthatwere conductedonthe finishedproduct
and the resultsthatwere obtained.
1.1 Elements of a market and how they map to a large organisation
A marketbasedsolutionprovidesaframeworkinwhichorganisational unitscancoordinate their
resource consumptiondecisions[4]. Assuch,itis requiredthatanalogiesof marketcomponentsbe
definedwithrespecttoanorganisation. These includethe ProducerandConsumerof aresource as well
as the rulesof trade and the productsto be traded.In thissection,we define the basiccomponentsof
the market-basedsolutionbymappingcomponentsof amarketto the componentsof anorganisation.
1 Whilethe actual costper megabyte of off-the-shelf hard drives are decreasing,the costdoes not take into
accountenterprise storage resources that includetape backup,diskless backup,archival systems and media,
backup software licensed by capacity and SAN infrastructure.
In a large organisationwhere the allocationof resourcesiscentrallyplanned,inefficiencymaymanifest
itself informssuchas over-allocationorunder-allocation. Bothof these inefficienciesare detrimental to
an organisationbecause theyresultinbudgetdeficitandsurplus. The consequencesof adeficitare
obvioushoweverabudgetsurpluscanbe an indicationof incorrectallocationresources,burdeningone
organisational unitwithtoomanyresourceswhile starvinganother. Inordertoincrease efficiency in
the consumptionof resources,amarket-basedsolutionmaybe usedasan alternative.
1.1.1 TheProducer
The Producerin thissyntheticmarketmaybe specifiedasthe Plannerof anIT department. Itisthe goal
of the IT Plannertoallocate storage resourcestovariousorganisationalunits. Itcan be saidthat the IT
Planner“produces”storage resources.
The basic economicattributesof the Producerare as follows
1. Overa givenbudgetperiod,the Producerisonlyallowedto‘produce’afinite amountof storage
resources.
2. The cost of the storage resourcesconsistsof the procurementcostandthe costof labourto
install it.
1.1.2 TheConsumer
The Consumermaybe specifiedasthe individual organisational unitsthatoperate underthe highest
authoritywithinthe organisation.
The basic economicattributesof the Consumerare asfollows
1. Overa givenbudgetperiod,the organisationalunitconsumesstorage resources,orthe
product.
2. Thisproduct isexchangedfromthe Producerpreviouslydefined. The productisthe storage
resource.
3. The product isexchangedfromthe Producerfora cost.
1.1.3 TheConsumerandProducerappliedto anexampleorganisationandtheproblems
associatedwithcentralisedresourceallocation
In a large organisation,itisadvantageoustoexploiteconomiesof scale inprocuringresourcesthrougha
single pointof contact. In turn thissingle pointof contactprovisionsresourcestoorganisational units
that require them. Ina large organisationsuchasa universityoracitygovernment,budgetingcanbe a
complicatedordeal. Inamunicipal Budgetsare allocatedannuallyandthe planningprocesscantake an
entire year. A great deal of time isdedicatedtothe preparationof a budgetbythe IT Plannerof the
organisation. Thissectiondiscussesthe exampleof SAN diskspace allocationatthe Cityof Vancouver
and itsproblemsleadingtoinefficiency.
An IT departmentcanbe expectedtoprovide centralisedservicestocomposite organisational units
withinanorganisation. Economiesof scale figureprominentlyinselectingacentralisedenterprise
model. It providesanadvantage inallowingthe smallerorganisational unitstoparticipate inan
infrastructure thatwouldotherwise be toocostlytoimplementontheirown. Thiscouldinclude a
virtualisedcomputinginfrastructure,storage areanetworksandcentraliseddatabackupservices,
amongstothers. The SAN and associatedbackupinfrastructure atthe Cityof Vancouvertotals
approximately1millionCADperannum,excludingthe costof labour.
In the provisioningof these resources,organisationalunitsmustprovidethe ITdepartmentwith
informationthatwill assistinplanning. Basedonthe available information,the ITPlannerwill attempt
to determine the fundingrequiredforabudgetyearbutit can be verydifficultfororganisational units
to communicate the rightinformation,suchascurrent andfuture utilisationof resourcestothe IT
department. Poorcommunicationof informationwillresultininsufficientplanning,costoverrunsand
delaysinworkschedules.
In the case of informationgatheredoncurrentresource utilisation,itisoftendifficulttodraw any
conclusionsonfuture ratesof resource utilization,especiallyinanorganisationthatisgrowingrapidlyin
termsof projectsandhumanresources. Anexercise intrendanalysiswillyieldlittle meaningful
information. Thisisbecause the growthof dataoftenballoonsinthe implementationof new projectsor
newinitiatives. Forexample,anewprojectmayrequire adatabase componentandinorderfora
developertotestnewcode,a copyof a productiondatabase maybe acquired. The consequenttest
database mayrequire modificationbefore runningthe new code. The new developmentdatabase may
be duplicatedforotherdeveloperstoruntheirowntestsand may alsobe backedup to disk. In this
example, itisclearthata single database of several hundredmegabytescouldmultiplythe diskstorage
requiredfordevelopmenttasksbyordersof magnitude.
Withrespectto informationpertainingtofuture projects,knowledge gapsoftenexistthatcannotbe
easilyeliminated. Thiscontributestodifficultyinplanningaccurately. Ina large organisation,
organisational unitsare dividedbytheirspecialistknowledge andskills,suchasthe legal oraccounting
departments2
. Anorganisational unitusuallydoesnotpossessthe specialistknowledgerequiredto
understandwhatinformationmustbe giventothe ITdepartmenttoplanaccurately. Anaccounting
departmentmayunderstandwhatinformationitwishesanenterpriseresource provisionapplicationto
report. Unfortunatelythe ITPlannermaynot know thata single reportmayrequire duplicationto100
differentmanagersresultinginincreasedstorage utilisation. Inthisexample the knowledgegapcould
have beeneliminatedbythe IT Planneraskingthe rightquestions. The accountantmaynot realize that
non-accountantswouldnotbe privytotheirinformation.
There alsoexistsariskfor the IT Plannerthatthe organisational unitmanagermaynotbe forthright
aboutresource requirementsandinflate oroverestimate estimatesforagivenbudgetyear. A reason
for disseminationof false informationatthe Cityof Vancouverarose frompoor relationshipsbetween
managersstemmingfrompastdisputes. Suchdisharmonyisverydifficulttoovercome asmotivations
are personal innature anddismissal israrelyeverused,evenforthe mostegregioustransgressions.
In a municipal environmentsuchasthe Cityof Vancouver(COV),deficienciesinplanningcanbe
overcome atthe costof time. Unforeseenrequirementsforcomputing resourcescanalwaysbe
2 I would note that a general shortcomingof an IT department is its ignoranceto what the entire organisation
actually does.
remediedaslongasthe deploymentisdelayed. Procurementproceduresandpoliciescancreate delays
because bydefinitiontheyare requiredtobe transparentandare thustenderedatthe great expenseof
time. For example,afterabudgetallotmenthasbeenestimatedforayear,it mustbe determinedif the
resource to be replenishedrequirespublictender. Proceduresforpublictendercanrequire several
monthsto complete andmightrequire the assistanceof the legal department. Respondents’proposals
mustthenbe evaluatedthroughmultiple roundsbefore acontractis awarded.
Market reformstrategieshave beenappliedinthe energysectorasa meansof optimisingenergy
deliverycosts. Suchstrategieshave beenmade possible due toavailabilityof new technologies. See the
example of the energysector[1].
The inefficienciesdiscussedinthisexample stemprimarilyfromalackof actionable informationsuchas
the projectsthat will be implementedorthe exactresource usage requirementsforsuchprojects. Disk
space usage can alsobe verydifficult topredictasdemonstratedinadevelopmentscenario. A good
solutiontothisproblemwouldrequire informationtobe conveyedaccuratelytomanagerssothatthey
can react appropriately. Aswell,itmaybe effectivetodevise asystemthatpermitsmanagerstoquickly
make up forplanningshortfallsinresources,suchasa marketsystemthat allowsparticipantstotrade
resource surpluseswiththose experiencingdeficits.
In thisparticularproject,the managersof organisational unitswill be replacedwithagentstoperform
the trade of resource contracts automaticallyoverwhatmaybe an organisation’sfiscal cycle. This
removesthe humanfactorsthat contribute toinefficiencyandmayofferadvantagesinfaster,more
accurate decisionmakingthroughconstantmonitoringof the resource supply.
1.2 A Market-Based Solution: TAC market Design Competition
The applicationof market-basedsolutionswithrespecttosoftware agentsisnotnew. The Trading
AgentCompetition(TAC) MarketDesignCompetitionisacomputerizedcompetitionconsistingof
buyers,sellers(akatraders) andspecialists. The goalsof the entrants(calledspecialists)tothe
Tournamentare[5]:
 To designthe marketrulesforeffectivelymatchingbuyersandsellersgivenadynamicsetof
traders.
 To compete againstothermatchmakers(specialists) byattractingtraderstoyour ownmarket.
 To maximise profitsbysettingappropriatecommissionfees.
At presentaTAC tournamenthasbeenproposedforthe tradingof derivatives. Itishypothesizedthat
the work completedinthisreportcouldbe adaptedforuse inanysuch future TACtournamentsince
manyof the issuesencounteredinthe regularTACtournamentare similartothose intrading
derivatives. Suchissuesinclude pricing,commissionandnew problemssuchasderivativecontract
duration.
2 SimulationSystem Design
In lightof the organisational problemsthatinhibitthe allocationof resourcesin anefficientmannerand
the potential toolsavailable inamarketsuchas derivatives,improvedefficiencymaybe gainedthrough
the creation of a systemthatfacilitatesamarketto trade surplusesof resources. Suchamarket
requiresup-to-date informationaboutresourcestobe made availabletoproducersandconsumers.
Withthisinformation,producersandconsumersmaybe more able toplanresource productionand
consumptionmore efficiently.
The firstobjective istorelayinformationtothe producersandconsumers. Withthisinformation,the
producercan determine howmuchof a givenresource existssothatmore can be produced. The
consumercan use the systemtodetermine the price of the remainingresource,asdeterminedbythe
producer. The informationisstoredina database andorganisedintospecifiedstatessothatconsumers
can producershave accessto all the contracts anddetermine whethertheycanbe bought,sold,or
consumed.
The secondobjective istoenable the abilityforproducersandconsumerstotrade resources. A
producerwill be giventhe abilitytolistresourcesavailableforsale,alongwithaprice. A consumerwill
have the abilitytobuythe resource forthe listedprice. Additionally,aconsumermaydecide tosell a
surplusof resources.
Each agent withinthe simulationsystemisgivenaturnto performactionsonthe marketthrough its
owndecisioncycle. The entire simulationiscomposedof multipleiterationsof the decisioncycle forall
the agentsparticipating inthe market. The sum total of all the iterationsthatagentsexecutetheir
decisioncycle canbe takenas a fiscal periodorsome othermeasure bywhicha large organisation
definesitsbudgetcycle.
The overall systemarchitecture iscomposedof agentsthatqueryadatabase forthe availabilityof
resource contractsfor sale. The agent representsthe consumerinthe systemthatisalsothe
organisational unitwithinalarge organisation. If anyresource contracts are available forsale, the agent
may thenbuy a quantity of these resource contractsand immediatelydischarge themtoreplenishtheir
resource supply. Contractscan be boughtfrom a special produceragentthatcan be analogoustothe IT
plannerasgiveninthe Cityof Vancouverexample.
Aftera contract is bought,anagentmay decide thatit hasenoughresourcesbut decide tosell its
resource contractsat a laterpointintime. These resource contractsmay be boughtby otheragents.
The agents’ decisiontobuyor sell resource contractsisgovernedbya monitoringsystemthatissetby
numerical boundsof resource values. The agentwill be configuredwithandupperboundanda lower
bound. Resource valuesthatcorrespondwithvaluesbetweenthe upperandlowerbounds,orthe slack
of the agentare comparedwiththe agent’sactual supply.
Thissection presentsandexplainsthe functionsof the simulationsystembyfirstreviewingthe workflow
of the twodifferenttypesof agents. Subsequentlyitis shownthateachagentcan assume different
rolesthatenable themtoperformdifferentoperations. Followingwill be adescriptionof the resource
contract and the decisionmakingprocessthatanagentmakesto buyand sell contracts.
2.1 Workflow
The workflowforthe producerinthe systemisas follows:
1) Producersetsthe resource contract duration,price,amountof resourcesto‘sell’.
2) The Produceropensthe sale of the resourcestoConsumers.
3) The systemrecordsthe resourceslisted.
4) The systemrecordsthe salesof the resourcestoConsumers. The systemmustensure thatthe
Consumershave enoughfundstopurchase the resources.
For the consumer,the correspondingworkflowisbelow:
1) Consumerbuysthe resources. The inventoryof resource contracts forsale bythe produceris
deducted.
2) If the Consumerdoesnotneedthe resources,theyare putbackonto the marketto be traded.
3) The consumerdischargescontractsand consumesthe resourcesasrequired.
2.2 Agent Roles
In thissystem,anagentbuysand sellscontractsforresources whichallow themtoreplenishtheir
supply. Inorder to differentiate whatanagentispermittedtodo,rolesare definedwhichare
associatedtocertainactionsor operations whichmaybe performed. A consumer agentisallowedto
performthe operationsassociatedwith the buyerandsellerroles. Inthe case of the produceragent,a
privilegedrole isdefinedexclusivelyforproducingcontracts. Consumeragentscannotassume the
producerrole. A produceragentassumesthe producerrole andthe seller role.
2.2.1 Producer
The producerrole is a privilegedand permitsthe productionof contractswithinthe system. The agent
that undertakesthisrole cannotundertake anyotherroles. The producerrole ismeantto be a
specialisedrole withinthe systemandisnotintendedtoparticipate inthe market(otherthancreating
the contracts). The personwithinthe large organisationwhichwishestoallocate resourcestothe
organisational unitscontrolsthisagent.
2.2.2 Buyer
An agentthat assumesthe buyerrole canbuycontracts. This meansthatthe agentcan modifythe
contract to the boughtstate (thisisdefinedbelow). Inessence,thismeansthe contractismodifiedto
reflectachange inownershipandfundsare transferredbetweentwoagents. The buyerrole contains
no provisionstonegotiatethe price of a contract. A buyeragentismotivatedbya requirementto
replenishorstockresourcesinordertoaccommodate theirconsumption. Onlythe consumeragentcan
assume thisrole.
2.2.3 Seller
The sellerrole enablesanagentto putthe contract intoa sell state. Thisrole alsoallowsthe agentto
setthe price of the contract. By enteringacontract intoa sell state,the sellingagent iscreatingan
invitation buythe contractby prospective buyingagents,alsoknownasan invitation to treat. A selleris
motivatedtoliquidateitssurplusof resourcestogenerate more fundstosave for future use,sothatit
can mitigate unforeseenresource consumption. Boththe consumerandproduceragentscan assume
thisrole.
2.3 The Contract
The contract isa record containingattributesthatspecifythe conditionsunderwhicharesource canbe
tradedor used. The contract hasan expirationdate at whichtime the resourcesare to be deliveredto
itsowner. The ownermaydischarge the contract before thatdate if so desired. Once the contractis
discharge,the resourcesare addedtothe owner’sexistingsupplyof resources.
Contracts can existin differentstatesdependingonthe operationanagentperformsonit. All attributes
withinacontract are manipulated bythe agentsthroughoperationspermittedtothemthroughthe
assumptionof roles.
2.3.1 ContractStates
A contract may existinfourstates,creation,sale,boughtanddischarged. Eachstate signifiesthe result
of an operationanagenthas performedonthe contract. These operationsare performedbasedupon
the tradingstrategyadoptedbythe agent. Aswell,identifyingthe relativeproportionsof contractsin
these variousstatesproducesinformationaboutthe healthof the internalmarketandthe performance
of the agents.
A validcontractmay be dischargedbythe ownerof the contract at any time andfor practical purposes,
can be understoodasthe act of consumingorusinga resource,suchthat itcannot be tradedagain. A
contract in a dischargedstate cannotbe modified.
For example,acontractin a boughtstate cannot be boughtby anyagent,can be dischargedbyits
ownerandcan be soldby itsowner. If the ownerof the contract ina boughtstate wantsto sell the
contract, itmust enterthe contract intoa sell state. A contract enteredintoasell state canbe bought
by anyagent inthe system as longas ithas not beendischarged.
2.3.2 AgentContract Operations
Agentswhichassume the BuyerandSellerrolesperformspecificoperationsoncontractsinorderto
enterthemintodifferentstates. These operationsmodifyvariousattributeswhichcorrespondto
definedcontractstates. Operationsincludeproduce,buy,sell anddischarge.
To produce meansthat contract resourcesare createdforsale to agentswithinthe market. To buya
contract, the ownershipof the contractis transferredfromone agenttoanotherinexchange for
financial consideration. Tosell resourcesmeanstosignal tootheragentsthatone wishestosell them.
To discharge a contract meansto conclude the contract once the resource associatedtothe contract
has beendelivered orusedbythe owner.
2.4 Funds
The currency to be usedin transactionsbetweenagentsconsistsof arbitraryunitsassignedasfunds to
each agent. The fundsare to be transferredbetweenagentsinconsiderationforthe exchange of
contracts.
2.5 Resources
Each agent maintainsitsresourcesindependentof eachother. The rate of consumptionof the
resources,orthe consumptionfunctionisindependentof anyotherfactors. The consumptionfunction
isa parameterbywhichmarketconditionsmaybe manipulated. Some agentswill be assignedfunctions
withhigh,lowandperiodicrates.
2.6 Decision Processing
An agent’sprimaryconcernisto ensure thatithas access to enoughresourcestofunction. Thiscanbe
done bypurchasingmore resources(orinthe case of thisproject,contractsfor resources) orby
conservingormoderatingitsconsumptionof resources. If itisdeterminedthatthe agenthas enough
resourcesinitspossessiontoensure itsfunction,the agentmaydecide tosell itssurplusof resources.
An agentmayalso determinethatitdoesnotneedto performbuyor sell operationsinorderto
function. The agentmay come to thisconclusionif itdeterminesthatthe difference betweenits
resource supplyandconsumptionare withinthe boundsof arange of valuesdefinedasslack.
2.6.1 TheDefinitionofSlack
The slack boundariesare constraintstothe buyingandsellingbehaviourof the agent. The boundaries
are operatinglimitsandare usedtodefine a
desiredbehaviour.
An agentmakesitsdecisiontobuyor sell
resourcesbaseduponthe lowerandupperlimits
of slack,respectively. If the agent’ssupplyof
resourcesachievesavalue betweenthese two
bounds,itcan be consideredtohave achievedits
goal and is notrequiredtoperformanyadditional
tasks. In otherwords,the supplyof resourcesis
withinanominalrangeof operation. Shouldthe
value of resourcesfall below the lowerslack
value,itcan make a decisiontobuyadditional
resource contracts. The agentis thusoperating
withinadeficitrange. Converselyasurplusexists
if its supplyof resourcesexceedsadefinedupper
slacklimitandthe agent maydecide tosell the
excessresource contracts. The agentisthen
operatingina surplusrange.
Upper Slack Limit
Lower Slack Limit
Time
Surplus
Range
Deficit
Range
Nominal
Range
Resource Supply
Illustration of Slack
Slackboundariesare configuredtoobtainadesiredbehaviourfromanagent. Thisstrategyis configured
to obtaina certaingoal whichmay or may notbe a prescriptiontocontrol consumptionorto
accommodate growth. If the difference betweenthe upperandlowerslackboundariesare small,thus
creatinga narrow nominal range of operation,the behaviourof the agentwill be coupledmore tightly
withthe consumptionrate of resourcesforthat agent.
Consideranexample where thatthe upperslacklimitis50 resource unitsandthe lowerslacklimitis40
resource units. The nominal range of operationisbetween40and 50 resource units. If the agent’s
supplyof resources+ the agent’ssupplyof resource contractsisgreaterthan 50, the agentisdeemedto
be operatingwitha surplus. If the agent’ssupply of resourcesislessthan40, the agent isdeemedtobe
operatingwithadeficit. The figure above illustratesthese concepts.
2.6.2 DecisionCycle
The simulationconsistsof several iterationswhere anagentdecideswhetherornot to buyor sell
resource contracts. This decisionmakingprocessiscalledthe decisioncycle. Priortothe beginningof
the decisioncycle,all marketparticipantsare assignedacertainamountof resourcesanda certain
amountof funds. Whenthe simulationbegins,the resourcesare consumedandthe agentspendsits
fundsto replenishitssupply. The maindecisiontobe made bythe agentin a cycle is determiningif
there isa surplusor deficitof resource contracts. Thisdecisionpointhasthree possible outcomes,do
nothing,buyresource contractsand sell resource contracts.
At the beginningof the decisioncycle the agentfirstcheckstosee if the fiscal periodisover. The fiscal
periodisa metricto describe the total iterationsof the decisioncyclesthe agentexecutes. If the agent
has reachedthe endof the fiscal period,the simulationisconcluded.
The agent thenmustdecide whetherornot itssupplyof resourcesiswithinthe nominalrange of
operation. Inotherwords,the agent mustcheck that the supplyof resourcesitownsisgreaterthan the
lowerslacklimitandlessthanthe upperslacklimit. If the agent’ssupplyof resourcesiswithinthe
nominal range of operation,itdoesnothingandthe cycle isconcluded.
If the agent’ssupplyof resourcesexceeds the upperslacklimit,itcansell itssupplyof resource
contracts if it hasany in itspossession. If the agent’ssupplyof resourcesislessthanthe lowerslack
limit,itmustthendetermineif ithasenoughresource contractsinits possessionthat itcan discharge to
replenishitssupplytomeetthe nominal range of operation. If ithas enoughresource contracts,itwill
simplydischarge asmanyas itneeds. If it doesnothave enough,itmustthenbuy as manyresource
contracts as it can affordanddischarge themaccordinglytoincrease itssupply.
As mentionedinthe precedingsection,slackboundariesare configuredinordertoobtainadesired
behaviourfromthe agent. A narrow nominal range of operationwouldcause the agenttorespond
sharplyto fluctuationsinitsresource consumption. A widernominal range wouldcause the agentto
respondlessactively.
Is the supply of resources
within nominal range of
operation?
Do nothing.
Is the fiscal
period over?
No
Yes
Start
Simulation
End Simulation
Is there a supply or a
deficit?
No
Surplus
Sell surplus
resource contracts
if there are any.
Are there enough resource contracts to
discharge to return supply to nominal
range of operation?
Deficit
Discharge resource
contracts to return
resource supply to
nominal range of
operation.
Yes
Buy as many resource
contracts as are needed to
return supply to nominal range
of operation and discharge
them.
No
Figure 1
2.6.3 Execution
The decisioncyclesinthe systemare executedinmultiple iterations. The sumof these iterationsis
defined periodof the simulation. The periodisanalogoustoa fiscal yearor anyother metricthat
specifiesthe time limitduringwhichresourcesare allocated,tradedandconsumed. Ineachiterationof
the loop,anynumberof agentsmaybe instantiatedandrun. The agentsthemselvesare statelessand
the resultsof theirdecisionsare storedwithinthe database (resultsof purchasingandsellingoperations
baseduponconsumptionand resource contractpopulation).
Duringthe execution,the consumptionfunctiondeductsresourcesfromthe agents’ supplywhichis
recordedwithinthe database. The consumptionfunctioninandof itself isunknownbythe agent. The
agentis onlyable to querythe amountof resourcesitowns. The consumptionfunctiondeductsthis
amountas required.
2.7 Implementation
The simulationsystemisimplementedinJavaandmakesuse of mySQLserver5.0 as the database
backend. The simulationsystemiscomposedof 3main components;the implementationof the agents,
a componentthatdefinesthe variousrolesandtheiroperations(ormethods) andacomponentthat
handlesthe underlyingdatabase operationswhichare usedforkeepingtrackof contracts, fundsand
resources. Agentscanperformoperationsoncontractswhichenterthemintospecificstates,suchas
the bought,sale anddischargedstates. Baseduponthe statesof the contracts,the agentscan
determine whetherthe contractmay be bought,soldor discharged. The decisiontoexecutethese
operationsisimplementedinthe decisionprocessingportionof the agentwhichreliesuponthe
configurationof the slacklimits.
The screenshotbelowdepictsthe outputof the executionof the simulation.
Figure 2
First,the implementationof agentroles isdiscussed,followedbyanoverviewof how the interaction
withthe database wasimplemented. Thenthe implementationof the agentsisreviewed,followedby
the contracts. Finallythissectionconcludeswithadiscussionof the implementationof agent
operationsandslack.
2.7.1 Agentroles
Thispackage contains classesassociatedwithbuyer,sellerandproducerroles. The customerclass
containsa unique IDthat isinheritedbythe buyer,sellerandproducerclasses. Each role contains
methodsspecifictothe operationsof the role.
For example,the buyerrole enablesthe agenttoperformoperationssuchastransferringresource
contract ownershipfromthe sellertoitself. Inconsideration,the buyerthentransferswhateversum
was requiredtothe sellertocompletethe transaction.
2.7.2 Databasehandling
The database consistsof 3 tables;the contract,fundand ownerresources tables. The contracttable
containsrecordsof contracts,the fundtable keepstrackof the amountof fundsandthe owner
resources table keepstrackof the resourceseachagentindividuallyowns.
The database handling package containsclassesformanipulatingthe datawithineachof these tables,
includingmethodsforopeningandclosingconnectionstothe database,inserting,updatinganddeleting
records.
2.7.3 Agentsimplementation
The Agentspackage containsagentclassesthatperformtradingtasksbaseduponsupplyinformation
and theirowndemand. The supplyinformationisobtainedfromthe database whichcontainsrecords of
contracts insale states. Independentof thisinformation,the agentcanquerythe database for
informationrelatedtoitsconditionof funding suchashow muchit can spendon the market. Finally,
the agentcan alsodiscoveritsownconsumptionrate andthusforma decisionastowhetherornot it
will needtosell orbuycontracts forresources.
2.7.4 ContractImplementation
Each contract mustbe unique. Thiswill be usedtodifferentiate contractsfromeachotherinorderfor
differentoperationstobe performed.
Contracts forsale will be identifiedbyanattribute thatcan be setby sellingagents. A true value would
signifythe contractisfor sale while afalse wouldsignifyitisnot. Afterthe contracthas been
purchased,thisattribute issettofalse.
The ownershipattribute containsanintegervalue thatbelongstoaspecificagenttosignifythatitis
ownedbysaidagent. Whena contract is purchasedby an agent,the ownershipismodifiedaccordingly.
As mentionedabove,the contractsare limitedintheireffectandexpire atthe endof theirduration.
The durationattribute isan integermeasuringthe time thatthe contract isvalid. Everycycle that the
simulationisrun,thisattribute is checkedforvalidity. Atwhichpointthe contract has expired,the
resourcesare deliveredandthe contractis discharged.
The resourcesattribute contains the value of the resourcesassociatedwitha specificcontract. Forthe
purposesof thissystem,the resourcesare understoodtobe controlledbythe producerinquantityand
initial price.
The price attribute containsthe value of the cost of price of the contract. The value associatedwiththis
attribute can be arbitrarilyassignedaslongasthat value isunderstoodtohave the same meaningbyall
otheragentswithinthe system.
The commencedate records the systemtime atwhichthe contract wascreatedfor the comparisonwith
the systemtime andthe duration. These valuesare usedtodetermine whetheracontract has expired.
Attribute Description
contractID A unique identifierfora contract. Thisattribute issetat the creationof the contract
and isnevermodified. Thisattribute isusedtodistinguishcontractsindividually.
saleStatus Thisflagis setto false whenthe contractis notfor sale. Inorder to signifythe
owner'sdesire tosell it,the contract'ssaleStatusissetto true. An ownerof a
contract can choose to holdontoa contract by leavingthe flagsettofalse forits
duration,at the endof whichit expiresandthe resourcesare delivered.
ownership An ownerisidentifiedbyanID number. The ownershipattribute containsthisID
number. ThisID isset inthe contract whenthe ownershipistransferredtoanother
marketparticipant.
delivery Thisflagis setto false tosignifythatthe contract has not been delivered(inother
words,the resourceshave notbeendeployed),thuscan be traded. The flagisset
to true to signifythe contracthas been delivered. Once the contracthas been
delivered,the flagcannotbe reverted.
duration The durationattribute containsthe time fromthe commencedate (see below) of
the contract that it will expire. Once the contractexpires,the resourcesare
delivered(thusautomaticallydeployingthe resources).
resources Thisattribute containsthe numberof resourcesassociatedwiththe contract.
price The price of the contract.
commencedate The date fromwhichthe contract is created.
Table 1
2.7.5 ContractStates
Contracts mayexistinthe following8states:Creation,Sale,Bought,DischargedandProduce. These
statesallowthe agentstodetermine whatoperationstheymayperformona contract at any givenpoint
intime duringthe fiscal period.
Contract attribute per correspondingcontract state
Contract
State
contractID saleStatus ownership delivery duration resources price commencedate
Sale <string> true <seller> false <int> <int> <int> <long>
Bought <string> false <buyer> false <int> <int> <int> <long>
Discharged <string> true <seller> true <int> <int> <int> <long>
Creation <string> true <producer> false <int> <int> <int> <long>
Table 2
2.7.5.1 CreationState
Before anycontracts are everbought,soldordischarged,theymustbe producedbya produceragent.
A contract isin a creationstate whenitis owned by a produceragent,its saleStatusflag is set to true
and delivery is set to false. This state isan invitationtotreatto otheragentswithinthe system. The
deliveryattribute mustalsobe settofalse. A contract is onlyenteredintothisstate upon itsinception.
Knowinghowmanycontractsexistinthe creationstate at the end of the simulation tellsone if too
manycontracts were producedandcan be construedaswaste.
The table above displaysthe value of the attributesof the contractinthe Creationstate. The
contractID, ownership,duration,resources,price andcommencedate attributesare settowhateverthe
parametersof the environmentmaybe at the time or whateverthe operatorhasinitiallydefined.
Anyone withaccesstoquerythe database can determine whichcontractsare ina creationstate simply
by searchingforall contracts owned bythe producerwithdeliverysetto false andhave saleStatussetto
true.
2.7.5.2 Sale State
A contract ina sale state hasits saleStatusflagsettotrue and isownedbyany agentotherthan the
producer. A contract ina sale state muststill be validinthatthe current systemtime islessthanthe
commencedate plusthe duration. Itmustalsohave deliverysettofalse,denotingthatthe resources
have not beendeliveredandthe contracthas not beendischarged. Thisstate isan invitation to treat to
otheragentswithinthe systemexceptthe produceragent.
Shouldthe agentwishtoreverse itsdecisiontosell the contract,itcan be revertedtoitsboughtstate.
As one can see inthe contract attribute table above,the saleStatusissettotrue anddeliveryissetto
false. If itis required,the agentisfree todischarge acontract in a Sale state shouldthe agent’ssupply
of resourcesbe indeficittothe lowerslacklimit.
2.7.5.3 Bought State
Contracts whichhave beenpurchasedbyagentswiththe buyer role take ownershipof the contractina
boughtstate. This dictatesthatthe contract’s saleStatusflagissettofalse. Aswiththe aforementioned
Sale state,a contract in boughtstate mustbe valid.
The agent isfree to revertthe contract to a sale state if it isso desired. Whenacontract is ina bought
state,itmay be dischargedandthe resourcesare addedtothe agent’sstandingsupply.
2.7.5.4 Discharged State
A dischargedcontractisnot validandcannot be boughtor sold. A contract becomesdischargedeither
because anagent hasdecidedtouse the resourcesassociatedwithitorthe contract haspassedits
durationandexpired. Inbothcases,the resourcesare deliveredandthe deliveryattributeissettotrue.
The value of the saleStatusflagneednotbe modifiednoranyotherattribute sothata recordexistsof
the state of the contract whenit wasdischarged.
As showninthe table above,the deliveryattributeissettotrue.
2.7.6 AgentOperations
Agentsmustmodifythe followingcontractattributeswhenperformingthe specifiedoperationsinthe
table below.
Contract record attributes modified for each correspondingoperation
Operation contractID saleStatus ownership delivery duration resources price commencedate
Produce yes yes yes yes yes yes yes yes
Buy no yes yes no no no no no
Sell no yes no no no no yes no
Discharge no no no yes no no no no
Table 3
2.7.6.1 Produce
The market ispopulatedwithgoodstotrade throughthe productionof futurescontractsby a privileged
agentthat ispermittedtoassume the producerrole. Thisoperationcreatesarecordof a contract with
attributessetinaccordance withthe creationstate withotherattributeschosenasmarketdefaults. All
attributescanbe configuredduringthe produce operation exceptforthe contractIDand commencedate
attributes. These are setbythe computingenvironment,suchasthe systemtime.
The creationstate dictatesthat the ownershipof the contractis setto that of the productionagentand
the saleStatusissetto true.
The table displaysattributesthatare modifiedduringthe executionof the Produce operation. There is
no initial state asthe contract doesnotpreviouslyexist.
2.7.6.2 Buy
An agentassumingthe buyerrole mayperformabuy operation ona contract that isin a sale state. The
saleStatusandownershipattributesmustbe changedaccordinglyif the operationissuccessfully
executed.
2.7.6.3 Sell
The sell operationobligesthe agenttomodifythe saleStatustoa true value. Itis optional forthe agent
to setthe price attribute of the contract.
2.7.6.4 Discharge
The operationof dischargingacontract requiresthatthe deliveryattributeis tobe setto true.
A dischargedcontractis storedwithinthe database withitslastknownstate. Whena contract has been
discharged,the resourceshave beendelivered(orconsideredused) andcannotbe re-tradedonthe
market.
2.7.7 AgentResourcesImplementation
The value of fundsperagent ismaintainedwithinatable ina database. There are onlytwo columns
withinthistable. The firstcontainingthe agent’sownershipIDandthe secondcontainingthe associated
resourcesbelongingtothe agent.
2.7.8 FundsImplementation
The fundsbelongingtoeachagentare recordedina database ina table consistingof two columns. The
firstcolumncontainsthe agent’sownershipIDandthe secondcontainsthe fundsassociatedwiththe
agent.
2.8 Slack Implementation
The slack limitsare generated arbitrarily. Foreach iterationitsimplycomparesitsresource supplywith
the static slacklimits. Uponthe comparisonthe agentcan eitherbuyor sell resource contracts. An
attemptwasmade to devise adynamicmethodof generatingslackvaluesbaseduponthe average
resource consumptionhoweverthisyieldedunsatisfactoryresults.
3 SimulationResults
In orderto demonstrate thatthe simulationoperatesasdesigned,the systemwastestedunderseveral
scenarios. The resultswere output,graphedandanalysed.
3.1.1 Simulations
The simulationswere performedunderdifferentscenarios includingthe following:
1. ConstantConsumptionwith1agent.
2. ConstantConsumptionwith2agents.
3. Contract Discharge
4. RandomConsumptionwith1agent.
5. RandomConsumptionwith2agents.
6. Varyingthe lowerslacklimit.
Experiment1,2, 3, 4 and 5 were performedtodemonstrate thatthe agentswithinthe simulation
systemperformedasspecified. Experiment6was performedtodetermine whatrelationshipthe slack
lowerlimithadwiththe performance of the agent. Itwashypothesizedthatthe largerthe nominal
range of operationbecame,the fewertransactionsthe agentwouldperform. The resultsseemto
supportthishypothesis.
3.1.2 ConstantConsumption
The firstbatch of resultsinvolvedtestingagentbehaviourwhere consumptionof resourceswasata
constantrate.
3.1.2.1 ConstantConsumptionwith 1 agent
The firstresultisreflectsthe behaviourof 1 agentwitha constantconsumptionfunction. This
simulationisintendedtodemonstrate the basicabilityof the agenttodeal withsimple resource
consumptionbypurchasingresource contractsasrequired.
The simulationwasrunfor a total of 200 iterations. Asshownbythe graph depictingthe agentsupply
of resourcesversusthe iterationof the simulation,the marketsupplyof resource contractswas
exhaustedbefore the simulationcompleteditsfull time period.
Figure 3
Simulation 1 Parameters
Numberof Agents 1
Total Iterations(simulationperiod) 200
Initial Resources 5000 resource units
Initial Resource Contracts 0
Initial AgentFunds 10000
ConsumptionFunction 250 units/iteration
SlackLowerBound 4000 resource units
Contract Cost 100 funds
Resourcesassignedpercontract 100 resource units
The simulationbeginswith5000 unitsof resourcesinpossessionof the agent. The consumptionrate for
thissimulationisfixedat250 unitsof resourcesperiteration. The lowerboundof the slackthreshol dis
setfor 4000 unitsof resources. Atthe 5th
iterationof the simulation,the agent’ssupplyof resources
fallsbelowthe slacklowerboundthreshold. The agentthenknowstostart purchasingresources. At
the 45th
iteration,all contractshave been purchasedanddischargedbythe agentandthus itcannot buy
anymore to replenishitssupply. The markethasbeenpopulatedwith100contracts for 100 resources
percontract bythe producer.
The followingtable isusedtoillustrate the eventsthattake place periteration.
Iteration Consumption Resource units
(Pre-Consumption)
Contracts Contracts Discharged
4 250 4000 0 0
5 250 4050 3 3
6 250 4100 2 2
7 250 4050 3 3
Table 4
At the start of iteration4,agent1 possesses4000 resource units. Thisamountisequal tothe slack
threshold. The consumptionfunctionthendeducts250 unitsfromthissupply.
At iteration5,the agentseesthat itpossessesadeficitof 250 resource unitsinitssupply has3750
resource unitsinitssupply. Itthenpurchases3 contracts for a total of 300 resource unitsand
dischargesall of these resource unitstorecoverthe deficitinitssupply. The agentnow has a supplyof
4050 resource units. Atthe endof the iteration,250 unitsare deductedfromitssupplydue to
consumption. Initeration6,onlytworesource contractsare requiredtoreplenishthe deficit.
3.1.2.2 ConstantConsumptionwith 2 agents
The secondsimulationwasperformedwith2agentsand itseffectswere observedandrecorded. The
parametersforthe simulationare describedinthe table below. The purpose of thissimulationisto
demonstrate thatbasicinteractionbetweenmultiplemarketparticipantsfunctions. Inthisparticular
scenario,the expectedbehaviouristhatthe total pool of resource contracts shouldbe depletedata
fasterrate thanin the firstsimulationwithone agent.
Simulation 2 Parameters
Numberof Agents 2
Total Iterations(simulationperiod) 200
Initial Resources 5000 resource units
Initial ContractResources 0
Initial AgentFunds 10000
ConsumptionFunction 250 units/iteration
SlackLowerBound 4000 resource units
Apart fromhaving2 agents,the simulationparametersare identical tothe experimentwith1agent.
Figure 4
The behaviourexhibitedbyagent1 issimilartothe firstsimulation.
Figure 5
Both agentsconsume resources atthe same rate,thus the total supplyof resourcesinthe marketis
depletedfaster. Bothagentsexhaustthe supplyof 100 contracts byiteration25. In the previous
simulationconsistingof one agent,the marketwasexhaustedof resource contractsbyiteration46. This
Contract Cost 100 funds
Resourcesassignedpercontract 100 resource units
simulationscenariodemonstratesbasicmarketinteractionfunctionswithinthe simulationwhere the
rate of consumptionof resource contractsincreasesasthe numberof participantsincreases.
3.1.3 ContractDischarge
Thissimulationdemonstratesthe functionalityof the expirationof aresource contract. Aspreviously
described,the contractrecordcontainsa periodof time forits validity. Atthe expirationof itsvalidity
the contract is dischargedandthe agenttakesdeliveryof the resourcesassociatedwiththe contract. In
thissimulation,the expirationtimeissetforan extremelyshortperiodinordertodemonstrate its
applicationinthe system. The agentparametersare the same as in priorsimulations exceptforthe
total contracts populatedinthe market. Insteadof 1000 contracts, the systemisreducedto500, in
orderto exaggerate scarcity.
The contracts were configuredtoexpire 10secondsfromtheirpointof creationduringthe simulation.
Thisscreenshotdemonstratesthe expirationof the contractsduringthe simulation.
Figure 6
Contract Discharge Simulation Parameters
Numberof Agents 1
Total Iterations(simulationperiod) 200
Initial Resources 5000 resource units
Initial ContractResources 0
Initial Agentfunds 10000
ConsumptionFunction 250 units/iteration
SlackLowerBound 4000 resource units
Contract Cost 100 funds
Resourcesassignedpercontract 100 resource units
Giventhe quickexpirationof the contracts,the figure belowshowsthe agentexperiencingdepletionof
resourcesbyiteration9of the simulation. Atthispointinthe simulation,the agenthaspurchased13
contracts for a total of 1300 contract resources. Atiteration9,all the remaining487 contract resources
have expiredandthe agentcannotpurchase any more to replenishitssupply.
Figure 7
The consumptionrate of the agentissetat 250 resourcesperiteration.
3.1.4 RandomConsumptionFunction
Anotherscenariothatwassimulatedwasthe case where consumptionof resourceswasrandom. The
consumptionfunctionwasprogrammedtorandomlyconsumeorconserve resources,inotherwordsit
randomlyaddedorsubtractedresourcesfromthe agent’ssupply. Thisfunctionwasusedtosimulate
resource consumptioninanunpredictable environment.
The agent parametersinthissimulationare consistentwithprevioussimulationsexceptforthe
consumptionfunction. See the table below.
Random Consumption Function Simulation Parameters – One Agent
Numberof Agents 1
Total Iterations(simulationperiod) 200
Initial Resources 5000 resource units
Initial ContractResources 0
Initial Agentfunds 10000
ConsumptionFunction Random
SlackLowerBound 4000 resource units
Contract Cost 100 funds
Resourcesassignedpercontract 100 resource units
The agent’sbuyingbehaviourisconsistentwithitsspecifiedlogic. Thatis,itmaintainsitssupplyof
resourceswithinthe lowerslacklimitof 4000 resource units,asshowninthe figure below.
Figure 8
In the figure above the randomconsumptionfunction consumedanaverage of 49.93 resource units
overthe fiscal periodof 200 iterations. The standarddeviationwas±488.51 resource units. The raw
data indicatedthatthe marketwasexhaustedof resource contractsat iteration160. The average
resource consumptionfromiteration160-200 was32.84 witha standarddeviationof ±379.49. This
informationcorrespondswiththe netincrease of resourcespastiteration160,the pointat whichthe
marketsupplyof resource contractswas exhausted. The standarddeviationisgiveninthisanalysisto
indicate the volatilityof the agent’sresource consumption.
The nextsimulationwas conductedwithtwoagentswithidentical inputparametersasprevious
simulationsexceptforareductionof initial fundsby4000, resultingin6000 fundsperagent. The
contract lifetimewassetto3 hours,well below the total durationof the simulation. Thisparameterwas
setin thisfashioninordertoobserve the resultsof agentinteractionwithouthavingcontractsexpire
before the simulationcompleted.
Random Consumption Function Simulation Parameters – One Agent
Numberof Agents 2
Total Iterations(simulationperiod) 200
Initial Resources 5000 resource units
Initial ContractResources 0
Initial Agentfunds 6000
ConsumptionFunction Random
SlackLowerBound 4000 resource units
Contract Cost 100 funds
The reductionof fundswasintendedcreate amore informative graphaswell as to increase the
possibilitythatanagentwouldrunout of funds.
Figure 9
In the figure above,agent1consumedan average of 31.95 resource unitswithastandarddeviationof
±445.43. Itis alsoobservedthatagent1 sellssurpluscontractsat iteration7and 37.
Figure 10
In the figure above agent2 consumedanaverage of 123.71 resource unitswitha standarddeviationof
±474.06 resource units.
Resourcesassignedpercontract 100 resource units
Agent2 consumedresourcesata greaterrate than agent1 usinga randomlygeneratedconsumption
function. Infact agent2 managedtoexhaustall itsfunds bythe 69th
iterationof the simulationwhile
agent1 finishedthe simulationwith1700 funds. Fromthe beginningtothe 69th
iteration, agent2’snet
consumptionwas 9651 resource unitswhereasagent 1had consumeda netamountof 1215 resource
units. The higherrate of resource consumptionbyagent2 isnot particularlyindicative of anythingother
than the randomnature of the consumptionfunction.
Resource Consumption Rates with Random Consumption Functions for two Agents
Agent 1 2
Average Resource Consumptionperiteration 31.95 123.71
Standarddeviation of Average Resource Consumptionper
iteration
445.43 474.06
Netresourcesconsumedby69th
iteration 1215 9651
Table 5
3.1.5 Varyingthelowerslacklimit
An experimentwasperformedwhere asingle randomconsumptionfunctionwas configuredforaseries
of simulationswhereasingle agenthadvaryingslacklowerlimits. The purpose of thisparticular
experimentwastodeterminewhatsortof relationshipthe slacklowerlimithadwiththe purchasing
activity. Intuitivelyitseemedobviousthatasthe nominal range of operationwasexpanded,thatthe
agentwouldperformfewertransactions.
The simulationwasperformedfor49differentlowerslackvalues,from4900 to 400. The initial
parametersof the experimentare similartoprevioussimulations. The detailsare containedinthe table
below.
The random consumptionfunctionwaspreservedbyseedingthe randomnumber generationwiththe
same value foreverysimulationrunforvaryingslacklowerlimits.
In the figure below,agraphispresenteddepictingthe resultof a simulationwithahighslacklower
limit. Thatis,the nominal range of operationisnarrow andseveral transactionsmustbe performedby
the agentto maintainitssupplyof resources. Inthe simulationbelow,the lowerslacklimitwassetat
4500 resource units. Forthe fiscal periodthe agentperformed60transactionsto maintainitsresource
supplywithinthe nominalrange of operation.
Varying Slack Simulation Parameters
Numberof Agents 1
Total Iterations(simulationperiod) 200
Initial Resources 5000 resource units
Initial ContractResources 0
Initial Agentfunds 6000
ConsumptionFunction Random
Contract Cost 100 funds
Resourcesassignedpercontract 100 resource units
Table 6
Figure 11
The simulationwasrepeatedfor49 differentslacklowerlimits. Inthe figure below,the graphshowsthe
behaviourof the agentoverthe fiscal periodfora slacklimitof 2500 resource units,orhalf of the initial
supplyof resourcesassignedtothe agent. The resultwasthe agentperformed46 transactionswhere it
boughtresource contracts.
Figure 12
In the figure below,the graphdepictsresultsof the final simulationwhere the slacklowerlimitwasset
at 400 resource units. The agentperformed9transactionswhere itboughtresource contracts.
Figure 13
The figure belowshowsagraphof the numberof resource contracts boughtbyagentsfor each
simulation,foraspecificslacklowerlimit. The graphis displayedfromthe lefttorightstartingat a slack
lowerlimitof 4900 resource unitsandendingwithaslack lowerlimitof 400 resource units.
Figure 14
The graph suggeststhatas the slacklowerlimitisdecreased,the agentperformsfewertransactions. In
termsof devisingastrategyfor an agent,thisresultconfirmsthatanagent’ssensitivitytoperforming
transactionscan be moderatedbyalteringthe slacklowerlimit. However,if the nominal range of
operationistoobroad,the agentwill behave asif ithas not beenconfiguredtooperate withinthe
boundsof any constraints.
4 Conclusion
A systemhasbeenbuilttosimulate the behaviourof agentstradingcontractsforresourcestobe
deliveredata specificpointinthe future. The agentshave beendesignedtoperformactionsthat
enable themtobuyand sell these contractsbaseduponasimple strategycalledslack. The slackdefines
a range of values of the agent’sownsupplyof resourcesasnominal foroperation. Whenthe agent’s
supplyof resourcesexceedsthe upperlimitorfallsbelow the lowerlimit,the agentwillthensellorbuy
resource contractsand discharge themto depleteorreplenishitssupply.
The abilityof agentsto successfully performtaskssuchas buying,sellinganddischargingwas
demonstratedinsimulations. Anattemptwasmade toexplore the agent’sbehaviourwithrespectto
varyinglevelsof slack. The resultssuggestedthatasthe nominal range of operationwaswidened, the
agentperformedfewertransactions.
4.1 Future Work
The simulationsystem lacksamechanismbywhichasellingagentmayadjustitssellingprice. Asthe
situationcurrentlyexists,the agentsellsresource contractsat the price that theyare bought. It may be
worthexploringthe behaviourof the marketif agentswere able tosell contractsatpricesthat reflect
the agents’needforresources.
Price by presentvalue of funds.
Speculative pricing?
5 Bibliography
[1] C. K.Woo, D. Lloyd,andA. Tishler,“Electricitymarketreformfailures:UK,Norway,Albertaand
California,”Energy Policy, vol.31,no. 11, pp.1103-1115, 2003.
[2] J. Hull, Introduction to Futuresand OptionsMarkets,New Jersey:Prentice-Hall Inc.,1995.
[3] S. N.Neftci, An Introduction to theMathematicsof FinancialDerivatives,SanDiego:Academic
Press,1996.
[4] M. Parkin,M. Powell,andK.Matthews, Economics,3rd ed.,Reading,MA:Addison-Wesley,
1997.
[5] P. McBurney."Market DesignorCAT Tournament2008," 4/19/2008;
http://www.marketbasedcontrol.com/blog/index.php?page_id=5.

Weitere ähnliche Inhalte

Andere mochten auch

Brown Edwards: The Future-Ready CPA Firm
Brown Edwards: The Future-Ready CPA FirmBrown Edwards: The Future-Ready CPA Firm
Brown Edwards: The Future-Ready CPA FirmBill Sheridan, CAE
 
Document Management - Cost Savings Solutions
Document Management -  Cost Savings SolutionsDocument Management -  Cost Savings Solutions
Document Management - Cost Savings SolutionsCavendish
 
PLAN DE ABASTECIMIENTO ALIMENTARIO REGIONAL EN L APARROQUIA ALTO BARINAS, MUN...
PLAN DE ABASTECIMIENTO ALIMENTARIO REGIONAL EN L APARROQUIA ALTO BARINAS, MUN...PLAN DE ABASTECIMIENTO ALIMENTARIO REGIONAL EN L APARROQUIA ALTO BARINAS, MUN...
PLAN DE ABASTECIMIENTO ALIMENTARIO REGIONAL EN L APARROQUIA ALTO BARINAS, MUN...Heidi Mendoza
 
kelas 7. bab 1. permainan dan olahraga bola besar
kelas 7. bab 1. permainan dan olahraga bola besarkelas 7. bab 1. permainan dan olahraga bola besar
kelas 7. bab 1. permainan dan olahraga bola besarElin Dzikrillah
 
Infeccion puerperal
Infeccion puerperalInfeccion puerperal
Infeccion puerperalPROFESOR36
 

Andere mochten auch (9)

Brown Edwards: The Future-Ready CPA Firm
Brown Edwards: The Future-Ready CPA FirmBrown Edwards: The Future-Ready CPA Firm
Brown Edwards: The Future-Ready CPA Firm
 
Educational Philosophy
Educational PhilosophyEducational Philosophy
Educational Philosophy
 
Unit 3
Unit 3Unit 3
Unit 3
 
Document Management - Cost Savings Solutions
Document Management -  Cost Savings SolutionsDocument Management -  Cost Savings Solutions
Document Management - Cost Savings Solutions
 
PLAN DE ABASTECIMIENTO ALIMENTARIO REGIONAL EN L APARROQUIA ALTO BARINAS, MUN...
PLAN DE ABASTECIMIENTO ALIMENTARIO REGIONAL EN L APARROQUIA ALTO BARINAS, MUN...PLAN DE ABASTECIMIENTO ALIMENTARIO REGIONAL EN L APARROQUIA ALTO BARINAS, MUN...
PLAN DE ABASTECIMIENTO ALIMENTARIO REGIONAL EN L APARROQUIA ALTO BARINAS, MUN...
 
kelas 7. bab 1. permainan dan olahraga bola besar
kelas 7. bab 1. permainan dan olahraga bola besarkelas 7. bab 1. permainan dan olahraga bola besar
kelas 7. bab 1. permainan dan olahraga bola besar
 
Brazil Quarterly Update Q3 2015
Brazil Quarterly Update Q3 2015Brazil Quarterly Update Q3 2015
Brazil Quarterly Update Q3 2015
 
Infeccion puerperal
Infeccion puerperalInfeccion puerperal
Infeccion puerperal
 
Metrologia clase 1 unidad
Metrologia clase 1 unidadMetrologia clase 1 unidad
Metrologia clase 1 unidad
 

Ähnlich wie Final Project Report 4 - live

High-Frequency Trading in Stock Market
High-Frequency Trading in Stock MarketHigh-Frequency Trading in Stock Market
High-Frequency Trading in Stock MarketIRJET Journal
 
MECHANISMS FOR DIGITAL TRANSFORMATION IN THE EDUCATION AND HEALTHCARE SECTORS...
MECHANISMS FOR DIGITAL TRANSFORMATION IN THE EDUCATION AND HEALTHCARE SECTORS...MECHANISMS FOR DIGITAL TRANSFORMATION IN THE EDUCATION AND HEALTHCARE SECTORS...
MECHANISMS FOR DIGITAL TRANSFORMATION IN THE EDUCATION AND HEALTHCARE SECTORS...IJNSA Journal
 
Algorithms and-colllusion-competition-policy-in-the-digital-age
Algorithms and-colllusion-competition-policy-in-the-digital-ageAlgorithms and-colllusion-competition-policy-in-the-digital-age
Algorithms and-colllusion-competition-policy-in-the-digital-ageGiuliano Tavaroli
 
Open Banking : The Rise of the Cloud Platform
Open Banking : The Rise of the Cloud PlatformOpen Banking : The Rise of the Cloud Platform
Open Banking : The Rise of the Cloud PlatformGary Farrow
 
An API Model for Open Banking Eco-Systems
An API Model for Open Banking Eco-SystemsAn API Model for Open Banking Eco-Systems
An API Model for Open Banking Eco-SystemsGary Farrow
 
Analytics, business cycles and disruptions
Analytics, business cycles and disruptionsAnalytics, business cycles and disruptions
Analytics, business cycles and disruptionsMark Albala
 
An Adaptive Network-Based Approach for Advanced Forecasting of Cryptocurrency...
An Adaptive Network-Based Approach for Advanced Forecasting of Cryptocurrency...An Adaptive Network-Based Approach for Advanced Forecasting of Cryptocurrency...
An Adaptive Network-Based Approach for Advanced Forecasting of Cryptocurrency...AIRCC Publishing Corporation
 
Lindy do telecommunications_revenueassurance
Lindy do telecommunications_revenueassuranceLindy do telecommunications_revenueassurance
Lindy do telecommunications_revenueassuranceSilas Musakali
 
IRJET - An Auction Mechanism for Product Verification using Cloud
IRJET - An Auction Mechanism for Product Verification using CloudIRJET - An Auction Mechanism for Product Verification using Cloud
IRJET - An Auction Mechanism for Product Verification using CloudIRJET Journal
 
STOCK MARKET PREDICTION AND ANALYSIS USING MACHINE LEARNING ALGORITHMS
STOCK MARKET PREDICTION AND ANALYSIS USING MACHINE LEARNING ALGORITHMSSTOCK MARKET PREDICTION AND ANALYSIS USING MACHINE LEARNING ALGORITHMS
STOCK MARKET PREDICTION AND ANALYSIS USING MACHINE LEARNING ALGORITHMSIRJET Journal
 
Data mining seminar report
Data mining seminar reportData mining seminar report
Data mining seminar reportmayurik19
 
Strategic Future Orcl Vs Sap
Strategic Future Orcl Vs SapStrategic Future Orcl Vs Sap
Strategic Future Orcl Vs Sapvia fCh
 
EC Mid Term Report Expert Group E Invoicing Jan09
EC Mid Term Report Expert Group E Invoicing Jan09EC Mid Term Report Expert Group E Invoicing Jan09
EC Mid Term Report Expert Group E Invoicing Jan09Friso de Jong
 
Elements and enablers: how to develop an operator IoT ecosystem
Elements and enablers: how to develop an operator IoT ecosystemElements and enablers: how to develop an operator IoT ecosystem
Elements and enablers: how to develop an operator IoT ecosystemomarvl
 
Mid Term Report of the European Commission Expert Group on e-Invoicing
Mid Term Report of the European Commission Expert Group on e-InvoicingMid Term Report of the European Commission Expert Group on e-Invoicing
Mid Term Report of the European Commission Expert Group on e-InvoicingFriso de Jong
 
The Next Step For Aritificial Intelligence in Financial Services
The Next Step For Aritificial Intelligence in Financial ServicesThe Next Step For Aritificial Intelligence in Financial Services
The Next Step For Aritificial Intelligence in Financial ServicesAccenture Insurance
 
ANOMALY DETECTION AND ATTRIBUTION USING AUTO FORECAST AND DIRECTED GRAPHS
ANOMALY DETECTION AND ATTRIBUTION USING AUTO FORECAST AND DIRECTED GRAPHSANOMALY DETECTION AND ATTRIBUTION USING AUTO FORECAST AND DIRECTED GRAPHS
ANOMALY DETECTION AND ATTRIBUTION USING AUTO FORECAST AND DIRECTED GRAPHSIJDKP
 
IRJET - Fraud Detection in Credit Card using Machine Learning Techniques
IRJET -  	  Fraud Detection in Credit Card using Machine Learning TechniquesIRJET -  	  Fraud Detection in Credit Card using Machine Learning Techniques
IRJET - Fraud Detection in Credit Card using Machine Learning TechniquesIRJET Journal
 

Ähnlich wie Final Project Report 4 - live (20)

High-Frequency Trading in Stock Market
High-Frequency Trading in Stock MarketHigh-Frequency Trading in Stock Market
High-Frequency Trading in Stock Market
 
Corda: An Introduction
Corda: An IntroductionCorda: An Introduction
Corda: An Introduction
 
MECHANISMS FOR DIGITAL TRANSFORMATION IN THE EDUCATION AND HEALTHCARE SECTORS...
MECHANISMS FOR DIGITAL TRANSFORMATION IN THE EDUCATION AND HEALTHCARE SECTORS...MECHANISMS FOR DIGITAL TRANSFORMATION IN THE EDUCATION AND HEALTHCARE SECTORS...
MECHANISMS FOR DIGITAL TRANSFORMATION IN THE EDUCATION AND HEALTHCARE SECTORS...
 
FYP
FYPFYP
FYP
 
Algorithms and-colllusion-competition-policy-in-the-digital-age
Algorithms and-colllusion-competition-policy-in-the-digital-ageAlgorithms and-colllusion-competition-policy-in-the-digital-age
Algorithms and-colllusion-competition-policy-in-the-digital-age
 
Open Banking : The Rise of the Cloud Platform
Open Banking : The Rise of the Cloud PlatformOpen Banking : The Rise of the Cloud Platform
Open Banking : The Rise of the Cloud Platform
 
An API Model for Open Banking Eco-Systems
An API Model for Open Banking Eco-SystemsAn API Model for Open Banking Eco-Systems
An API Model for Open Banking Eco-Systems
 
Analytics, business cycles and disruptions
Analytics, business cycles and disruptionsAnalytics, business cycles and disruptions
Analytics, business cycles and disruptions
 
An Adaptive Network-Based Approach for Advanced Forecasting of Cryptocurrency...
An Adaptive Network-Based Approach for Advanced Forecasting of Cryptocurrency...An Adaptive Network-Based Approach for Advanced Forecasting of Cryptocurrency...
An Adaptive Network-Based Approach for Advanced Forecasting of Cryptocurrency...
 
Lindy do telecommunications_revenueassurance
Lindy do telecommunications_revenueassuranceLindy do telecommunications_revenueassurance
Lindy do telecommunications_revenueassurance
 
IRJET - An Auction Mechanism for Product Verification using Cloud
IRJET - An Auction Mechanism for Product Verification using CloudIRJET - An Auction Mechanism for Product Verification using Cloud
IRJET - An Auction Mechanism for Product Verification using Cloud
 
STOCK MARKET PREDICTION AND ANALYSIS USING MACHINE LEARNING ALGORITHMS
STOCK MARKET PREDICTION AND ANALYSIS USING MACHINE LEARNING ALGORITHMSSTOCK MARKET PREDICTION AND ANALYSIS USING MACHINE LEARNING ALGORITHMS
STOCK MARKET PREDICTION AND ANALYSIS USING MACHINE LEARNING ALGORITHMS
 
Data mining seminar report
Data mining seminar reportData mining seminar report
Data mining seminar report
 
Strategic Future Orcl Vs Sap
Strategic Future Orcl Vs SapStrategic Future Orcl Vs Sap
Strategic Future Orcl Vs Sap
 
EC Mid Term Report Expert Group E Invoicing Jan09
EC Mid Term Report Expert Group E Invoicing Jan09EC Mid Term Report Expert Group E Invoicing Jan09
EC Mid Term Report Expert Group E Invoicing Jan09
 
Elements and enablers: how to develop an operator IoT ecosystem
Elements and enablers: how to develop an operator IoT ecosystemElements and enablers: how to develop an operator IoT ecosystem
Elements and enablers: how to develop an operator IoT ecosystem
 
Mid Term Report of the European Commission Expert Group on e-Invoicing
Mid Term Report of the European Commission Expert Group on e-InvoicingMid Term Report of the European Commission Expert Group on e-Invoicing
Mid Term Report of the European Commission Expert Group on e-Invoicing
 
The Next Step For Aritificial Intelligence in Financial Services
The Next Step For Aritificial Intelligence in Financial ServicesThe Next Step For Aritificial Intelligence in Financial Services
The Next Step For Aritificial Intelligence in Financial Services
 
ANOMALY DETECTION AND ATTRIBUTION USING AUTO FORECAST AND DIRECTED GRAPHS
ANOMALY DETECTION AND ATTRIBUTION USING AUTO FORECAST AND DIRECTED GRAPHSANOMALY DETECTION AND ATTRIBUTION USING AUTO FORECAST AND DIRECTED GRAPHS
ANOMALY DETECTION AND ATTRIBUTION USING AUTO FORECAST AND DIRECTED GRAPHS
 
IRJET - Fraud Detection in Credit Card using Machine Learning Techniques
IRJET -  	  Fraud Detection in Credit Card using Machine Learning TechniquesIRJET -  	  Fraud Detection in Credit Card using Machine Learning Techniques
IRJET - Fraud Detection in Credit Card using Machine Learning Techniques
 

Final Project Report 4 - live

  • 1. Resource Allocation in an Artificial Electronic Market Final Report Matthew Mun-Yui Yee 5/9/2008 The allocationof resourcesina large organisationcanbe an inefficientexercise constrainedbypoor sourcesof informationandassortedhuman factors. Marketsand financial instrumentssuchas derivativesexhibitdesirablepropertiesinconveyinginformationtomarketparticipantsaswell as mitigatingrisk. Anautomatedsystemforsimulatingthe trade andconsumptionof futuresresource contracts betweensoftware agentsispresentedandimplemented. The performance of different transactionsisshowand a relationshipbetweenatradingconstraintandtrading activityare presented as results.
  • 2. Contents 1 Introduction................................................................................................................................4 1.1 What advantage does a Market based solution hold over a centrally planned solution?....Error! Bookmark not defined. 1.1.1 The Producer................................................................................................................5 1.1.2 The Consumer..............................................................................................................5 1.1.3 What are the problemsassociatedwithcentrallybasedresource allocationinalarge organisation?..................................................................................Error! Bookmark not defined. 1.2 A Market-Based Solution: TAC market Design Competition ....................................................7 2 Simulation System Design............................................................................................................8 2.1 Workflow............................................................................................................................9 2.2 Agent Roles.........................................................................................................................9 2.2.1 Producer......................................................................................................................9 2.2.2 Buyer...........................................................................................................................9 2.2.3 Seller.........................................................................................................................10 2.3 The Contract......................................................................................................................10 2.3.1 Contract States...........................................................................................................10 2.3.2 Agent Contract Operations..........................................................................................10 2.4 Funds................................................................................................................................11 2.5 Resources..........................................................................................................................11 2.6 Decision Processing............................................................................................................11 2.6.1 The Definition of Slack ................................................................................................11 2.6.2 Decision Cycle ............................................................................................................12 2.6.3 Execution...................................................................................................................13 2.7 Implementation.................................................................................................................14 2.7.1 Agent roles.................................................................................................................15 2.7.2 Database handling......................................................................................................15 2.7.3 Agents implementation...............................................................................................15 2.7.4 Contract Implementation............................................................................................15 2.7.5 Contract States...........................................................................................................17 2.7.6 Agent Operations .......................................................................................................18 2.7.7 Agent Resources Implementation................................................................................19
  • 3. 2.7.8 Funds Implementation................................................................................................19 2.8 Slack Implementation ........................................................................................................19 3 Simulation Results.....................................................................................................................19 3.1.1 Simulations................................................................................................................19 3.1.2 Constant Consumption ...............................................................................................20 3.1.3 Contract Discharge .....................................................................................................23 3.1.4 Random Consumption Function...................................................................................24 3.1.5 Varying the lower slack limit........................................................................................27 4 Conclusion................................................................................................................................30 5 Bibliography..............................................................................................................................31
  • 4. 1 Introduction The allocationof resourcesina large organisationisacomplicatedtaskfraughtwithinefficiency. For example,computingresourcessuchasdiskstorage are costly1 andrequire specialistknowledge. Planningforcapacityisoftenimperfectandsubjecttoperiodsof laginprocurementanddeployment. A solutionmaybe found inmitigatingthe riskof makingpoordecisionsbyusingfinancial instrumentssuch as futurescontracts. The value of futurescontracts lie intheirabilitytohelptheir buyersmake longtermdecisionstohedge againstfluctuatingpricesof resources. Futurescontractscanbe especiallyvaluable inthe acquisitionof resourceswithpricesthatfluctuate inlarge values. Buyersandsellersof thistype of derivative create a marketwhere riskcan be offsetforfinancial consideration. For example,anairlineknowshowmuchfuel itwill needtobuyinsix monthsand alsoknowshowmuch moneyitcan spend. The airline knowsthatthe price of fuel isextremelyvariable andisnearly impossible topredictwithinareasonablemarginatthe conclusionof six months. If the presentprice of fuel is$5/L the airline mayhedge againstthe riskdearerfuel costsbypurchasing acontract to buy fuel insix monthsat a cost of $5.10/L. Atthe conclusionof six monthsthe airlinewillhave saveditself considerable moneyif the costof fuel hasrisentosome amountgreaterthan $5.10/L. Thisprojectinvestigatesthe constructionandapplicationof amarket,similartoa commodities trading exchange toan organisationthatmayconsistof several organisationalunits. The implementationof a marketfor futurescontractswithinalarge organisationisexploredinthisprojectbybuildingasoftware systemtosimulate theirtrade betweensoftware agents thatrepresentorganisational units. Simple strategiesare appliedtothese agentstobuyandsell contracts,basedupontheirownsupplyof resources andthe supplyof resourcesinthe artificiallycreatedmarket. The rest of thissectiondiscussessome backgroundbehindthe principlesincreatingamarketbased solutionaswell asthe TAC competition. Itisconcludedwithadescriptionof some goalsforthe system to achieve these principles. The restof the reportisorganisedintoa descriptionof the system’sdesign whichaspirestogive the readermore detail intohow the simulationsystemwill operate,followedbya descriptionof the implementationandthe experimentsthatwere conductedonthe finishedproduct and the resultsthatwere obtained. 1.1 Elements of a market and how they map to a large organisation A marketbasedsolutionprovidesaframeworkinwhichorganisational unitscancoordinate their resource consumptiondecisions[4]. Assuch,itis requiredthatanalogiesof marketcomponentsbe definedwithrespecttoanorganisation. These includethe ProducerandConsumerof aresource as well as the rulesof trade and the productsto be traded.In thissection,we define the basiccomponentsof the market-basedsolutionbymappingcomponentsof amarketto the componentsof anorganisation. 1 Whilethe actual costper megabyte of off-the-shelf hard drives are decreasing,the costdoes not take into accountenterprise storage resources that includetape backup,diskless backup,archival systems and media, backup software licensed by capacity and SAN infrastructure.
  • 5. In a large organisationwhere the allocationof resourcesiscentrallyplanned,inefficiencymaymanifest itself informssuchas over-allocationorunder-allocation. Bothof these inefficienciesare detrimental to an organisationbecause theyresultinbudgetdeficitandsurplus. The consequencesof adeficitare obvioushoweverabudgetsurpluscanbe an indicationof incorrectallocationresources,burdeningone organisational unitwithtoomanyresourceswhile starvinganother. Inordertoincrease efficiency in the consumptionof resources,amarket-basedsolutionmaybe usedasan alternative. 1.1.1 TheProducer The Producerin thissyntheticmarketmaybe specifiedasthe Plannerof anIT department. Itisthe goal of the IT Plannertoallocate storage resourcestovariousorganisationalunits. Itcan be saidthat the IT Planner“produces”storage resources. The basic economicattributesof the Producerare as follows 1. Overa givenbudgetperiod,the Producerisonlyallowedto‘produce’afinite amountof storage resources. 2. The cost of the storage resourcesconsistsof the procurementcostandthe costof labourto install it. 1.1.2 TheConsumer The Consumermaybe specifiedasthe individual organisational unitsthatoperate underthe highest authoritywithinthe organisation. The basic economicattributesof the Consumerare asfollows 1. Overa givenbudgetperiod,the organisationalunitconsumesstorage resources,orthe product. 2. Thisproduct isexchangedfromthe Producerpreviouslydefined. The productisthe storage resource. 3. The product isexchangedfromthe Producerfora cost. 1.1.3 TheConsumerandProducerappliedto anexampleorganisationandtheproblems associatedwithcentralisedresourceallocation In a large organisation,itisadvantageoustoexploiteconomiesof scale inprocuringresourcesthrougha single pointof contact. In turn thissingle pointof contactprovisionsresourcestoorganisational units that require them. Ina large organisationsuchasa universityoracitygovernment,budgetingcanbe a complicatedordeal. Inamunicipal Budgetsare allocatedannuallyandthe planningprocesscantake an entire year. A great deal of time isdedicatedtothe preparationof a budgetbythe IT Plannerof the organisation. Thissectiondiscussesthe exampleof SAN diskspace allocationatthe Cityof Vancouver and itsproblemsleadingtoinefficiency. An IT departmentcanbe expectedtoprovide centralisedservicestocomposite organisational units withinanorganisation. Economiesof scale figureprominentlyinselectingacentralisedenterprise model. It providesanadvantage inallowingthe smallerorganisational unitstoparticipate inan infrastructure thatwouldotherwise be toocostlytoimplementontheirown. Thiscouldinclude a
  • 6. virtualisedcomputinginfrastructure,storage areanetworksandcentraliseddatabackupservices, amongstothers. The SAN and associatedbackupinfrastructure atthe Cityof Vancouvertotals approximately1millionCADperannum,excludingthe costof labour. In the provisioningof these resources,organisationalunitsmustprovidethe ITdepartmentwith informationthatwill assistinplanning. Basedonthe available information,the ITPlannerwill attempt to determine the fundingrequiredforabudgetyearbutit can be verydifficultfororganisational units to communicate the rightinformation,suchascurrent andfuture utilisationof resourcestothe IT department. Poorcommunicationof informationwillresultininsufficientplanning,costoverrunsand delaysinworkschedules. In the case of informationgatheredoncurrentresource utilisation,itisoftendifficulttodraw any conclusionsonfuture ratesof resource utilization,especiallyinanorganisationthatisgrowingrapidlyin termsof projectsandhumanresources. Anexercise intrendanalysiswillyieldlittle meaningful information. Thisisbecause the growthof dataoftenballoonsinthe implementationof new projectsor newinitiatives. Forexample,anewprojectmayrequire adatabase componentandinorderfora developertotestnewcode,a copyof a productiondatabase maybe acquired. The consequenttest database mayrequire modificationbefore runningthe new code. The new developmentdatabase may be duplicatedforotherdeveloperstoruntheirowntestsand may alsobe backedup to disk. In this example, itisclearthata single database of several hundredmegabytescouldmultiplythe diskstorage requiredfordevelopmenttasksbyordersof magnitude. Withrespectto informationpertainingtofuture projects,knowledge gapsoftenexistthatcannotbe easilyeliminated. Thiscontributestodifficultyinplanningaccurately. Ina large organisation, organisational unitsare dividedbytheirspecialistknowledge andskills,suchasthe legal oraccounting departments2 . Anorganisational unitusuallydoesnotpossessthe specialistknowledgerequiredto understandwhatinformationmustbe giventothe ITdepartmenttoplanaccurately. Anaccounting departmentmayunderstandwhatinformationitwishesanenterpriseresource provisionapplicationto report. Unfortunatelythe ITPlannermaynot know thata single reportmayrequire duplicationto100 differentmanagersresultinginincreasedstorage utilisation. Inthisexample the knowledgegapcould have beeneliminatedbythe IT Planneraskingthe rightquestions. The accountantmaynot realize that non-accountantswouldnotbe privytotheirinformation. There alsoexistsariskfor the IT Plannerthatthe organisational unitmanagermaynotbe forthright aboutresource requirementsandinflate oroverestimate estimatesforagivenbudgetyear. A reason for disseminationof false informationatthe Cityof Vancouverarose frompoor relationshipsbetween managersstemmingfrompastdisputes. Suchdisharmonyisverydifficulttoovercome asmotivations are personal innature anddismissal israrelyeverused,evenforthe mostegregioustransgressions. In a municipal environmentsuchasthe Cityof Vancouver(COV),deficienciesinplanningcanbe overcome atthe costof time. Unforeseenrequirementsforcomputing resourcescanalwaysbe 2 I would note that a general shortcomingof an IT department is its ignoranceto what the entire organisation actually does.
  • 7. remediedaslongasthe deploymentisdelayed. Procurementproceduresandpoliciescancreate delays because bydefinitiontheyare requiredtobe transparentandare thustenderedatthe great expenseof time. For example,afterabudgetallotmenthasbeenestimatedforayear,it mustbe determinedif the resource to be replenishedrequirespublictender. Proceduresforpublictendercanrequire several monthsto complete andmightrequire the assistanceof the legal department. Respondents’proposals mustthenbe evaluatedthroughmultiple roundsbefore acontractis awarded. Market reformstrategieshave beenappliedinthe energysectorasa meansof optimisingenergy deliverycosts. Suchstrategieshave beenmade possible due toavailabilityof new technologies. See the example of the energysector[1]. The inefficienciesdiscussedinthisexample stemprimarilyfromalackof actionable informationsuchas the projectsthat will be implementedorthe exactresource usage requirementsforsuchprojects. Disk space usage can alsobe verydifficult topredictasdemonstratedinadevelopmentscenario. A good solutiontothisproblemwouldrequire informationtobe conveyedaccuratelytomanagerssothatthey can react appropriately. Aswell,itmaybe effectivetodevise asystemthatpermitsmanagerstoquickly make up forplanningshortfallsinresources,suchasa marketsystemthat allowsparticipantstotrade resource surpluseswiththose experiencingdeficits. In thisparticularproject,the managersof organisational unitswill be replacedwithagentstoperform the trade of resource contracts automaticallyoverwhatmaybe an organisation’sfiscal cycle. This removesthe humanfactorsthat contribute toinefficiencyandmayofferadvantagesinfaster,more accurate decisionmakingthroughconstantmonitoringof the resource supply. 1.2 A Market-Based Solution: TAC market Design Competition The applicationof market-basedsolutionswithrespecttosoftware agentsisnotnew. The Trading AgentCompetition(TAC) MarketDesignCompetitionisacomputerizedcompetitionconsistingof buyers,sellers(akatraders) andspecialists. The goalsof the entrants(calledspecialists)tothe Tournamentare[5]:  To designthe marketrulesforeffectivelymatchingbuyersandsellersgivenadynamicsetof traders.  To compete againstothermatchmakers(specialists) byattractingtraderstoyour ownmarket.  To maximise profitsbysettingappropriatecommissionfees. At presentaTAC tournamenthasbeenproposedforthe tradingof derivatives. Itishypothesizedthat the work completedinthisreportcouldbe adaptedforuse inanysuch future TACtournamentsince manyof the issuesencounteredinthe regularTACtournamentare similartothose intrading derivatives. Suchissuesinclude pricing,commissionandnew problemssuchasderivativecontract duration.
  • 8. 2 SimulationSystem Design In lightof the organisational problemsthatinhibitthe allocationof resourcesin anefficientmannerand the potential toolsavailable inamarketsuchas derivatives,improvedefficiencymaybe gainedthrough the creation of a systemthatfacilitatesamarketto trade surplusesof resources. Suchamarket requiresup-to-date informationaboutresourcestobe made availabletoproducersandconsumers. Withthisinformation,producersandconsumersmaybe more able toplanresource productionand consumptionmore efficiently. The firstobjective istorelayinformationtothe producersandconsumers. Withthisinformation,the producercan determine howmuchof a givenresource existssothatmore can be produced. The consumercan use the systemtodetermine the price of the remainingresource,asdeterminedbythe producer. The informationisstoredina database andorganisedintospecifiedstatessothatconsumers can producershave accessto all the contracts anddetermine whethertheycanbe bought,sold,or consumed. The secondobjective istoenable the abilityforproducersandconsumerstotrade resources. A producerwill be giventhe abilitytolistresourcesavailableforsale,alongwithaprice. A consumerwill have the abilitytobuythe resource forthe listedprice. Additionally,aconsumermaydecide tosell a surplusof resources. Each agent withinthe simulationsystemisgivenaturnto performactionsonthe marketthrough its owndecisioncycle. The entire simulationiscomposedof multipleiterationsof the decisioncycle forall the agentsparticipating inthe market. The sum total of all the iterationsthatagentsexecutetheir decisioncycle canbe takenas a fiscal periodorsome othermeasure bywhicha large organisation definesitsbudgetcycle. The overall systemarchitecture iscomposedof agentsthatqueryadatabase forthe availabilityof resource contractsfor sale. The agent representsthe consumerinthe systemthatisalsothe organisational unitwithinalarge organisation. If anyresource contracts are available forsale, the agent may thenbuy a quantity of these resource contractsand immediatelydischarge themtoreplenishtheir resource supply. Contractscan be boughtfrom a special produceragentthatcan be analogoustothe IT plannerasgiveninthe Cityof Vancouverexample. Aftera contract is bought,anagentmay decide thatit hasenoughresourcesbut decide tosell its resource contractsat a laterpointintime. These resource contractsmay be boughtby otheragents. The agents’ decisiontobuyor sell resource contractsisgovernedbya monitoringsystemthatissetby numerical boundsof resource values. The agentwill be configuredwithandupperboundanda lower bound. Resource valuesthatcorrespondwithvaluesbetweenthe upperandlowerbounds,orthe slack of the agentare comparedwiththe agent’sactual supply. Thissection presentsandexplainsthe functionsof the simulationsystembyfirstreviewingthe workflow of the twodifferenttypesof agents. Subsequentlyitis shownthateachagentcan assume different
  • 9. rolesthatenable themtoperformdifferentoperations. Followingwill be adescriptionof the resource contract and the decisionmakingprocessthatanagentmakesto buyand sell contracts. 2.1 Workflow The workflowforthe producerinthe systemisas follows: 1) Producersetsthe resource contract duration,price,amountof resourcesto‘sell’. 2) The Produceropensthe sale of the resourcestoConsumers. 3) The systemrecordsthe resourceslisted. 4) The systemrecordsthe salesof the resourcestoConsumers. The systemmustensure thatthe Consumershave enoughfundstopurchase the resources. For the consumer,the correspondingworkflowisbelow: 1) Consumerbuysthe resources. The inventoryof resource contracts forsale bythe produceris deducted. 2) If the Consumerdoesnotneedthe resources,theyare putbackonto the marketto be traded. 3) The consumerdischargescontractsand consumesthe resourcesasrequired. 2.2 Agent Roles In thissystem,anagentbuysand sellscontractsforresources whichallow themtoreplenishtheir supply. Inorder to differentiate whatanagentispermittedtodo,rolesare definedwhichare associatedtocertainactionsor operations whichmaybe performed. A consumer agentisallowedto performthe operationsassociatedwith the buyerandsellerroles. Inthe case of the produceragent,a privilegedrole isdefinedexclusivelyforproducingcontracts. Consumeragentscannotassume the producerrole. A produceragentassumesthe producerrole andthe seller role. 2.2.1 Producer The producerrole is a privilegedand permitsthe productionof contractswithinthe system. The agent that undertakesthisrole cannotundertake anyotherroles. The producerrole ismeantto be a specialisedrole withinthe systemandisnotintendedtoparticipate inthe market(otherthancreating the contracts). The personwithinthe large organisationwhichwishestoallocate resourcestothe organisational unitscontrolsthisagent. 2.2.2 Buyer An agentthat assumesthe buyerrole canbuycontracts. This meansthatthe agentcan modifythe contract to the boughtstate (thisisdefinedbelow). Inessence,thismeansthe contractismodifiedto reflectachange inownershipandfundsare transferredbetweentwoagents. The buyerrole contains no provisionstonegotiatethe price of a contract. A buyeragentismotivatedbya requirementto replenishorstockresourcesinordertoaccommodate theirconsumption. Onlythe consumeragentcan assume thisrole.
  • 10. 2.2.3 Seller The sellerrole enablesanagentto putthe contract intoa sell state. Thisrole alsoallowsthe agentto setthe price of the contract. By enteringacontract intoa sell state,the sellingagent iscreatingan invitation buythe contractby prospective buyingagents,alsoknownasan invitation to treat. A selleris motivatedtoliquidateitssurplusof resourcestogenerate more fundstosave for future use,sothatit can mitigate unforeseenresource consumption. Boththe consumerandproduceragentscan assume thisrole. 2.3 The Contract The contract isa record containingattributesthatspecifythe conditionsunderwhicharesource canbe tradedor used. The contract hasan expirationdate at whichtime the resourcesare to be deliveredto itsowner. The ownermaydischarge the contract before thatdate if so desired. Once the contractis discharge,the resourcesare addedtothe owner’sexistingsupplyof resources. Contracts can existin differentstatesdependingonthe operationanagentperformsonit. All attributes withinacontract are manipulated bythe agentsthroughoperationspermittedtothemthroughthe assumptionof roles. 2.3.1 ContractStates A contract may existinfourstates,creation,sale,boughtanddischarged. Eachstate signifiesthe result of an operationanagenthas performedonthe contract. These operationsare performedbasedupon the tradingstrategyadoptedbythe agent. Aswell,identifyingthe relativeproportionsof contractsin these variousstatesproducesinformationaboutthe healthof the internalmarketandthe performance of the agents. A validcontractmay be dischargedbythe ownerof the contract at any time andfor practical purposes, can be understoodasthe act of consumingorusinga resource,suchthat itcannot be tradedagain. A contract in a dischargedstate cannotbe modified. For example,acontractin a boughtstate cannot be boughtby anyagent,can be dischargedbyits ownerandcan be soldby itsowner. If the ownerof the contract ina boughtstate wantsto sell the contract, itmust enterthe contract intoa sell state. A contract enteredintoasell state canbe bought by anyagent inthe system as longas ithas not beendischarged. 2.3.2 AgentContract Operations Agentswhichassume the BuyerandSellerrolesperformspecificoperationsoncontractsinorderto enterthemintodifferentstates. These operationsmodifyvariousattributeswhichcorrespondto definedcontractstates. Operationsincludeproduce,buy,sell anddischarge. To produce meansthat contract resourcesare createdforsale to agentswithinthe market. To buya contract, the ownershipof the contractis transferredfromone agenttoanotherinexchange for financial consideration. Tosell resourcesmeanstosignal tootheragentsthatone wishestosell them. To discharge a contract meansto conclude the contract once the resource associatedtothe contract has beendelivered orusedbythe owner.
  • 11. 2.4 Funds The currency to be usedin transactionsbetweenagentsconsistsof arbitraryunitsassignedasfunds to each agent. The fundsare to be transferredbetweenagentsinconsiderationforthe exchange of contracts. 2.5 Resources Each agent maintainsitsresourcesindependentof eachother. The rate of consumptionof the resources,orthe consumptionfunctionisindependentof anyotherfactors. The consumptionfunction isa parameterbywhichmarketconditionsmaybe manipulated. Some agentswill be assignedfunctions withhigh,lowandperiodicrates. 2.6 Decision Processing An agent’sprimaryconcernisto ensure thatithas access to enoughresourcestofunction. Thiscanbe done bypurchasingmore resources(orinthe case of thisproject,contractsfor resources) orby conservingormoderatingitsconsumptionof resources. If itisdeterminedthatthe agenthas enough resourcesinitspossessiontoensure itsfunction,the agentmaydecide tosell itssurplusof resources. An agentmayalso determinethatitdoesnotneedto performbuyor sell operationsinorderto function. The agentmay come to thisconclusionif itdeterminesthatthe difference betweenits resource supplyandconsumptionare withinthe boundsof arange of valuesdefinedasslack. 2.6.1 TheDefinitionofSlack The slack boundariesare constraintstothe buyingandsellingbehaviourof the agent. The boundaries are operatinglimitsandare usedtodefine a desiredbehaviour. An agentmakesitsdecisiontobuyor sell resourcesbaseduponthe lowerandupperlimits of slack,respectively. If the agent’ssupplyof resourcesachievesavalue betweenthese two bounds,itcan be consideredtohave achievedits goal and is notrequiredtoperformanyadditional tasks. In otherwords,the supplyof resourcesis withinanominalrangeof operation. Shouldthe value of resourcesfall below the lowerslack value,itcan make a decisiontobuyadditional resource contracts. The agentis thusoperating withinadeficitrange. Converselyasurplusexists if its supplyof resourcesexceedsadefinedupper slacklimitandthe agent maydecide tosell the excessresource contracts. The agentisthen operatingina surplusrange. Upper Slack Limit Lower Slack Limit Time Surplus Range Deficit Range Nominal Range Resource Supply Illustration of Slack
  • 12. Slackboundariesare configuredtoobtainadesiredbehaviourfromanagent. Thisstrategyis configured to obtaina certaingoal whichmay or may notbe a prescriptiontocontrol consumptionorto accommodate growth. If the difference betweenthe upperandlowerslackboundariesare small,thus creatinga narrow nominal range of operation,the behaviourof the agentwill be coupledmore tightly withthe consumptionrate of resourcesforthat agent. Consideranexample where thatthe upperslacklimitis50 resource unitsandthe lowerslacklimitis40 resource units. The nominal range of operationisbetween40and 50 resource units. If the agent’s supplyof resources+ the agent’ssupplyof resource contractsisgreaterthan 50, the agentisdeemedto be operatingwitha surplus. If the agent’ssupply of resourcesislessthan40, the agent isdeemedtobe operatingwithadeficit. The figure above illustratesthese concepts. 2.6.2 DecisionCycle The simulationconsistsof several iterationswhere anagentdecideswhetherornot to buyor sell resource contracts. This decisionmakingprocessiscalledthe decisioncycle. Priortothe beginningof the decisioncycle,all marketparticipantsare assignedacertainamountof resourcesanda certain amountof funds. Whenthe simulationbegins,the resourcesare consumedandthe agentspendsits fundsto replenishitssupply. The maindecisiontobe made bythe agentin a cycle is determiningif there isa surplusor deficitof resource contracts. Thisdecisionpointhasthree possible outcomes,do nothing,buyresource contractsand sell resource contracts. At the beginningof the decisioncycle the agentfirstcheckstosee if the fiscal periodisover. The fiscal periodisa metricto describe the total iterationsof the decisioncyclesthe agentexecutes. If the agent has reachedthe endof the fiscal period,the simulationisconcluded. The agent thenmustdecide whetherornot itssupplyof resourcesiswithinthe nominalrange of operation. Inotherwords,the agent mustcheck that the supplyof resourcesitownsisgreaterthan the lowerslacklimitandlessthanthe upperslacklimit. If the agent’ssupplyof resourcesiswithinthe nominal range of operation,itdoesnothingandthe cycle isconcluded. If the agent’ssupplyof resourcesexceeds the upperslacklimit,itcansell itssupplyof resource contracts if it hasany in itspossession. If the agent’ssupplyof resourcesislessthanthe lowerslack limit,itmustthendetermineif ithasenoughresource contractsinits possessionthat itcan discharge to replenishitssupplytomeetthe nominal range of operation. If ithas enoughresource contracts,itwill simplydischarge asmanyas itneeds. If it doesnothave enough,itmustthenbuy as manyresource contracts as it can affordanddischarge themaccordinglytoincrease itssupply. As mentionedinthe precedingsection,slackboundariesare configuredinordertoobtainadesired behaviourfromthe agent. A narrow nominal range of operationwouldcause the agenttorespond sharplyto fluctuationsinitsresource consumption. A widernominal range wouldcause the agentto respondlessactively.
  • 13. Is the supply of resources within nominal range of operation? Do nothing. Is the fiscal period over? No Yes Start Simulation End Simulation Is there a supply or a deficit? No Surplus Sell surplus resource contracts if there are any. Are there enough resource contracts to discharge to return supply to nominal range of operation? Deficit Discharge resource contracts to return resource supply to nominal range of operation. Yes Buy as many resource contracts as are needed to return supply to nominal range of operation and discharge them. No Figure 1 2.6.3 Execution The decisioncyclesinthe systemare executedinmultiple iterations. The sumof these iterationsis defined periodof the simulation. The periodisanalogoustoa fiscal yearor anyother metricthat specifiesthe time limitduringwhichresourcesare allocated,tradedandconsumed. Ineachiterationof the loop,anynumberof agentsmaybe instantiatedandrun. The agentsthemselvesare statelessand the resultsof theirdecisionsare storedwithinthe database (resultsof purchasingandsellingoperations baseduponconsumptionand resource contractpopulation). Duringthe execution,the consumptionfunctiondeductsresourcesfromthe agents’ supplywhichis recordedwithinthe database. The consumptionfunctioninandof itself isunknownbythe agent. The
  • 14. agentis onlyable to querythe amountof resourcesitowns. The consumptionfunctiondeductsthis amountas required. 2.7 Implementation The simulationsystemisimplementedinJavaandmakesuse of mySQLserver5.0 as the database backend. The simulationsystemiscomposedof 3main components;the implementationof the agents, a componentthatdefinesthe variousrolesandtheiroperations(ormethods) andacomponentthat handlesthe underlyingdatabase operationswhichare usedforkeepingtrackof contracts, fundsand resources. Agentscanperformoperationsoncontractswhichenterthemintospecificstates,suchas the bought,sale anddischargedstates. Baseduponthe statesof the contracts,the agentscan determine whetherthe contractmay be bought,soldor discharged. The decisiontoexecutethese operationsisimplementedinthe decisionprocessingportionof the agentwhichreliesuponthe configurationof the slacklimits. The screenshotbelowdepictsthe outputof the executionof the simulation. Figure 2 First,the implementationof agentroles isdiscussed,followedbyanoverviewof how the interaction withthe database wasimplemented. Thenthe implementationof the agentsisreviewed,followedby the contracts. Finallythissectionconcludeswithadiscussionof the implementationof agent operationsandslack.
  • 15. 2.7.1 Agentroles Thispackage contains classesassociatedwithbuyer,sellerandproducerroles. The customerclass containsa unique IDthat isinheritedbythe buyer,sellerandproducerclasses. Each role contains methodsspecifictothe operationsof the role. For example,the buyerrole enablesthe agenttoperformoperationssuchastransferringresource contract ownershipfromthe sellertoitself. Inconsideration,the buyerthentransferswhateversum was requiredtothe sellertocompletethe transaction. 2.7.2 Databasehandling The database consistsof 3 tables;the contract,fundand ownerresources tables. The contracttable containsrecordsof contracts,the fundtable keepstrackof the amountof fundsandthe owner resources table keepstrackof the resourceseachagentindividuallyowns. The database handling package containsclassesformanipulatingthe datawithineachof these tables, includingmethodsforopeningandclosingconnectionstothe database,inserting,updatinganddeleting records. 2.7.3 Agentsimplementation The Agentspackage containsagentclassesthatperformtradingtasksbaseduponsupplyinformation and theirowndemand. The supplyinformationisobtainedfromthe database whichcontainsrecords of contracts insale states. Independentof thisinformation,the agentcanquerythe database for informationrelatedtoitsconditionof funding suchashow muchit can spendon the market. Finally, the agentcan alsodiscoveritsownconsumptionrate andthusforma decisionastowhetherornot it will needtosell orbuycontracts forresources. 2.7.4 ContractImplementation Each contract mustbe unique. Thiswill be usedtodifferentiate contractsfromeachotherinorderfor differentoperationstobe performed. Contracts forsale will be identifiedbyanattribute thatcan be setby sellingagents. A true value would signifythe contractisfor sale while afalse wouldsignifyitisnot. Afterthe contracthas been purchased,thisattribute issettofalse. The ownershipattribute containsanintegervalue thatbelongstoaspecificagenttosignifythatitis ownedbysaidagent. Whena contract is purchasedby an agent,the ownershipismodifiedaccordingly. As mentionedabove,the contractsare limitedintheireffectandexpire atthe endof theirduration. The durationattribute isan integermeasuringthe time thatthe contract isvalid. Everycycle that the simulationisrun,thisattribute is checkedforvalidity. Atwhichpointthe contract has expired,the resourcesare deliveredandthe contractis discharged. The resourcesattribute contains the value of the resourcesassociatedwitha specificcontract. Forthe purposesof thissystem,the resourcesare understoodtobe controlledbythe producerinquantityand initial price.
  • 16. The price attribute containsthe value of the cost of price of the contract. The value associatedwiththis attribute can be arbitrarilyassignedaslongasthat value isunderstoodtohave the same meaningbyall otheragentswithinthe system. The commencedate records the systemtime atwhichthe contract wascreatedfor the comparisonwith the systemtime andthe duration. These valuesare usedtodetermine whetheracontract has expired. Attribute Description contractID A unique identifierfora contract. Thisattribute issetat the creationof the contract and isnevermodified. Thisattribute isusedtodistinguishcontractsindividually. saleStatus Thisflagis setto false whenthe contractis notfor sale. Inorder to signifythe owner'sdesire tosell it,the contract'ssaleStatusissetto true. An ownerof a contract can choose to holdontoa contract by leavingthe flagsettofalse forits duration,at the endof whichit expiresandthe resourcesare delivered. ownership An ownerisidentifiedbyanID number. The ownershipattribute containsthisID number. ThisID isset inthe contract whenthe ownershipistransferredtoanother marketparticipant. delivery Thisflagis setto false tosignifythatthe contract has not been delivered(inother words,the resourceshave notbeendeployed),thuscan be traded. The flagisset to true to signifythe contracthas been delivered. Once the contracthas been delivered,the flagcannotbe reverted. duration The durationattribute containsthe time fromthe commencedate (see below) of the contract that it will expire. Once the contractexpires,the resourcesare delivered(thusautomaticallydeployingthe resources). resources Thisattribute containsthe numberof resourcesassociatedwiththe contract. price The price of the contract. commencedate The date fromwhichthe contract is created. Table 1
  • 17. 2.7.5 ContractStates Contracts mayexistinthe following8states:Creation,Sale,Bought,DischargedandProduce. These statesallowthe agentstodetermine whatoperationstheymayperformona contract at any givenpoint intime duringthe fiscal period. Contract attribute per correspondingcontract state Contract State contractID saleStatus ownership delivery duration resources price commencedate Sale <string> true <seller> false <int> <int> <int> <long> Bought <string> false <buyer> false <int> <int> <int> <long> Discharged <string> true <seller> true <int> <int> <int> <long> Creation <string> true <producer> false <int> <int> <int> <long> Table 2 2.7.5.1 CreationState Before anycontracts are everbought,soldordischarged,theymustbe producedbya produceragent. A contract isin a creationstate whenitis owned by a produceragent,its saleStatusflag is set to true and delivery is set to false. This state isan invitationtotreatto otheragentswithinthe system. The deliveryattribute mustalsobe settofalse. A contract is onlyenteredintothisstate upon itsinception. Knowinghowmanycontractsexistinthe creationstate at the end of the simulation tellsone if too manycontracts were producedandcan be construedaswaste. The table above displaysthe value of the attributesof the contractinthe Creationstate. The contractID, ownership,duration,resources,price andcommencedate attributesare settowhateverthe parametersof the environmentmaybe at the time or whateverthe operatorhasinitiallydefined. Anyone withaccesstoquerythe database can determine whichcontractsare ina creationstate simply by searchingforall contracts owned bythe producerwithdeliverysetto false andhave saleStatussetto true. 2.7.5.2 Sale State A contract ina sale state hasits saleStatusflagsettotrue and isownedbyany agentotherthan the producer. A contract ina sale state muststill be validinthatthe current systemtime islessthanthe commencedate plusthe duration. Itmustalsohave deliverysettofalse,denotingthatthe resources have not beendeliveredandthe contracthas not beendischarged. Thisstate isan invitation to treat to otheragentswithinthe systemexceptthe produceragent. Shouldthe agentwishtoreverse itsdecisiontosell the contract,itcan be revertedtoitsboughtstate. As one can see inthe contract attribute table above,the saleStatusissettotrue anddeliveryissetto false. If itis required,the agentisfree todischarge acontract in a Sale state shouldthe agent’ssupply of resourcesbe indeficittothe lowerslacklimit.
  • 18. 2.7.5.3 Bought State Contracts whichhave beenpurchasedbyagentswiththe buyer role take ownershipof the contractina boughtstate. This dictatesthatthe contract’s saleStatusflagissettofalse. Aswiththe aforementioned Sale state,a contract in boughtstate mustbe valid. The agent isfree to revertthe contract to a sale state if it isso desired. Whenacontract is ina bought state,itmay be dischargedandthe resourcesare addedtothe agent’sstandingsupply. 2.7.5.4 Discharged State A dischargedcontractisnot validandcannot be boughtor sold. A contract becomesdischargedeither because anagent hasdecidedtouse the resourcesassociatedwithitorthe contract haspassedits durationandexpired. Inbothcases,the resourcesare deliveredandthe deliveryattributeissettotrue. The value of the saleStatusflagneednotbe modifiednoranyotherattribute sothata recordexistsof the state of the contract whenit wasdischarged. As showninthe table above,the deliveryattributeissettotrue. 2.7.6 AgentOperations Agentsmustmodifythe followingcontractattributeswhenperformingthe specifiedoperationsinthe table below. Contract record attributes modified for each correspondingoperation Operation contractID saleStatus ownership delivery duration resources price commencedate Produce yes yes yes yes yes yes yes yes Buy no yes yes no no no no no Sell no yes no no no no yes no Discharge no no no yes no no no no Table 3 2.7.6.1 Produce The market ispopulatedwithgoodstotrade throughthe productionof futurescontractsby a privileged agentthat ispermittedtoassume the producerrole. Thisoperationcreatesarecordof a contract with attributessetinaccordance withthe creationstate withotherattributeschosenasmarketdefaults. All attributescanbe configuredduringthe produce operation exceptforthe contractIDand commencedate attributes. These are setbythe computingenvironment,suchasthe systemtime. The creationstate dictatesthat the ownershipof the contractis setto that of the productionagentand the saleStatusissetto true. The table displaysattributesthatare modifiedduringthe executionof the Produce operation. There is no initial state asthe contract doesnotpreviouslyexist. 2.7.6.2 Buy An agentassumingthe buyerrole mayperformabuy operation ona contract that isin a sale state. The saleStatusandownershipattributesmustbe changedaccordinglyif the operationissuccessfully executed.
  • 19. 2.7.6.3 Sell The sell operationobligesthe agenttomodifythe saleStatustoa true value. Itis optional forthe agent to setthe price attribute of the contract. 2.7.6.4 Discharge The operationof dischargingacontract requiresthatthe deliveryattributeis tobe setto true. A dischargedcontractis storedwithinthe database withitslastknownstate. Whena contract has been discharged,the resourceshave beendelivered(orconsideredused) andcannotbe re-tradedonthe market. 2.7.7 AgentResourcesImplementation The value of fundsperagent ismaintainedwithinatable ina database. There are onlytwo columns withinthistable. The firstcontainingthe agent’sownershipIDandthe secondcontainingthe associated resourcesbelongingtothe agent. 2.7.8 FundsImplementation The fundsbelongingtoeachagentare recordedina database ina table consistingof two columns. The firstcolumncontainsthe agent’sownershipIDandthe secondcontainsthe fundsassociatedwiththe agent. 2.8 Slack Implementation The slack limitsare generated arbitrarily. Foreach iterationitsimplycomparesitsresource supplywith the static slacklimits. Uponthe comparisonthe agentcan eitherbuyor sell resource contracts. An attemptwasmade to devise adynamicmethodof generatingslackvaluesbaseduponthe average resource consumptionhoweverthisyieldedunsatisfactoryresults. 3 SimulationResults In orderto demonstrate thatthe simulationoperatesasdesigned,the systemwastestedunderseveral scenarios. The resultswere output,graphedandanalysed. 3.1.1 Simulations The simulationswere performedunderdifferentscenarios includingthe following: 1. ConstantConsumptionwith1agent. 2. ConstantConsumptionwith2agents. 3. Contract Discharge 4. RandomConsumptionwith1agent. 5. RandomConsumptionwith2agents. 6. Varyingthe lowerslacklimit. Experiment1,2, 3, 4 and 5 were performedtodemonstrate thatthe agentswithinthe simulation systemperformedasspecified. Experiment6was performedtodetermine whatrelationshipthe slack lowerlimithadwiththe performance of the agent. Itwashypothesizedthatthe largerthe nominal
  • 20. range of operationbecame,the fewertransactionsthe agentwouldperform. The resultsseemto supportthishypothesis. 3.1.2 ConstantConsumption The firstbatch of resultsinvolvedtestingagentbehaviourwhere consumptionof resourceswasata constantrate. 3.1.2.1 ConstantConsumptionwith 1 agent The firstresultisreflectsthe behaviourof 1 agentwitha constantconsumptionfunction. This simulationisintendedtodemonstrate the basicabilityof the agenttodeal withsimple resource consumptionbypurchasingresource contractsasrequired. The simulationwasrunfor a total of 200 iterations. Asshownbythe graph depictingthe agentsupply of resourcesversusthe iterationof the simulation,the marketsupplyof resource contractswas exhaustedbefore the simulationcompleteditsfull time period. Figure 3 Simulation 1 Parameters Numberof Agents 1 Total Iterations(simulationperiod) 200 Initial Resources 5000 resource units Initial Resource Contracts 0 Initial AgentFunds 10000 ConsumptionFunction 250 units/iteration SlackLowerBound 4000 resource units Contract Cost 100 funds Resourcesassignedpercontract 100 resource units
  • 21. The simulationbeginswith5000 unitsof resourcesinpossessionof the agent. The consumptionrate for thissimulationisfixedat250 unitsof resourcesperiteration. The lowerboundof the slackthreshol dis setfor 4000 unitsof resources. Atthe 5th iterationof the simulation,the agent’ssupplyof resources fallsbelowthe slacklowerboundthreshold. The agentthenknowstostart purchasingresources. At the 45th iteration,all contractshave been purchasedanddischargedbythe agentandthus itcannot buy anymore to replenishitssupply. The markethasbeenpopulatedwith100contracts for 100 resources percontract bythe producer. The followingtable isusedtoillustrate the eventsthattake place periteration. Iteration Consumption Resource units (Pre-Consumption) Contracts Contracts Discharged 4 250 4000 0 0 5 250 4050 3 3 6 250 4100 2 2 7 250 4050 3 3 Table 4 At the start of iteration4,agent1 possesses4000 resource units. Thisamountisequal tothe slack threshold. The consumptionfunctionthendeducts250 unitsfromthissupply. At iteration5,the agentseesthat itpossessesadeficitof 250 resource unitsinitssupply has3750 resource unitsinitssupply. Itthenpurchases3 contracts for a total of 300 resource unitsand dischargesall of these resource unitstorecoverthe deficitinitssupply. The agentnow has a supplyof 4050 resource units. Atthe endof the iteration,250 unitsare deductedfromitssupplydue to consumption. Initeration6,onlytworesource contractsare requiredtoreplenishthe deficit. 3.1.2.2 ConstantConsumptionwith 2 agents The secondsimulationwasperformedwith2agentsand itseffectswere observedandrecorded. The parametersforthe simulationare describedinthe table below. The purpose of thissimulationisto demonstrate thatbasicinteractionbetweenmultiplemarketparticipantsfunctions. Inthisparticular scenario,the expectedbehaviouristhatthe total pool of resource contracts shouldbe depletedata fasterrate thanin the firstsimulationwithone agent. Simulation 2 Parameters Numberof Agents 2 Total Iterations(simulationperiod) 200 Initial Resources 5000 resource units Initial ContractResources 0 Initial AgentFunds 10000 ConsumptionFunction 250 units/iteration SlackLowerBound 4000 resource units
  • 22. Apart fromhaving2 agents,the simulationparametersare identical tothe experimentwith1agent. Figure 4 The behaviourexhibitedbyagent1 issimilartothe firstsimulation. Figure 5 Both agentsconsume resources atthe same rate,thus the total supplyof resourcesinthe marketis depletedfaster. Bothagentsexhaustthe supplyof 100 contracts byiteration25. In the previous simulationconsistingof one agent,the marketwasexhaustedof resource contractsbyiteration46. This Contract Cost 100 funds Resourcesassignedpercontract 100 resource units
  • 23. simulationscenariodemonstratesbasicmarketinteractionfunctionswithinthe simulationwhere the rate of consumptionof resource contractsincreasesasthe numberof participantsincreases. 3.1.3 ContractDischarge Thissimulationdemonstratesthe functionalityof the expirationof aresource contract. Aspreviously described,the contractrecordcontainsa periodof time forits validity. Atthe expirationof itsvalidity the contract is dischargedandthe agenttakesdeliveryof the resourcesassociatedwiththe contract. In thissimulation,the expirationtimeissetforan extremelyshortperiodinordertodemonstrate its applicationinthe system. The agentparametersare the same as in priorsimulations exceptforthe total contracts populatedinthe market. Insteadof 1000 contracts, the systemisreducedto500, in orderto exaggerate scarcity. The contracts were configuredtoexpire 10secondsfromtheirpointof creationduringthe simulation. Thisscreenshotdemonstratesthe expirationof the contractsduringthe simulation. Figure 6 Contract Discharge Simulation Parameters Numberof Agents 1 Total Iterations(simulationperiod) 200 Initial Resources 5000 resource units Initial ContractResources 0 Initial Agentfunds 10000 ConsumptionFunction 250 units/iteration SlackLowerBound 4000 resource units Contract Cost 100 funds Resourcesassignedpercontract 100 resource units
  • 24. Giventhe quickexpirationof the contracts,the figure belowshowsthe agentexperiencingdepletionof resourcesbyiteration9of the simulation. Atthispointinthe simulation,the agenthaspurchased13 contracts for a total of 1300 contract resources. Atiteration9,all the remaining487 contract resources have expiredandthe agentcannotpurchase any more to replenishitssupply. Figure 7 The consumptionrate of the agentissetat 250 resourcesperiteration. 3.1.4 RandomConsumptionFunction Anotherscenariothatwassimulatedwasthe case where consumptionof resourceswasrandom. The consumptionfunctionwasprogrammedtorandomlyconsumeorconserve resources,inotherwordsit randomlyaddedorsubtractedresourcesfromthe agent’ssupply. Thisfunctionwasusedtosimulate resource consumptioninanunpredictable environment. The agent parametersinthissimulationare consistentwithprevioussimulationsexceptforthe consumptionfunction. See the table below. Random Consumption Function Simulation Parameters – One Agent Numberof Agents 1 Total Iterations(simulationperiod) 200 Initial Resources 5000 resource units Initial ContractResources 0 Initial Agentfunds 10000 ConsumptionFunction Random SlackLowerBound 4000 resource units Contract Cost 100 funds Resourcesassignedpercontract 100 resource units
  • 25. The agent’sbuyingbehaviourisconsistentwithitsspecifiedlogic. Thatis,itmaintainsitssupplyof resourceswithinthe lowerslacklimitof 4000 resource units,asshowninthe figure below. Figure 8 In the figure above the randomconsumptionfunction consumedanaverage of 49.93 resource units overthe fiscal periodof 200 iterations. The standarddeviationwas±488.51 resource units. The raw data indicatedthatthe marketwasexhaustedof resource contractsat iteration160. The average resource consumptionfromiteration160-200 was32.84 witha standarddeviationof ±379.49. This informationcorrespondswiththe netincrease of resourcespastiteration160,the pointat whichthe marketsupplyof resource contractswas exhausted. The standarddeviationisgiveninthisanalysisto indicate the volatilityof the agent’sresource consumption. The nextsimulationwas conductedwithtwoagentswithidentical inputparametersasprevious simulationsexceptforareductionof initial fundsby4000, resultingin6000 fundsperagent. The contract lifetimewassetto3 hours,well below the total durationof the simulation. Thisparameterwas setin thisfashioninordertoobserve the resultsof agentinteractionwithouthavingcontractsexpire before the simulationcompleted. Random Consumption Function Simulation Parameters – One Agent Numberof Agents 2 Total Iterations(simulationperiod) 200 Initial Resources 5000 resource units Initial ContractResources 0 Initial Agentfunds 6000 ConsumptionFunction Random SlackLowerBound 4000 resource units Contract Cost 100 funds
  • 26. The reductionof fundswasintendedcreate amore informative graphaswell as to increase the possibilitythatanagentwouldrunout of funds. Figure 9 In the figure above,agent1consumedan average of 31.95 resource unitswithastandarddeviationof ±445.43. Itis alsoobservedthatagent1 sellssurpluscontractsat iteration7and 37. Figure 10 In the figure above agent2 consumedanaverage of 123.71 resource unitswitha standarddeviationof ±474.06 resource units. Resourcesassignedpercontract 100 resource units
  • 27. Agent2 consumedresourcesata greaterrate than agent1 usinga randomlygeneratedconsumption function. Infact agent2 managedtoexhaustall itsfunds bythe 69th iterationof the simulationwhile agent1 finishedthe simulationwith1700 funds. Fromthe beginningtothe 69th iteration, agent2’snet consumptionwas 9651 resource unitswhereasagent 1had consumeda netamountof 1215 resource units. The higherrate of resource consumptionbyagent2 isnot particularlyindicative of anythingother than the randomnature of the consumptionfunction. Resource Consumption Rates with Random Consumption Functions for two Agents Agent 1 2 Average Resource Consumptionperiteration 31.95 123.71 Standarddeviation of Average Resource Consumptionper iteration 445.43 474.06 Netresourcesconsumedby69th iteration 1215 9651 Table 5 3.1.5 Varyingthelowerslacklimit An experimentwasperformedwhere asingle randomconsumptionfunctionwas configuredforaseries of simulationswhereasingle agenthadvaryingslacklowerlimits. The purpose of thisparticular experimentwastodeterminewhatsortof relationshipthe slacklowerlimithadwiththe purchasing activity. Intuitivelyitseemedobviousthatasthe nominal range of operationwasexpanded,thatthe agentwouldperformfewertransactions. The simulationwasperformedfor49differentlowerslackvalues,from4900 to 400. The initial parametersof the experimentare similartoprevioussimulations. The detailsare containedinthe table below. The random consumptionfunctionwaspreservedbyseedingthe randomnumber generationwiththe same value foreverysimulationrunforvaryingslacklowerlimits. In the figure below,agraphispresenteddepictingthe resultof a simulationwithahighslacklower limit. Thatis,the nominal range of operationisnarrow andseveral transactionsmustbe performedby the agentto maintainitssupplyof resources. Inthe simulationbelow,the lowerslacklimitwassetat 4500 resource units. Forthe fiscal periodthe agentperformed60transactionsto maintainitsresource supplywithinthe nominalrange of operation. Varying Slack Simulation Parameters Numberof Agents 1 Total Iterations(simulationperiod) 200 Initial Resources 5000 resource units Initial ContractResources 0 Initial Agentfunds 6000 ConsumptionFunction Random Contract Cost 100 funds Resourcesassignedpercontract 100 resource units Table 6
  • 28. Figure 11 The simulationwasrepeatedfor49 differentslacklowerlimits. Inthe figure below,the graphshowsthe behaviourof the agentoverthe fiscal periodfora slacklimitof 2500 resource units,orhalf of the initial supplyof resourcesassignedtothe agent. The resultwasthe agentperformed46 transactionswhere it boughtresource contracts. Figure 12 In the figure below,the graphdepictsresultsof the final simulationwhere the slacklowerlimitwasset at 400 resource units. The agentperformed9transactionswhere itboughtresource contracts.
  • 29. Figure 13 The figure belowshowsagraphof the numberof resource contracts boughtbyagentsfor each simulation,foraspecificslacklowerlimit. The graphis displayedfromthe lefttorightstartingat a slack lowerlimitof 4900 resource unitsandendingwithaslack lowerlimitof 400 resource units. Figure 14 The graph suggeststhatas the slacklowerlimitisdecreased,the agentperformsfewertransactions. In termsof devisingastrategyfor an agent,thisresultconfirmsthatanagent’ssensitivitytoperforming transactionscan be moderatedbyalteringthe slacklowerlimit. However,if the nominal range of operationistoobroad,the agentwill behave asif ithas not beenconfiguredtooperate withinthe boundsof any constraints.
  • 30. 4 Conclusion A systemhasbeenbuilttosimulate the behaviourof agentstradingcontractsforresourcestobe deliveredata specificpointinthe future. The agentshave beendesignedtoperformactionsthat enable themtobuyand sell these contractsbaseduponasimple strategycalledslack. The slackdefines a range of values of the agent’sownsupplyof resourcesasnominal foroperation. Whenthe agent’s supplyof resourcesexceedsthe upperlimitorfallsbelow the lowerlimit,the agentwillthensellorbuy resource contractsand discharge themto depleteorreplenishitssupply. The abilityof agentsto successfully performtaskssuchas buying,sellinganddischargingwas demonstratedinsimulations. Anattemptwasmade toexplore the agent’sbehaviourwithrespectto varyinglevelsof slack. The resultssuggestedthatasthe nominal range of operationwaswidened, the agentperformedfewertransactions. 4.1 Future Work The simulationsystem lacksamechanismbywhichasellingagentmayadjustitssellingprice. Asthe situationcurrentlyexists,the agentsellsresource contractsat the price that theyare bought. It may be worthexploringthe behaviourof the marketif agentswere able tosell contractsatpricesthat reflect the agents’needforresources. Price by presentvalue of funds. Speculative pricing?
  • 31. 5 Bibliography [1] C. K.Woo, D. Lloyd,andA. Tishler,“Electricitymarketreformfailures:UK,Norway,Albertaand California,”Energy Policy, vol.31,no. 11, pp.1103-1115, 2003. [2] J. Hull, Introduction to Futuresand OptionsMarkets,New Jersey:Prentice-Hall Inc.,1995. [3] S. N.Neftci, An Introduction to theMathematicsof FinancialDerivatives,SanDiego:Academic Press,1996. [4] M. Parkin,M. Powell,andK.Matthews, Economics,3rd ed.,Reading,MA:Addison-Wesley, 1997. [5] P. McBurney."Market DesignorCAT Tournament2008," 4/19/2008; http://www.marketbasedcontrol.com/blog/index.php?page_id=5.