Presentation is loading. Please wait.

Presentation is loading. Please wait.

Horse Racing Simulation System Presented By Ting Hin Chau Supervised By Professor Michael R. Lyu April 2004.

Similar presentations


Presentation on theme: "Horse Racing Simulation System Presented By Ting Hin Chau Supervised By Professor Michael R. Lyu April 2004."— Presentation transcript:

1 Horse Racing Simulation System Presented By Ting Hin Chau Supervised By Professor Michael R. Lyu April 2004

2 Agenda  Objectives of Project  Background of Horse Racing  Major Business Functions of Objects  System Design  Simulation Algorithm  Conclusion  Q & A

3 Objectives  To demonstrate CORBA implementation  To demonstrate horse racing simulation Objectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

4 Background of Horse Racing ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBusiness Functions System Design Simulation Algorithm  Jockey Club  Stable  Gambler

5 Background of Horse Racing Inefficient Procedures  Race Registration: Paper Work  Betting: Off-course betting branches ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBusiness Functions System Design Simulation Algorithm

6 Background of Horse Racing Difficult Result Prediction  Personal Judgement ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBusiness Functions System Design Simulation Algorithm

7 Business Functions ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundSystem Design Simulation Algorithm Jockey Club  Formulating Horse Racing Schedule  Schedule Query by Stable  Processing Horse Registration for a Race by Stable

8 Business Functions Jockey Club  Race Query by Gamblers  Accepting Bets from Gamblers  Calculating Odds (Appendix 1)  Running Races  Dividend Payout ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundSystem Design Simulation Algorithm

9 Business Functions Stable  Horse Query by Gamblers  Horse Registration for a Race ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundSystem Design Simulation Algorithm

10 Business Functions Gambler  Depositing Money to Betting Account  Placing Bets ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundSystem Design Simulation Algorithm

11 System Design ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm  Interaction Object Request Broker (VisiBroker for Java 4.0) Database (Oracle 8i) Server Object 1 Server Object N Client Object 1 Client Object N Java Applet

12 System Design Object Request Broker  VisiBroker for Java 4.0  Service Lookup  Object Instantiation  Connection Setup between Client and Server Objects ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm

13 System Design Object Request Broker ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm

14 System Design Server Objects  Interfaces defined in CORBA/IDL interface Buyer { attribute unsigned longBuyerID; attribute stringBuyerPassword; attribute stringBuyerName; attribute floatBalance; attribute stringAccountNumber; exception NotEnoughMoneyInAccount { }; void deposit(in float amount); void withdraw(in unsigned long amount) raises(NotEnoughMoneyInAccount); void edit(in string buyerName, in string buyerPassword, in string accountNumber); }; ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm

15 System Design CORBA/IDL to Java Mapping IDLJava modulepackage interface operationmethod attributemethod pair exception ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm

16 System Design idl2java  Interface file  Helper file  Holder file  Stub file  POA file ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm

17 System Design Server Objects  Buyer  BuyerProcessor  Stable  StableProcessor  Race ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm

18 System Design Client GUI  RaceAdminClient  StableClient  BuyerClient ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm

19 System Design Client GUI  RaceAdminClient ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm

20 System Design Client GUI  StableClient ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm

21 System Design Client GUI  BuyerClient ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm

22 System Design Database Server  Oracle 8i  Persistent storage of data  Maintaining data integrity  E-R diagram (Appendix 2) ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions Simulation Algorithm

23 ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Monte Carlo Simulation  Simulation with a built-in random process  Different possible outcomes

24 Simulation Algorithm Steps of Simulation (Appendix 3) 1. Data Input  Gather data on historical ranks of a horse  Transform these ranks to a value R/N, which is rank/number of horses in the race ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design

25 Simulation Algorithm Steps of Simulation 2. Distribution Construction  Form frequency distribution  Form probability distribution  Form cumulative probability distribution ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design

26 Simulation Algorithm Steps of Simulation ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design

