source: trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/IStochasticProcess.java @ 342

Last change on this file since 342 was 342, checked in by sherbold, 13 years ago
  • Property svn:mime-type set to text/plain
File size: 4.9 KB
Line 
1package de.ugoe.cs.eventbench.models;
2
3import java.io.Serializable;
4import java.security.InvalidParameterException;
5import java.util.Collection;
6import java.util.List;
7
8import de.ugoe.cs.eventbench.data.Event;
9
10/**
11 * <p>
12 * This interface defines the functionalities provided by stochastic processes.
13 * </p>
14 *
15 * @author Steffen Herbold
16 * @version 1.0
17 */
18public interface IStochasticProcess extends Serializable {
19
20        /**
21         * <p>
22         * Returns the probability, that the next event is {@code symbol} given the
23         * last events are {@code context}. The last element of {@code context} is
24         * the most recent in the history, the first element is the oldest.
25         * </p>
26         *
27         * @param context
28         *            recently observed symbols
29         * @param symbol
30         *            event for which the probability is calculated
31         * @return probabilty the {@code symbol} is the next event, given the last
32         *         events {@code context}
33         * @throws InvalidParameterException
34         *             thrown if context or symbol is null
35         */
36        double getProbability(List<? extends Event<?>> context, Event<?> symbol);
37
38        /**
39         * <p>
40         * Returns the probabilitiy that a given sequence is generated by the
41         * stochastic process.
42         * </p>
43         *
44         * @param sequence
45         *            sequences of which the probability is calculated
46         * @return probability of the sequences; 1.0 if sequence is empty or null
47         * @throws InvalidParameterException
48         *             thrown if sequence is null
49         */
50        double getProbability(List<? extends Event<?>> sequence);
51
52        /**
53         * <p>
54         * Generates a random sequence of events. The sequence starts with
55         * {@link Event#STARTEVENT} and finishes with {@link Event#ENDEVENT}.
56         * </p>
57         *
58         * @return randomly generated sequence
59         */
60        public List<? extends Event<?>> randomSequence();
61
62        /**
63         * <p>
64         * Generates all sequences of a given length are possible, i.e., have a
65         * positive probability.<br>
66         * All states are used as possible starting states.
67         * </p>
68         *
69         * @param length
70         *            length of the generated sequences
71         * @return generated sequences
72         * @see #generateSequences(int, boolean)
73         * @throws InvalidParameterException
74         *             thrown if length is less than or equal to 0
75         */
76        public Collection<List<? extends Event<?>>> generateSequences(int length);
77
78        /**
79         * <p>
80         * Generates all sequences of given length that can are possible, i.e., have
81         * positive probability.<br>
82         * If {@code fromStart==true}, all generated sequences start in
83         * {@link Event#STARTEVENT}. Otherwise this method is the same as
84         * {@link #generateSequences(int)}.
85         * </p>
86         *
87         * @param length
88         *            length of the generated sequences
89         * @param fromStart
90         *            if true, all generated sequences start with
91         *            {@link Event#STARTEVENT}
92         * @return generated sequences
93         * @throws InvalidParameterException
94         *             thrown if length is less than or equal to 0
95         */
96        public Collection<List<? extends Event<?>>> generateSequences(int length,
97                        boolean fromStart);
98
99        /**
100         * <p>
101         * Generates all sequences starting with {@link Event#STARTEVENT} and
102         * finishing with {@link Event#ENDEVENT} of a given length. It is possible
103         * that no such sequence exists with the defined length and the returned set
104         * is empty. If {@code length} is less than 2 the returned set is always
105         * empty.
106         * </p>
107         *
108         * @param length
109         * @return generated sequences
110         * @throws InvalidParameterException
111         *             thrown if length is less than or equal to 0
112         */
113        public Collection<List<? extends Event<?>>> generateValidSequences(
114                        int length);
115
116        /**
117         * <p>
118         * Returns the number of states known by the stochastic process, i.e., the
119         * size of its alphabet.
120         * </p>
121         *
122         * @return number of states
123         */
124        public int getNumSymbols();
125
126        /**
127         * <p>
128         * Returns a string representation of all known states.
129         * </p>
130         *
131         * @return string representation for all known states
132         */
133        public String[] getSymbolStrings();
134
135        /**
136         * <p>
137         * Returns the number of states the process would have if it would be
138         * flattened through state-splitting to a first-order Markov model.
139         * </p>
140         * <p>
141         * If it is not possible to flatten the model, -1 is returned.
142         * </p>
143         *
144         * @return number of states an equivalent FOM would have; -1 if not
145         *         available
146         */
147        public int getNumFOMStates();
148
149        /**
150         * <p>
151         * Returns the number of transitions the process would have if it would be
152         * flattened through state-splitting to a first-order Markov model.
153         * </p>
154         *
155         * @return number of transitions an equivalent FOM would have; -1 if not
156         *         available
157         */
158        public int getNumTransitions();
159
160        /**
161         * <p>
162         * Returns all states known by the stochastic process, i.e., its
163         * {@link Event}s.
164         * </p>
165         *
166         * @return events known by the process
167         */
168        public Collection<? extends Event<?>> getEvents();
169
170}
Note: See TracBrowser for help on using the repository browser.