Added 07-21 exam

This commit is contained in:
Deco71 2022-11-16 18:08:57 +01:00
parent 1a3767b4a9
commit 81bfdb2c34
180 changed files with 0 additions and 81 deletions

View file

@ -0,0 +1,27 @@
<pre>
block MarkovChain
//external function myrandom() returns a random real number in [0, 1]
parameter Integer x0 = 0;
parameter Integer xmax = 100;
OutputInteger x;
algorithm
when initial() then
x := x0;
elsewhen sample(0, 1) then
if (x < xmax)
then
if (myrandom() <= 0.9)
then
if (myrandom() <= 0.8)
then
x := x + 1;
else
x := max(0, x - 1);
end if;
else
x := max(0, x - 1);
end if;
end if;
end when;
end MarkovChain;
</pre>

View file

@ -0,0 +1,8 @@
Un'azienda decide di organizzare il processo di sviluppo di un grosso software in 101 phasi sequenziali, numerate da 0 a 100. La phase 0 è quella iniziale. La phase 100 è quella finale in cui lo sviluppo è completato. Tutte le fasi hanno circa la stessa durata.
Alla fine di ogni fase viene eseguita una batteria di tests. I risultati del testing possono essere:
a) si può passare alla fase successiva;
b) bisogna ripetere la fase corrente;
c) bisogna rivedere il lavoro fatto nella fase precedente (reworking).
Dai dati storici è noto che la probabilità del caso a) è 0.72, del caso b) è 0.18 e del caso c) è 0.1.
Allo scopo di stimare attraverso una simulazione MonteCarlo il valore atteso del tempo di completamento del progetto viene realizzato un modello Modelica del processo di sviluppo descritto sopra.
Quale dei seguenti modelli Modelica modella correttamente il processo di sviluppo descritto sopra?

View file

@ -0,0 +1,27 @@
<pre>
block MarkovChain
//external function myrandom() returns a random real number in [0, 1]
parameter Integer x0 = 0;
parameter Integer xmax = 100;
OutputInteger x;
algorithm
when initial() then
x := x0;
elsewhen sample(0, 1) then
if (x < xmax)
then
if (myrandom() <= 0.9)
then
if (myrandom() <= 0.72)
then
x := x + 1;
else
x := max(0, x - 1);
end if;
else
x := max(0, x - 1);
end if;
end if;
end when;
end MarkovChain;
</pre>

View file

@ -0,0 +1,27 @@
<pre>
block MarkovChain
//external function myrandom() returns a random real number in [0, 1]
parameter Integer x0 = 0;
parameter Integer xmax = 100;
OutputInteger x;
algorithm
when initial() then
x := x0;
elsewhen sample(0, 1) then
if (x < xmax)
then
if (myrandom() <= 0.8)
then
if (myrandom() <= 0.9)
then
x := x + 1;
else
x := max(0, x - 1);
end if;
else
x := max(0, x - 1);
end if;
end if;
end when;
end MarkovChain;
</pre>