27 Simulation Algorithm Steps of Simulation 3. Draw a sample from distribution  Generate a random number N from 0 to 1  N refers to P(X <= x), where X is R/N ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design

28 Simulation Algorithm Steps of Simulation ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design

29 Simulation Algorithm Steps of Simulation 4. Compare R/N across horses  Sort the R/N values of the horses in a race  A horse with a smaller R/N beats out a horse with a higher R/N ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design

30 Simulation Algorithm Assumptions of Simulation  Independent distribution of R/N  Factors including location of racecourse, lane, and jockey are insignificant  Data from the 10 most recent races are used ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design

31 Conclusion CORBA  Language independent  Different platforms  ORB expensive ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

32 Conclusion Simulation  Mimics the “random” factor in horse racing  Choice of size of distribution is hard to determine  Error of prediction can be estimated ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

33 Appendix 1 Calculation of Odds 1. Win Odds  d w =  b i / b w 2. Place Odds  d w1 = (  b i - b w1 - b w2 - b w3 ) /( 3 * b w1 ) + 1 ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

34 Appendix 2 Stabl e_t Pass word SID Statu s Horse _t HID Weig ht Birth day Statu s Gamb ler_t Pass word GID Statu s Gam bler Nam e Acc ount Num Bet Acc ount Bal Race _t HLan e RaceE ventN umber Race Date TxnS tatus Horse Rank Joi ns O wn s Bet_t BetT ype BetA mount Ga mbl er- bet Rac e- bet ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

35 Appendix 3 Simulation Calculation ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

36 Appendix 3 Simulation Calculation ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

37 Appendix 3 Simulation Calculation ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

38 Appendix 3 Simulation Calculation  Two points on the cumulative distribution (x1, y1) and (x2, y2), for instance, for horse 1, they correspond to (0.25, 0.5) and (0.25, 0.6), will be used to calculate the final score of a horse by linear equation, based on the random number generated. ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

39 Appendix 3 Simulation Calculation  For horse 1, point 1 (x1, y1) is (0.4, 0.2) and point 2 (x2, y2) is (0.5, 03)  R/N of horse 1 = (rand1-y1)*((x2-x1)/(y2-y1)) + x1 = (0.5379783655654367 – 0.2)* (0.25 – 0.25)/(0.6-0.5) + 0.25 = 0.25 ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

40 Appendix 3 Simulation Calculation  For horse 2, point 1 (x1, y1) is (0.4, 0.2) and point 2 (x2, y2) is (0.5, 0.3).  R/N of horse 2 = (rand2-y1)*((x2-x1)/(y2-y1)) + x1 = (0.21096296234313094 – 0.2)* (0.5 – 0.4)/(0.3-0.2) + 0.4 = 0.410962962 ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

41 Appendix 3 Simulation Calculation  For horse 3, point 1 (x1, y1) is (0, 0) and point 2 (x2, y2) is (0.125, 0.1).  R/N of horse 3 = (rand2-y1)*((x2-x1)/(y2-y1)) + x1 = (0.02229991816731558 – 0)* (0.125 – 0)/(0.1-0) + 0 = 0.027874898 ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm

42 Appendix 3 Simulation Calculation  For horse 4, point 1 (x1, y1) is (0.5355, 0.4) and point 2 (x2, y2) is (0.545455, 0.5).  R/N of horse 3 = (rand2-y1)*((x2-x1)/(y2-y1)) + x1 = (0.4920612612595172 – 0.4) * (0.545455 – 0.5355)/(0.5-0.4) + 0.5355 = 0.544664699 ObjectivesObjectives / Background / Business Functions / System Design / Simulation AlgorithmBackgroundBusiness Functions System Design Simulation Algorithm


Download ppt "Horse Racing Simulation System Presented By Ting Hin Chau Supervised By Professor Michael R. Lyu April 2004."

Similar presentations


Ads by Google