Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
 All Classes Functions Variables
transitionStructure.h
1 /* Marmote is free software: you can redistribute it and/or modify
2 it under the terms of the GNU General Public License as published by
3 the Free Software Foundation, either version 3 of the License, or
4 (at your option) any later version.
5 
6 Marmote is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 GNU General Public License for more details.
10 
11 You should have received a copy of the GNU General Public License
12 along with Marmote. If not, see <http://www.gnu.org/licenses/>.
13 
14 Copyright 2015 Alain Jean-Marie, Jean-Michel Fourneau, Jean-Marc Vincent, Issam Rabhi */
15 
16 #ifndef TRANSITIONSTRUCTURE_H
17 #define TRANSITIONSTRUCTURE_H
18 
19 #include "../marmoteConstants.h"
20 #include "../Distribution/discreteDistribution.h"
21 #include <stdio.h>
22 #include <string>
23 
33 {
34  protected:
35  timeType _type;
37  long int _size;
40  public:
41  // constructors
42  // transitionStructure(int);
47  virtual ~transitionStructure() {};
48 
49  public:
50  //accessors
56  int size() { return _size; };
62  timeType type() { return _type; };
75  void setType(timeType t) { _type = t; };
81  void setUniformizationRate(double rate) { _uniformizationRate = rate; };
90  virtual bool setEntry(int i, int j, double val) = 0;
99  virtual double getEntry(int i, int j) = 0;
107  virtual int getNbElts(int i) = 0;
116  virtual int getCol(int i, int k) = 0;
125  virtual double getEntryByCol(int i, int k) = 0;
132  virtual discreteDistribution* getTransDistrib(int i) = 0; // transitions from some state and their probas
133 
142  bool readEntry(FILE *input);
149  virtual double rowSum(int i) = 0;
150 
151  public:
157  virtual transitionStructure* copy() = 0;
166  virtual transitionStructure* uniformize() = 0;
176  virtual void evaluateMeasure(double* d,double* res) {
177  fprintf( stderr, "Warning in transitionStructure::evaluateDistribution: not implemented.\n" ); };
185  fprintf( stderr, "Warning in transitionStructure::evaluateDistribution: not implemented.\n" ); };
194  virtual void evaluateValue(double* v, double* res) = 0;
195 
196 protected:
197  // specific technical methods
209  int consolidate(int i, int* destinations, double* values);
210 
211 public:
218  virtual void write(FILE* out, std::string format) = 0;
219 
220 };
221 
222 #endif // TRANSITIONSTRUCTURE_H