
aima.core.environment.connectfour.ActionValuePair Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aima-core Show documentation
Show all versions of aima-core Show documentation
AIMA-Java Core Algorithms from the book Artificial Intelligence a Modern Approach 3rd Ed.
package aima.core.environment.connectfour;
/**
* Helper class for action ordering.
* @author Ruediger Lunde
*/
public class ActionValuePair implements Comparable> {
private ACTION action;
private double value;
public static ActionValuePair createFor(ACTION action, double utility) {
return new ActionValuePair(action, utility);
}
public ActionValuePair(ACTION action, double utility) {
this.action = action;
this.value = utility;
}
public ACTION getAction() {
return action;
}
public double getValue() {
return value;
}
@Override
public int compareTo(ActionValuePair pair) {
if (value < pair.value)
return 1;
else if (value > pair.value)
return -1;
else
return 0;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy