All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.libs.jaicore.search.gui.plugins.rolloutboxplots.SearchRolloutBoxplotPluginModel Maven / Gradle / Ivy

package ai.libs.jaicore.search.gui.plugins.rolloutboxplots;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;

import ai.libs.jaicore.graphvisualizer.plugin.ASimpleMVCPluginModel;

/**
 *
 * @author fmohr
 *
 * @param 
 *            The node type class.
 */
public class SearchRolloutBoxplotPluginModel extends ASimpleMVCPluginModel {

	private String currentlySelectedNode = "0";
	private final Map parents = new HashMap<>();
	private final Map> listsOfKnownSuccessors = new HashMap<>();
	private final Map observedPerformances = new HashMap<>();

	public final void addEntry(final String node, final double score) {
		this.observedPerformances.computeIfAbsent(node, n -> new DescriptiveStatistics()).addValue(score);
		this.getView().update();
	}

	public Map getObservedPerformances() {
		return this.observedPerformances;
	}

	public DescriptiveStatistics getObservedPerformancesUnderSelectedNode() {
		return this.observedPerformances.get(this.currentlySelectedNode);
	}

	@Override
	public void clear() {
		this.observedPerformances.clear();
		this.getView().clear();
	}

	public void setCurrentlySelectedNode(final String currentlySelectedNode) {
		this.currentlySelectedNode = currentlySelectedNode;
		this.getView().clear();
		this.getView().update();
	}

	public String getCurrentlySelectedNode() {
		return this.currentlySelectedNode;
	}

	public Map> getListsOfKnownSuccessors() {
		return this.listsOfKnownSuccessors;
	}

	public List getListOfKnownSuccessorsOfCurrentlySelectedNode() {
		return this.listsOfKnownSuccessors.get(this.getCurrentlySelectedNode());
	}

	public Map getParents() {
		return this.parents;
	}

	public String getParentOfCurrentNode() {
		return this.parents.get(this.getCurrentlySelectedNode());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy