當前位置: 首頁>>代碼示例>>Java>>正文


Java CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy方法代碼示例

本文整理匯總了Java中burlap.behavior.stochasticgames.solvers.CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy方法的典型用法代碼示例。如果您正苦於以下問題:Java CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy方法的具體用法?Java CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy怎麽用?Java CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在burlap.behavior.stochasticgames.solvers.CorrelatedEquilibriumSolver的用法示例。


在下文中一共展示了CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: computeColStrategy

import burlap.behavior.stochasticgames.solvers.CorrelatedEquilibriumSolver; //導入方法依賴的package包/類
@Override
public double[] computeColStrategy(double[][] rowPayoff,
		double[][] colPayoff) {
	
	double [][] jointStrategy;
	if(this.objective != CorrelatedEquilibriumObjective.LIBERTARIAN){
		jointStrategy = CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy(this.objective, rowPayoff, colPayoff);
		return GeneralBimatrixSolverTools.marginalizeColPlayerStrategy(jointStrategy);
	}
	else{
		//libertarian assumes row player request, so transpose matrices
		jointStrategy = CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy(this.objective, 
				GeneralBimatrixSolverTools.transposeMatrix(rowPayoff), GeneralBimatrixSolverTools.transposeMatrix(colPayoff));
		
		//return row since we transposed players
		return GeneralBimatrixSolverTools.marginalizeRowPlayerStrategy(jointStrategy);
	}
	
	
}
 
開發者ID:jmacglashan,項目名稱:burlap,代碼行數:21,代碼來源:CorrelatedEquilibrium.java

示例2: computeRowStrategy

import burlap.behavior.stochasticgames.solvers.CorrelatedEquilibriumSolver; //導入方法依賴的package包/類
@Override
public double[] computeRowStrategy(double[][] rowPayoff,
		double[][] colPayoff) {
	
	double [][] jointStrategy = CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy(this.objective, rowPayoff, colPayoff);
	return GeneralBimatrixSolverTools.marginalizeRowPlayerStrategy(jointStrategy);

}
 
開發者ID:jmacglashan,項目名稱:burlap,代碼行數:9,代碼來源:CorrelatedEquilibrium.java

示例3: performBackup

import burlap.behavior.stochasticgames.solvers.CorrelatedEquilibriumSolver; //導入方法依賴的package包/類
@Override
public double performBackup(State s, String forAgent,
		Map<String, SGAgentType> agentDefinitions, AgentQSourceMap qSourceMap) {
	
	if(agentDefinitions.size() != 2){
		throw new RuntimeException("Correlated Q only defined for two agents.");
	}
	
	String otherAgentName = null;
	for(String aname : agentDefinitions.keySet()){
		if(!aname.equals(forAgent)){
			otherAgentName = aname;
			break;
		}
	}
	
	
	QSourceForSingleAgent forAgentQSource = qSourceMap.agentQSource(forAgent);
	QSourceForSingleAgent otherAgentQSource = qSourceMap.agentQSource(otherAgentName);
	
	List<GroundedSGAgentAction> forAgentGSAs = SGAgentAction.getAllApplicableGroundedActionsFromActionList(s, forAgent, agentDefinitions.get(forAgent).actions);
	List<GroundedSGAgentAction> otherAgentGSAs = SGAgentAction.getAllApplicableGroundedActionsFromActionList(s, otherAgentName, agentDefinitions.get(otherAgentName).actions);
	
	double [][] forPlayerPaoyff = new double[forAgentGSAs.size()][otherAgentGSAs.size()];
	double [][] otherPlayerPaoyff = new double[forAgentGSAs.size()][otherAgentGSAs.size()];
	
	
	for(int i = 0; i < forAgentGSAs.size(); i++){
		for(int j = 0; j < otherAgentGSAs.size(); j++){
			JointAction ja = new JointAction();
			ja.addAction(forAgentGSAs.get(i));
			ja.addAction(otherAgentGSAs.get(j));
			
			double q1 = forAgentQSource.getQValueFor(s, ja).q;
			double q2 = otherAgentQSource.getQValueFor(s, ja).q;
			
			forPlayerPaoyff[i][j] = q1;
			otherPlayerPaoyff[i][j] = q2;
			
		}
	}
	
	double [][] jointActionProbs = CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy(this.objectiveType, forPlayerPaoyff, otherPlayerPaoyff);
	double [] expectedValue = GeneralBimatrixSolverTools.expectedPayoffs(forPlayerPaoyff, otherPlayerPaoyff, jointActionProbs);
	
	
	return expectedValue[0];
}
 
開發者ID:f-leno,項目名稱:DOO-Q_BRACIS2016,代碼行數:49,代碼來源:CorrelatedQ.java

示例4: performBackup

import burlap.behavior.stochasticgames.solvers.CorrelatedEquilibriumSolver; //導入方法依賴的package包/類
@Override
public double performBackup(State s, int forAgent, List<SGAgentType> agentDefinitions, AgentQSourceMap qSourceMap) {

	if(agentDefinitions.size() != 2){
		throw new RuntimeException("CoCoQ only defined for two agents.");
	}

	int otherAgent = forAgent == 0 ? 1 : 0;
	QSourceForSingleAgent forAgentQSource = qSourceMap.agentQSource(forAgent);
	QSourceForSingleAgent otherAgentQSource = qSourceMap.agentQSource(otherAgent);

	List<Action> forAgentGSAs = ActionUtils.allApplicableActionsForTypes(agentDefinitions.get(forAgent).actions, s);
	List<Action> otherAgentGSAs = ActionUtils.allApplicableActionsForTypes(agentDefinitions.get(otherAgent).actions, s);

	double [][] forPlayerPaoyff = new double[forAgentGSAs.size()][otherAgentGSAs.size()];
	double [][] otherPlayerPaoyff = new double[forAgentGSAs.size()][otherAgentGSAs.size()];


	for(int i = 0; i < forAgentGSAs.size(); i++){
		for(int j = 0; j < otherAgentGSAs.size(); j++){
			JointAction ja = new JointAction();
			ja.setAction(forAgent, forAgentGSAs.get(i));
			ja.setAction(otherAgent, otherAgentGSAs.get(j));

			double q1 = forAgentQSource.getQValueFor(s, ja).q;
			double q2 = otherAgentQSource.getQValueFor(s, ja).q;

			forPlayerPaoyff[i][j] = q1;
			otherPlayerPaoyff[i][j] = q2;

		}
	}

	double [][] jointActionProbs = CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy(this.objectiveType, forPlayerPaoyff, otherPlayerPaoyff);
	double [] expectedValue = GeneralBimatrixSolverTools.expectedPayoffs(forPlayerPaoyff, otherPlayerPaoyff, jointActionProbs);


	return expectedValue[0];

}
 
開發者ID:jmacglashan,項目名稱:burlap,代碼行數:41,代碼來源:CorrelatedQ.java


注:本文中的burlap.behavior.stochasticgames.solvers.CorrelatedEquilibriumSolver.getCorrelatedEQJointStrategy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。