Revision 172:26381e5d7f88

View differences:

src/main/java/cz/agents/dimaptools/input/sas/SASPreprocessor.java
90 90
		this.sas = sas;
91 91
		treatGoalAsPublic = config.getBoolean("treatGoalAsPublic", true);
92 92

  
93
//		LOGGER.setLevel(Level.DEBUG);
93
//		LOGGER.setLevel(Level.INFO);
94 94

  
95 95
		LinkedList<String> agents = new LinkedList<String>(addl.getAgentList());
96 96

  
......
155 155

  
156 156
										addVarValToAgent(PUBLIC, f.var, f.val);
157 157

  
158
										if(LOGGER.isDebugEnabled())LOGGER.info("public: " + f.var + "-" + f.val);
158
										if(LOGGER.isDebugEnabled())LOGGER.info("public(goal): " + f.var + "-" + f.val);
159 159

  
160 160
										if(op1.containsFact(f)){
161 161
											op1.isPublic = true;
......
174 174
									op1.isPublic = true;
175 175
									op2.isPublic = true;
176 176

  
177
									if(LOGGER.isDebugEnabled())LOGGER.info("public: " + f.var + "-" + f.val);
177
									if(LOGGER.isDebugEnabled()){
178
										LOGGER.info("public: " + f.var + "-" + f.val);
179
										LOGGER.info("	on operators: " + op1.label + " and " + op2.label);
180
									}
178 181
								}else{
179 182
									if(op1.containsFact(f)){
180 183
										addVarValToAgent(a1, f.var, f.val);
......
209 212
		// add values which are in init and not in operators (as public)
210 213
		for (String var : sas.init.keySet()) {
211 214
			boolean missingVal = true;
215
			String owner = null;
212 216
			String val = sas.init.get(var);
213 217

  
214 218
			for(String agent : agentVarVals.keySet()){
215 219
				Map<String,Set<String>> varValMap = agentVarVals.get(agent);
216
				if(varValMap.containsKey(var) && varValMap.get(var).contains(val)){
217
					missingVal = false;
218
					break;
220
				if(varValMap.containsKey(var)){
221
					if(varValMap.get(var).contains(val)){
222
						missingVal = false;
223
						break;
224
					}else{
225
						if(owner==null){
226
							owner = agent;
227
							missingVal = false;
228
						}else{
229
							missingVal = false;
230
							break;
231
						}
232
					}
219 233
				}
220 234
			}
221 235

  
222 236
			if (missingVal) {
223 237
				addVarValToAgent(PUBLIC, var, val);
238
			}else{
239
				if(owner!=null){
240
					addVarValToAgent(owner, var, val);
241
				}
224 242
			}
225 243
		}
226 244

  

Also available in: Unified diff