Perform a large number of simulations using the function

Assignment Help Civil Engineering
Reference no: EM132986484

Optimization

This assignment focuses on the estimation of the average amount of SMS messages per day that were sent by person A, and the change of this average amount. These data are also in the file num sms 30352746.txt. Figure 2.1 shows the evolution of the amount of SMS messages sent by this person during a period of 120 days. At one point during these 120 days this person broke up with his girlfriend. The question is whether or not this breaking up of the relationship had an influence on the amount of SMS messages this person sent per day. We will use Particle Swarm Optimization (PSO) for this purpose. PSO is a pre-programmed package in matlab (particleswarm) or python (pso) that looks for a set of parameters that minimize a specific function. For example, consider the function:

y = 2x2 - 24x + 48

We can easily calculate the first derivative, which is:

dy/dx = 4x - 24

Equalizing this to zero shows that the function will have its minimum for x equal to 6. PSO will thus return 6 for the optimal value of x, and -24 as the optimal function value (entering x=6 in Equation 2.1). The advantages of PSO is that it can return the optimal parameter and function values for situations in which 1) there is no analytical expression for the function, and 2) there are multiple independent variables (thus y depends on x1, x2, ...).

The amount of SMS messages sent per day can be assumed to follow a Poisson distribution with parameter λ. For this problem, there are three items that we don't know: the day of the break-up (let's call this n), the amount of messages sent before the break-up (we can call this λ1), and the amount of message sent after the break-up (this we will call λ2). We will solve this problem as follows:

1. We need to set upper and lower boundaries for n, λ1, and λ2. For n we can set these as 0 and 120 (the amount of days), respectively. For λ1 and λ2 we can set these as 0 and the highest amount of SMS messages per day in the time series, respectively.

Number of SMS Messages per Day

2256_figure.jpg

Figure 2.1: Number of SMS messages sent by person A per day.

2. We need to simulate the amount of messages per day. We can use the function numpy.random.poisson in python, or poissonrnd in matlab for this purpose. These functions will return a random number that follows the Poisson distribution with parameter λ (both functions need this pa- rameter as input). Thus we need to do:
- For the first n days, we generate a random number that follows a Poisson distribution with parameter λ1.
- Then, for 120- n days, we generate a random number that follows a Poisson distribution with parameter λ2.
- For the 120 days, we calculate the Root Mean Square Error:

1358_figure1.jpg

O(i) and S(i) are the observed and simulated amount of SMS messages per day, re- spectively. This is a function that you need to code in matlab or python.

3. PSO will then perform a large number of simulations using the function in step 2, and return the values of n, λ1, and λ2, as well as the lowest RMSE.

4. Since PSO works stochastically, it will return different parameter and objective function (the RMSE) values every time you apply it. It is thus best to repeat the PSO search 20 times, and retain the results of the search with the lowest RMSE value.

Your report must be written in MS Word or any other word processor, and contain:

- A short explanation (maximum 1000 words) on how your code works.
- The resulting values of the RMSE, n, λ1, and λ2.

Attachment:- Optimization.rar

Reference no: EM132986484

Questions Cloud

Crostini mince system : Consider the security policies that will be required for Crostini's Mince system.
Implemented in corporate environment : Discussing the key aspects of how User and Group Schemas are implemented in a corporate environment.
Identify and evaluate the ethical principles : Identify and evaluate the ethical principles which would guide how a professional accountant should act in this type of situation.
What is compensation expense for 2021 : What is compensation expense for 2021 - Make the journal entry to record the exercise of the stock options in 2024
Perform a large number of simulations using the function : Perform a large number of simulations using the function in step 2, and return the values of n, ?1, and ?2, as well as the lowest RMSE.
Evaluate theoretical perspectives on strategic management : Evaluate theoretical perspectives on strategic management and their implications and Critique the limitations of frequently cited theoretical explanations
Compute the future value : Compute the future value of $5,000 compounded annually for 10 years at 5 percent.
Explain how a bill becomes a law : How to influence the development of legislation. Explain how a bill becomes a law, or not, through the federal legislative branch and executive branch
Formulate an estimate of operating costs : Formulate an estimate of operating costs for March 2017 assuming that 2 special analyses will be conducted, there will be 318 accounts and 1325 pay cheques

Reviews

Write a Review

Civil Engineering Questions & Answers

  What was the drivers associated reaction time in seconds

The driver strikes the sign at a speed of 25 mi/h. If the student was traveling at 55 mi/h when the sign was spotted, what was the drivers associated reaction time in seconds

  What is the discharge through the pipe for a water

A fire hydrant is supplied through a 6 inch cast iron pipe of 16,000 feet length. The total drop in pressure is limited to 35 psi. What is the discharge through the pipe for a water temperature of 80°F

  What is the recommendation to get a basic refrigerator

Quinton's refrigerator has just died. He can get a basic refrigerator or a more efficient refrigerator with an energy star designation. Quinton earns 4% compounded annually on his investments, he wants to consider a 10-year planning horizon

  Determine the flow area

A rectangular concrete channel is 3 m wide and 2 m high. The water 20 deg Celsius in the main channel is 1.5 m deep and is flowing at a rate of 30 m^3/s. determine the flow area, wetted perimeter, and hydraulic radius. is the flow laminar or turbu..

  How does each alternative plan meet the objective stated

Based on the data presented, develop a nurse staffing plan for Memorial Hospital. Explain your rationale for this plan The case is attached. This assignment can be 300-350 words.

  What is the level of service expected in each direction

A Class I rural highway segment of 10 miles in level terrain has a base free-flow speed (BFFS) of 65 mph. The cross section has 12-ft lanes and 6-ft clear shoulders on both sides of the road.

  How much subsidence would be expected from an elastic

How much subsidence would be expected from an elastic confined aquifer that has a specific storage of 2.0*10^-6 (ft^-1), a decline in pressure of 200 (lbs/in^2), and aquifer thickness of 400 ft, and a porosity of 32 percent? Assume the aquifer temper..

  What is the volume of the aeration basin

Assume that the influent VSS concentration is negligible, KS is 60 mg BOD/L, kd is 0.07 day-1, µm is 5 day-1, and Y is 0.65 mg VSS/mg BOD. Assuming a VSS concentration of 2,000 mg/L in the aeration basin, what is the volume (in cubic meters) of t..

  At what depth would the vertical effective stress in a deep

At what depth would the vertical effective stress in a deep deposit of clay be 100 kpa, if e=1.1? The ground water level is a 1 m delow ground surface and S=95% above the groundwater level. Neglect pore air pressure.

  Determine the force exerted by the belt on the package

A series of small packages, each with a mass of 0.5 kg, are discharged from a conveyor belt. Knowing that the coefficient of static friction between each package and the conveyor belt is 0.4,

  Latitude near the eastern seaboard of the us

If the gulf stream flows north from Mexico at 2 m/s on average, howwould I find the average slope of the Atlantic Ocean across the 45degree N latitude near the Eastern Seaboard of the US?

  Determine the size of pipe for a water temperature

The difference in water level is 60ft. Determine the size of pipe for a water temperature of 60 degrees Fahrenheit. Apply The Darcy-Weisbach equation.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd