public  double evaluateMod(NodeArgument[] params, HashMap<NodeVariable, MessageQ> modifierTable)
    {
        if (modifierTable.isEmpty()){
            return this.evaluate(params);
        }
        if(debug>=3){
            System.out.println("Table non empty, there are "+modifierTable.keySet().size()+" keys");

            Iterator<NodeVariable> itv = modifierTable.keySet().iterator();
            while (itv.hasNext()) {
                NodeVariable nodeVariable = itv.next();
                System.out.println("Key: "+nodeVariable+" Value: "+modifierTable.get(nodeVariable));
            }
        }
        double cost = this.evaluate(params);
        //System.out.println("EvaluateMod");
        /*for (int i = 0; i < 3; i++) {
            System.out.print(params[i].getValue()+ " ");           
        }
        System.out.println();*/
        // seems to work
        Iterator<Entry<NodeVariable, MessageQ>> it = modifierTable.entrySet().iterator();
                //modifierTable.keySet().iterator();
        NodeVariable nodeVariable = null;
        int indexOfModifier = -15;
        while (it.hasNext()){
            nodeVariable = it.next().getKey();
            if(debug>=3){
                System.out.println("NodeVariable is "+nodeVariable);
            }

            try {

                indexOfModifier = nodeVariable.numberOfArgument(params[this.getParameterPosition(nodeVariable)]);
                //System.out.println(modifierTable.get(nodeVariable).getValue(indexOfModifier));
                cost += modifierTable.get(nodeVariable).getValue(indexOfModifier);

            } catch (ParameterNotFoundException ex) {
                // do nothing?
            }

        }
        return cost;
    }