-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
77 lines (48 loc) · 2.13 KB
/
Main.java
File metadata and controls
77 lines (48 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//This is the brief for the Stochastic Assessment
///
//_______________________________________________________
//
// Edit this file at your own peril.
//
// I recommend only changing numbers.
//
// Do not add anything. During marking I will use a different version of Stochastic.java
//
// Any code you add here will ne lost and ignored.
//
//______________________________________________________
class Main {
public static void main(String[] args) {
long startT = System.currentTimeMillis();
// A random walk in discrete time.
// Steady state probabilities of all states are equal.
int numStates = 9;
int s1 = 1;
int s2 = 2;
double A1 = Markov.getTransitionProbability(s1, s2, numStates);
// The estimated probability that the walker is in state s2 at time step TS when it started in state s1.
numStates = 9; // fixed for this question
s1 = 1;
s2 = 2;
int TS = 3;
double A2 = Markov.getEstimatedProbability(s1, s2, numStates, TS);
// A random walk in discrete time.
// Steady state probabilities of all states are GIVEN.
double[] ssprob = {0.1, 0.1, 0.1, 0.2, 0.1, 0.2, 0.05, 0.05, 0.1};
s1 = 1;
s2 = 2;
double A3 = Markov.getBiasTransitionProbability(s1, s2, ssprob);
// A random walk in continuous time.
double[] rates = {10.0, 20.0, 10.0, 1.0, 1.0, 1.0};
double A4 = Markov.getContinuousTransitionProbability(s1, s2, rates);
// Estimated probability that at continuous time TSC the walker chain is in state s2 when it started in state s1.
double TSC = 0.07;
s1 = 1;
s2 = 3;
double A5 = Markov.getContinuousEstimatedProbability(s1, s2, rates, TSC);
// Results
System.out.println("Your answers to the questions were: " + " \n A1 " + A1 + "\n A2 " + A2 + "\n A3 " + A3 + "\n A4 " + A4 + "\n A5 " + A5);
long endT = System.currentTimeMillis();
System.out.println("Total execution time was: " + ((endT - startT) / 1000.0) + " seconds");
}
}