Revision 111:11e245e6ac67

View differences:

src/main/java/cz/agents/dimaptools/landmarks/LMCutHeuristic.java
38 38
		artificialGoal = new Proposition(propositions.size()+1,-1,-1);
39 39
		artificialGoal.is_goal = true;
40 40
		artificialGoal.cost = -1;
41
		goalOperator = new UnaryOperator(operators.size()+1, -1, problem.agent);
41
		goalOperator = new UnaryOperator(operators.size()+1, -1, problem.agent,0);
42 42
		goalOperator.precondition = new LinkedList<Proposition>();
43 43
		goalOperator.effect = artificialGoal;
44 44
//		artificialGoal.reachedBy = goalOperator;
......
222 222
	private void recomputeHMax(List<UnaryOperator> cut) {
223 223
		
224 224
		for (UnaryOperator op : cut) {
225
	        int cost = op.hMaxSupporterCost + op.cost;
226 225
	        SuperState eff = problem.getAction(op.actionHash).getEffect();
227 226
	        for(int var : eff.getSetVariableNames().toArray()){
228 227
	        	Proposition p = propositions.get(var).get(eff.getValue(var));
229
	        	enqueueIfNecessary(p, cost,p.reachedBy);
228
	        	enqueueIfNecessary(p, op.cost,p.reachedBy);
230 229
	        }
231 230
	    }
232 231
		
......
243 242
	                    op.updateHMaxSupporter();
244 243
	                    int new_supp_cost = op.hMaxSupporterCost;
245 244
	                    if (new_supp_cost != old_supp_cost) {
246
	                        int target_cost = new_supp_cost + op.cost;
245
	                        int target_cost = new_supp_cost + op.base_cost;
247 246
	                        if(op.actionHash != -1){
248 247
		                        SuperState eff =  problem.getAction(op.actionHash).getEffect();
249 248
		            	        for(int var : eff.getSetVariableNames().toArray()){
src/main/java/cz/agents/dimaptools/relaxed/UnaryOperator.java
6 6

  
7 7
	public final int operatorsIndex;
8 8
	public final int actionHash;
9
	public final int base_cost = 1;
9
	public final int base_cost;
10 10

  
11 11
	public int unsatisfied_preconditions;
12 12
	public int cost = -1;
......
20 20
	public Proposition hMaxSupporter;
21 21

  
22 22

  
23
	public UnaryOperator(int operatorNo, int actionHash, String agent, int baseCost) {
24
		super();
25
		this.operatorsIndex = operatorNo;
26
		this.actionHash = actionHash;
27
		this.agent = agent;
28
		base_cost = baseCost;
29
	}
30
	
23 31
	public UnaryOperator(int operatorNo, int actionHash, String agent) {
24 32
		super();
25 33
		this.operatorsIndex = operatorNo;
26 34
		this.actionHash = actionHash;
27 35
		this.agent = agent;
36
		base_cost = 1;
28 37
	}
29 38
	
30 39
	public void setHMaxSupporter(Proposition supporter, int cost){

Also available in: Unified diff