source: trunk/quest-core-events/src/de/ugoe/cs/quest/models/IStochasticProcess.java @ 432

Last change on this file since 432 was 432, checked in by sherbold, 12 years ago
  • renamed packages to fir QUEST project structure
  • Property svn:mime-type set to text/plain
File size: 5.8 KB
RevLine 
[432]1package de.ugoe.cs.quest.models;
[17]2
[86]3import java.io.Serializable;
[342]4import java.security.InvalidParameterException;
[102]5import java.util.Collection;
[17]6import java.util.List;
7
[432]8import de.ugoe.cs.quest.data.Event;
[17]9
[99]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 */
[86]18public interface IStochasticProcess extends Serializable {
[99]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}
[342]33         * @throws InvalidParameterException
34         *             thrown if context or symbol is null
[99]35         */
[93]36        double getProbability(List<? extends Event<?>> context, Event<?> symbol);
[248]37
[118]38        /**
39         * <p>
[248]40         * Returns the probabilitiy that a given sequence is generated by the
41         * stochastic process.
[118]42         * </p>
[248]43         *
44         * @param sequence
45         *            sequences of which the probability is calculated
[118]46         * @return probability of the sequences; 1.0 if sequence is empty or null
[342]47         * @throws InvalidParameterException
48         *             thrown if sequence is null
[118]49         */
50        double getProbability(List<? extends Event<?>> sequence);
[17]51
[99]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         */
[66]60        public List<? extends Event<?>> randomSequence();
[99]61
62        /**
63         * <p>
[386]64         * Generates a random sequence of events. The sequence starts with
65         * {@link Event#STARTEVENT} and finishes with
66         * <ul>
67         * <li>{@link Event#ENDEVENT} if validEnd==true.</li>
68         * <li>b) if a generated sequences reaches {@link Event#ENDEVENT} before
69         * maxLength, the sequence finishes and is shorter than maxLenght.
70         * Otherwise, the sequence finishes as soon as maxLength is reached and the
71         * final event of the sequence must not be {@link Event#ENDEVENT}.</li>
72         * </ul>
73         * </p>
74         *
75         * @param maxLength
76         *            maximum length of the generated sequence
77         * @param validEnd
78         *            if true, only sequences that finish with
79         *            {@link Event#ENDEVENT} are generated
80         * @return randomly generated sequence
81         *
82         */
83        public List<? extends Event<?>> randomSequence(int maxLength,
84                        boolean validEnd);
85
86        /**
87         * <p>
[99]88         * Generates all sequences of a given length are possible, i.e., have a
89         * positive probability.<br>
90         * All states are used as possible starting states.
91         * </p>
92         *
93         * @param length
94         *            length of the generated sequences
95         * @return generated sequences
96         * @see #generateSequences(int, boolean)
[342]97         * @throws InvalidParameterException
98         *             thrown if length is less than or equal to 0
[99]99         */
[102]100        public Collection<List<? extends Event<?>>> generateSequences(int length);
[99]101
102        /**
103         * <p>
104         * Generates all sequences of given length that can are possible, i.e., have
105         * positive probability.<br>
106         * If {@code fromStart==true}, all generated sequences start in
107         * {@link Event#STARTEVENT}. Otherwise this method is the same as
108         * {@link #generateSequences(int)}.
109         * </p>
110         *
111         * @param length
112         *            length of the generated sequences
113         * @param fromStart
114         *            if true, all generated sequences start with
115         *            {@link Event#STARTEVENT}
116         * @return generated sequences
[342]117         * @throws InvalidParameterException
118         *             thrown if length is less than or equal to 0
[99]119         */
[102]120        public Collection<List<? extends Event<?>>> generateSequences(int length,
[99]121                        boolean fromStart);
122
123        /**
124         * <p>
125         * Generates all sequences starting with {@link Event#STARTEVENT} and
126         * finishing with {@link Event#ENDEVENT} of a given length. It is possible
127         * that no such sequence exists with the defined length and the returned set
128         * is empty. If {@code length} is less than 2 the returned set is always
129         * empty.
130         * </p>
131         *
132         * @param length
133         * @return generated sequences
[342]134         * @throws InvalidParameterException
135         *             thrown if length is less than or equal to 0
[99]136         */
[248]137        public Collection<List<? extends Event<?>>> generateValidSequences(
138                        int length);
[99]139
140        /**
141         * <p>
142         * Returns the number of states known by the stochastic process, i.e., the
143         * size of its alphabet.
144         * </p>
145         *
146         * @return number of states
147         */
[129]148        public int getNumSymbols();
[99]149
150        /**
151         * <p>
152         * Returns a string representation of all known states.
153         * </p>
154         *
155         * @return string representation for all known states
156         */
[129]157        public String[] getSymbolStrings();
[248]158
[129]159        /**
160         * <p>
[248]161         * Returns the number of states the process would have if it would be
162         * flattened through state-splitting to a first-order Markov model.
[129]163         * </p>
164         * <p>
165         * If it is not possible to flatten the model, -1 is returned.
166         * </p>
167         *
[248]168         * @return number of states an equivalent FOM would have; -1 if not
169         *         available
[129]170         */
171        public int getNumFOMStates();
[99]172
173        /**
174         * <p>
[248]175         * Returns the number of transitions the process would have if it would be
176         * flattened through state-splitting to a first-order Markov model.
177         * </p>
178         *
179         * @return number of transitions an equivalent FOM would have; -1 if not
180         *         available
181         */
182        public int getNumTransitions();
183
184        /**
185         * <p>
[99]186         * Returns all states known by the stochastic process, i.e., its
187         * {@link Event}s.
188         * </p>
189         *
190         * @return events known by the process
191         */
[102]192        public Collection<? extends Event<?>> getEvents();
[17]193
194}
Note: See TracBrowser for help on using the repository browser.