[SOLVED] 代写 python SQL database CMT 115 Python for Computation

30 $

File Name: 代写_python_SQL_database_CMT_115_Python_for_Computation.zip
File Size: 536.94 KB

SKU: 9271692910 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


CMT 115 Python for Computation
Coursework

Simulation Data

Simulation Data
Tasks that need to be carried out by a processor.
ID
Arrival
Duration


Simulation Data
● ID: A string of six characters. Each character is randomly chosen (uniform
probability) from letters (’a’-’z’ and ’A’-’Z’), digits (’0’-’9’) and some special
characters (’@’, ’_’, ’#’, ’*’, ’-’, and ’&’). ○ Choose six characters randomly from:
qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789@_#*-& ○ Example:
■ JoGY6A ■ l*@1D* ■ FJUBT4 ■ *17hu- ■ …

Simulation Data
● Arrival: A random real value generated by a uniform distribution from 0
to 100.
○ The uniform distribution is a continuous distribution.
○ This means that the arrival will be a real number from 0 to 100.
○ For example:
■ 47.847
■ 0.12434545 ■ 12.236673
■ 85.18483830 ■ …

Simulation Data
● Duration: A random value generated by an exponential distribution of
parameter 1, rounded up.
○ This time, the result will be an integer number.
○ The probability density distribution (pdf) of an exponential distribution is:

Simulation Data
● Duration: A random value generated by an exponential distribution of
parameter 1, rounded up.
○ This time, the result will be an integer number.
○ The probability density distribution (pdf) of an exponential distribution is:

Simulation Data
● Duration: A random value generated by an exponential distribution of
parameter 1, rounded up.
○ This time, the result will be an integer number.
○ Hint: When it comes to “randomness”, what module should you use? ○ Example:
Random exponential value, λ = 1
Rounded random exponential value, λ = 1
0.36242987
1
2.27409564
3
2.07593962
3
0.09725423
1

Simulation Data
Tasks that need to be carried out by a processor.
ID
Arrival
Duration
JoGY6A
47.847
1
l*@1D*
0.12434545
3
FJUBT4
12.236673
3
*17hu-
85.18483830
1

Simulation Data
The code must store the dataset in an SQL database (using sqlite3).
SQL DB
sqlite3
What should be the key of the table? Is the ID a candidate key?
ID
Arrival
Duration
JoGY6A
47.847
1
l*@1D*
0.12434545
3
FJUBT4
12.236673
3
*17hu-
85.18483830
1

Simulated System

Simulated System
Tasks Queue
Processors Clock
Output

Initialization
● The Database is loaded in the queue.
● Clock is set to 0.
● Processors are initialised and available.
● Message “** SYSTEM INITIALISED **” is displayed.

Simulated System
ID
Arrival
Duration
JoGY6A
3.2736
2
l*@1D*
0.12434545
3
FJUBT4
2.98452
1
*17hu-
3.2649
3
gT4Yg_
2.161761
2
##23eE
2.3628
4

Simulated System
ID
Arrival
Duration
JoGY6A
3.2736
2
l*@1D*
0.12434545
3
FJUBT4
2.98452
1
*17hu-
3.2649
3
gT4Yg_
2.161761
2
##23eE
2.3628
4

Simulated System
ID
Arrival
Duration
l*@1D*
0.12434545
3
gT4Yg_
2.161761
2
##23eE
2.3628
4
FJUBT4
2.98452
1
*17hu-
3.2649
3
JoGY6A
3.2736
2

Simulated System
Tasks Queue
Processors
available
available
available
Clock = 0
Output
** SYSTEM INITIALISED **
JoGY6A
*17hu-
FJUBT4
##23eE
gT4Yg_
l*@1D*
3.2736
3.2649
2.98452
2.3628
2.161761
0.12434545
2
3
1
4
2
3

Task l*@1D* / 0.12434545 / 3 enters the system
● Clock is updated to 0.12434545.
● Message “** 0.12434545 : Task l*@1D* with duration 3 enters the
system.” displayed
● The ID is checked:
○ Lowercase letter… X
○ Uppercase letter… ✓
○ Digit… ✓
○ Special characters… ✓
It satisfies at least 3 of the rules. Message “** Task l*@1D* accepted.” is displayed.
● The task is assigned to processor 1. It ends at 3.12434545. Message “** 0.12434545 : Task l*@1D* assigned to processor 1.”

Simulated System
Tasks Queue
Processors
available
available
Clock = 0.12434545
Output
** 0.12434545 : Task l*@1D* with duration 3 enters the system.
** Task l*@1D* accepted.
** 0.12434545 : Task l*@1D* assigned to processor 1.
l*@1D*
3.12434545
JoGY6A
*17hu-
FJUBT4
##23eE
gT4Yg_
3.2736
3.2649
2.98452
2.3628
2.161761
2
3
1
4
2

Task gT4Yg_ / 2.161761 / 2 enters the system
● Clock is updated to 2.161761.
● Message “** 2.161761 : Task gT4Yg_ with duration 2 enters the system.”
displayed
● The ID is checked:
○ Lowercase letter… ✓
○ Uppercase letter… ✓
○ Digit… ✓
○ Special characters… ✓
It satisfies at least 3 of the rules. Message “** Task gT4Yg_ accepted.” is displayed.
● The task is assigned to processor 2. It ends at 4.161761. Message “** 2.161761 : Task gT4Yg_ assigned to processor 2.”

Simulated System
Tasks Queue
Processors
available
Clock = 2.161761
Output
** 2.161761 : Task gT4Yg_ with duration 2 enters the system.
** Task gT4Yg_ accepted. ** 2.161761 : Task gT4Yg_ assigned to processor 2.
l*@1D*
3.12434545
gT4Yg_
4.161761
JoGY6A
*17hu-
FJUBT4
##23eE
3.2736
3.2649
2.98452
2.3628
2
3
1
4

Task ##23eE / 2.3628 / 4 enters the system
● Clock is updated to 2.3628.
● Message “** 2.3628 : Task ##23eE with duration 4 enters the system.”
displayed
● The ID is checked:
○ Lowercase letter… ✓
○ Uppercase letter… ✓
○ Digit… ✓
○ Special characters… ✓
It satisfies at least 3 of the rules. Message “** Task ##23eE accepted.” is displayed.
● The task is assigned to processor 3. It ends at 6.3628. Message “** 2.3628 : Task ##23eE assigned to processor 3.”

Simulated System
Tasks Queue
Processors
Clock = 2.3628
Output
** 2.3628 : Task ##23eE with duration 4 enters the system. ** Task ##23eE accepted.
** 2.3628 : Task ##23eE assigned to processor 3.
l*@1D*
3.12434545
gT4Yg_
4.161761
##23eE
6.3628
JoGY6A
*17hu-
FJUBT4
3.2736
3.2649
2.98452
2
3
1

Task FJUBT4 / 2.98452 / 1 enters the system
● Clock is updated to 2.98452.
● Message “** 2.98452 : Task FJUBT4 with duration 1 enters the system.”
displayed
● The ID is checked:
○ Lowercase letter… X
○ Uppercase letter… ✓
○ Digit… ✓
○ Special characters… X
It does not satisfy at least 3 of the rules. Message “** Task FJUBT4 unfeasible and discarded.” is displayed.
● The task is discarded.

Simulated System
Tasks Queue
Processors
Clock = 2.98452
Output
** 2.98452 : Task FJUBT4 with duration 1 enters the system. ** Task FJUBT4 unfeasible and discarded.
l*@1D*
3.12434545
gT4Yg_
4.161761
##23eE
6.3628
JoGY6A
*17hu-
3.2736
3.2649
2
3

Task l*@1D* / 0.12434545 / 3 completed
● Clock is updated to 3.12434545.
● Message “** 3.12434545 : Task l*@1D* completed.” displayed.
● Processor 1 is available.

Simulated System
Tasks Queue
Processors
available
Clock = 3.12434545
Output
** 3.12434545 : Task l*@1D* completed.
gT4Yg_
4.161761
##23eE
6.3628
JoGY6A
*17hu-
3.2736
3.2649
2
3

Task *17hu- / 3.2649 / 3 enters the system
● Clock is updated to 3.2649.
● Message “** 3.2649 : Task *17hu- with duration 4 enters the system.”
displayed
● The ID is checked:
○ Lowercase letter… ✓
○ Uppercase letter… X
○ Digit… ✓
○ Special characters… ✓
It satisfies at least 3 of the rules. Message “** Task *17hu- accepted.” is displayed.
● The task is assigned to processor 1. It ends at 6.2649. Message “** 3.2649 : Task *17hu- assigned to processor 1.”

Simulated System
Tasks Queue
Processors
Clock = 3.2649
Output
** 3.2649 : Task *17hu- with duration 4 enters the system. ** Task *17hu- accepted.
** 3.2649 : Task *17hu- assigned to processor 1.
*17hu-
6.2649
gT4Yg_
4.161761
##23eE
6.3628
JoGY6A
3.2736
2

Task JoGY6A / 3.2736 / 2 enters the system
● Clock is updated to 3.2736.
● Message “** 3.2736 : Task JoGY6A with duration 2 enters the system.”
displayed
● The ID is checked:
○ Lowercase letter… ✓
○ Uppercase letter… ✓
○ Digit… ✓
○ Special characters… X
It satisfies at least 3 of the rules. Message “** Task JoGY6A accepted.” is displayed.
● There are no processors available. The task must be put on hold. Message “** Task JoGY6A on hold.”

Simulated System
Tasks Queue Empty
Processors
Clock = 3.2736
Output
** 3.2736 : Task JoGY6A with duration 2 enters the system. ** Task JoGY6A accepted.
** Task JoGY6A on hold.
*17hu-
6.2649
gT4Yg_
4.161761
##23eE
6.3628
JoGY6A
on hold
2

Task gT4Yg_ / 2.161761 / 2 completed
● Clock is updated to 4.161761.
● Message “** 4.161761 : Task l*@1D* completed.” displayed.
● Processor 2 is available.

Simulated System
Tasks Queue
Processors
available
Clock = 4.161761
Output
** 4.161761 : Task l*@1D* completed.
*17hu-
6.2649
##23eE
6.3628
JoGY6A
on hold
2

Task JoGY6A / 3.2736 / 2 is assigned.
● Clock is NOT updated (clock = 4.161761)
● The task is assigned to processor 2. It ends at 6.161761.
Message “** 4.161761 : Task JoGY6A assigned to processor 2.”

Simulated System
Tasks Queue Empty
Processors
Clock = 4.161761
Output
** 4.161761 : Task JoGY6A assigned to processor 2.
*17hu-
6.2649
JoGY6A
6.161761
##23eE
6.3628

Task JoGY6A / 3.2736 / 2 completed
● Clock is updated to 6.161761.
● Message “** 6.161761 : Task JoGY6A completed.” displayed.
● Processor 2 is available.

Simulated System
Tasks Queue Empty
Processors
available
Clock = 6.161761
Output
** 6.161761 : Task JoGY6A completed.
*17hu-
6.2649
##23eE
6.3628

Task *17hu- / 3.2649 / 3 completed
● Clock is updated to 6.2649.
● Message “** 6.2649 : Task *17hu- completed.” displayed.
● Processor 1 is available.

Simulated System
Tasks Queue Empty
Processors
available
available
Clock = 6.2649
Output
** 6.2649 : Task *17hu- completed.
##23eE
6.3628

Task ##23eE / 2.3628 / 4 completed
● Clock is updated to 6.3628.
● Message “** 6.3628 : Task ##23eE completed.” displayed.
● Processor 3 is available.

Simulated System
Tasks Queue Empty
Processors
available
available
available
Clock = 6.3628
Output
** 6.3628 : Task ##23eE completed.

Simulation completed!
● Clock is not updated (clock = 6.3628).
● Message “** 6.3628 : SIMULATION COMPLETED. **” displayed.
● All’s well

Simulated System
Tasks Queue Empty
Processors
available
available
available
Clock = 6.3628
Output
** 6.3628 : SIMULATION COMPLETED. **

Questions?

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 python SQL database CMT 115 Python for Computation
30 $