本文整理汇总了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);
}
}
示例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);
}
示例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];
}
示例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];
}