@Test public void testSavage() { logger.info("savage"); DataTable2D payoffMatrix = generatePayoffMatrix(); Map.Entry<Object, Object> expResult = new AbstractMap.SimpleEntry<>("A2", -400.0); Map.Entry<Object, Object> result = DecisionCriteria.savage(payoffMatrix); assertEquals(expResult, result); }
public static Map.Entry<Object, Object> savage(DataTable2D payoffMatrix) { if(payoffMatrix.isValid()==false) { throw new IllegalArgumentException("The payoff matrix does not have a rectangular format."); } DataTable2D regretMatrix = new DataTable2D(); for(Map.Entry<Object, AssociativeArray> entry : payoffMatrix.entrySet()) { Object event = entry.getKey(); AssociativeArray optionList = entry.getValue(); double maxI = Descriptives.max(optionList.toFlatDataCollection()); for(Map.Entry<Object, Object> entry2 : optionList.entrySet()) { Object option = entry2.getKey(); Double payoff = TypeInference.toDouble(entry2.getValue()); regretMatrix.put2d(event, option, payoff-maxI); } } return maxMin(regretMatrix); }
DecisionCriteria { public static Map.Entry<Object, Object> savage(DataTable2D payoffMatrix) { if(payoffMatrix.isValid()==false) { throw new IllegalArgumentException("The payoff matrix does not have a rectangular format."); } DataTable2D regretMatrix = new DataTable2D(); for(Map.Entry<Object, AssociativeArray> entry : payoffMatrix.entrySet()) { Object event = entry.getKey(); AssociativeArray optionList = entry.getValue(); double maxI = Descriptives.max(optionList.toFlatDataCollection()); for(Map.Entry<Object, Object> entry2 : optionList.entrySet()) { Object option = entry2.getKey(); Double payoff = TypeInference.toDouble(entry2.getValue()); regretMatrix.put2d(event, option, payoff-maxI); } } return maxMin(regretMatrix); } }
DecisionCriteria { public static Map.Entry<Object, Object> savage(DataTable2D payoffMatrix) { if(payoffMatrix.isValid()==false) { throw new IllegalArgumentException("The payoff matrix does not have a rectangular format."); } DataTable2D regretMatrix = new DataTable2D(); for(Map.Entry<Object, AssociativeArray> entry : payoffMatrix.entrySet()) { Object event = entry.getKey(); AssociativeArray optionList = entry.getValue(); double maxI = Descriptives.max(optionList.toFlatDataCollection()); for(Map.Entry<Object, Object> entry2 : optionList.entrySet()) { Object option = entry2.getKey(); Double payoff = TypeInference.toDouble(entry2.getValue()); regretMatrix.put2d(event, option, payoff-maxI); } } return maxMin(regretMatrix); }  }
DecisionCriteria { public static Map.Entry<Object, Object> savage(DataTable2D payoffMatrix) { if(payoffMatrix.isValid()==false) { throw new IllegalArgumentException("The payoff matrix does not have a rectangular format."); } DataTable2D regretMatrix = new DataTable2D(); for(Map.Entry<Object, AssociativeArray> entry : payoffMatrix.entrySet()) { Object event = entry.getKey(); AssociativeArray optionList = entry.getValue(); double maxI = Descriptives.max(optionList.toFlatDataCollection()); for(Map.Entry<Object, Object> entry2 : optionList.entrySet()) { Object option = entry2.getKey(); Double payoff = TypeInference.toDouble(entry2.getValue()); regretMatrix.put2d(event, option, payoff-maxI); } } return maxMin(regretMatrix); }  static Map.Entry<Object, Object> maxMin(DataTable2D payoffMatrix); static Map.Entry<Object, Object> maxMax(DataTable2D payoffMatrix); static Map.Entry<Object, Object> savage(DataTable2D payoffMatrix); static Map.Entry<Object, Object> laplace(DataTable2D payoffMatrix); static Map.Entry<Object, Object> hurwiczAlpha(DataTable2D payoffMatrix, double alpha); static Map.Entry<Object, Object> maximumLikelihood(DataTable2D payoffMatrix, AssociativeArray eventProbabilities); static Map.Entry<Object, Object> bayes(DataTable2D payoffMatrix, AssociativeArray eventProbabilities); }
DecisionCriteria { public static Map.Entry<Object, Object> savage(DataTable2D payoffMatrix) { if(payoffMatrix.isValid()==false) { throw new IllegalArgumentException("The payoff matrix does not have a rectangular format."); } DataTable2D regretMatrix = new DataTable2D(); for(Map.Entry<Object, AssociativeArray> entry : payoffMatrix.entrySet()) { Object event = entry.getKey(); AssociativeArray optionList = entry.getValue(); double maxI = Descriptives.max(optionList.toFlatDataCollection()); for(Map.Entry<Object, Object> entry2 : optionList.entrySet()) { Object option = entry2.getKey(); Double payoff = TypeInference.toDouble(entry2.getValue()); regretMatrix.put2d(event, option, payoff-maxI); } } return maxMin(regretMatrix); }  static Map.Entry<Object, Object> maxMin(DataTable2D payoffMatrix); static Map.Entry<Object, Object> maxMax(DataTable2D payoffMatrix); static Map.Entry<Object, Object> savage(DataTable2D payoffMatrix); static Map.Entry<Object, Object> laplace(DataTable2D payoffMatrix); static Map.Entry<Object, Object> hurwiczAlpha(DataTable2D payoffMatrix, double alpha); static Map.Entry<Object, Object> maximumLikelihood(DataTable2D payoffMatrix, AssociativeArray eventProbabilities); static Map.Entry<Object, Object> bayes(DataTable2D payoffMatrix, AssociativeArray eventProbabilities);  }