| 1 | package PIANOS.datastructures; |
| 2 | |
| 3 | import java.util.*; |
| 4 | import java.io.File; |
| 5 | |
| 6 | |
| 7 | public class ComputationalModel{ |
| 8 | private int iterations; |
| 9 | private int burnIn; |
| 10 | private int thinning; |
| 11 | private String updateStrategy; |
| 12 | private int maxSpatialNeighbours; |
| 13 | private String modelFile; |
| 14 | private String initialValueFile; |
| 15 | private String outputFile; |
| 16 | private String summaryFile; |
| 17 | private String lastValuesFileName; |
| 18 | |
| 19 | private LinkedList<Variable> variableList; |
| 20 | private LinkedList<Entity> entityList; |
| 21 | private HashMap<String, Entity> entityMapper; |
| 22 | private HashMap<String, Variable> variableMapper; |
| 23 | |
| 24 | private ArrayList<Variable> topologicalVariableList; |
| 25 | |
| 26 | public ComputationalModel(int iterations, int burnIn, |
| 27 | int thinning, int maxSpatialNeighbours, |
| 28 | String updateStrategy, |
| 29 | LinkedList<Variable> variableList, |
| 30 | LinkedList<Entity> entityList, |
| 31 | HashMap<String, Entity> entityMapper, |
| 32 | HashMap<String, Variable> variableMapper, |
| 33 | String modelFile, |
| 34 | String initialValueFile, String outputFile, String summaryFile){ |
| 35 | this.iterations = iterations; |
| 36 | this.burnIn = burnIn; |
| 37 | this.thinning = thinning; |
| 38 | this.maxSpatialNeighbours = maxSpatialNeighbours; |
| 39 | this.updateStrategy = updateStrategy; |
| 40 | this.variableList = variableList; |
| 41 | this.entityList = entityList; |
| 42 | this.entityMapper = entityMapper; |
| 43 | this.variableMapper = variableMapper; |
| 44 | this.modelFile = modelFile; |
| 45 | this.initialValueFile = initialValueFile; |
| 46 | this.outputFile = outputFile; |
| 47 | this.summaryFile = summaryFile; |
| 48 | |
| 49 | topologicalVariableList = new ArrayList<Variable>(); |
| 50 | |
| 51 | topologicalVariableList.addAll(variableList); |
| 52 | |
| 53 | for (Entity entity : entityList) { |
| 54 | topologicalVariableList.addAll(entity.getVariableList()); |
| 55 | } |
| 56 | |
| 57 | } |
| 58 | |
| 59 | public int getIterations(){ |
| 60 | return iterations; |
| 61 | } |
| 62 | |
| 63 | public int getBurnIn(){ |
| 64 | return burnIn; |
| 65 | } |
| 66 | |
| 67 | public int getThinning(){ |
| 68 | return thinning; |
| 69 | } |
| 70 | |
| 71 | public int getNeighbourCount(){ |
| 72 | return this.maxSpatialNeighbours; |
| 73 | } |
| 74 | |
| 75 | public String getUpdateStrategy(){ |
| 76 | return updateStrategy; |
| 77 | } |
| 78 | |
| 79 | public LinkedList<Variable> getVariableList(){ |
| 80 | return variableList; |
| 81 | } |
| 82 | public LinkedList<Entity> getEntityList(){ |
| 83 | return entityList; |
| 84 | } |
| 85 | |
| 86 | public HashMap<String, Variable> getVariableMapper(){ |
| 87 | return variableMapper; |
| 88 | } |
| 89 | public HashMap<String, Entity> getEntityMapper(){ |
| 90 | return entityMapper; |
| 91 | } |
| 92 | |
| 93 | public String getModelFileName(){ // use this |
| 94 | return modelFile; |
| 95 | } |
| 96 | |
| 97 | public String getModelFile(){ // not this |
| 98 | return modelFile; |
| 99 | } |
| 100 | |
| 101 | public String getOutputFileName(){ // use this |
| 102 | return this.outputFile; |
| 103 | } |
| 104 | |
| 105 | public String getOutputFile(){ // not this |
| 106 | return this.outputFile; |
| 107 | } |
| 108 | |
| 109 | public String getInitialValueFile(){ |
| 110 | return this.initialValueFile; |
| 111 | } |
| 112 | |
| 113 | public String getInitialValueFileName(){ // use this |
| 114 | return this.initialValueFile; |
| 115 | } |
| 116 | |
| 117 | public String getSummaryFile(){ // not this |
| 118 | return this.summaryFile; |
| 119 | } |
| 120 | |
| 121 | public String getSummaryFileName(){ // use this |
| 122 | return this.summaryFile; |
| 123 | } |
| 124 | |
| 125 | public void setLastValuesFileName(String name){ |
| 126 | lastValuesFileName = name; |
| 127 | } |
| 128 | |
| 129 | public String getLastValuesFileName(){ |
| 130 | return this.lastValuesFileName; |
| 131 | } |
| 132 | |
| 133 | public ArrayList<Variable> getTopologicalVariableList() { |
| 134 | return topologicalVariableList; |
| 135 | } |
| 136 | |
| 137 | public String toString(){ |
| 138 | String toReturn = ""; |
| 139 | |
| 140 | toReturn += "Model summary:" + "\n"; |
| 141 | toReturn += "File name: " + modelFile + "\n"; |
| 142 | toReturn += "Iterations: " + iterations + "\n"; |
| 143 | toReturn += "Burn-in: " + burnIn + "\n"; |
| 144 | toReturn += "Thinning: " + thinning + "\n"; |
| 145 | toReturn += "Update strategy: " + updateStrategy + "\n"; |
| 146 | toReturn += "Structure: " + "\n"; |
| 147 | toReturn += "\tGlobal variables: " + "\n"; |
| 148 | |
| 149 | for (Variable var : variableList){ |
| 150 | toReturn += "\t" + var + "\n"; |
| 151 | } |
| 152 | |
| 153 | for (Entity e : entityList){ |
| 154 | toReturn += e + "\n"; |
| 155 | } |
| 156 | return toReturn; |
| 157 | } |
| 158 | } |