public static Map . Entry < Object , Object > maxMax ( DataTable2D payoffMatrix ) { if ( payoffMatrix . isValid ( ) == false ) { throw new IllegalArgumentException ( "The payoff matrix does not have a rectangular format." ) ; } Double maxMaxPayoff = Double . NEGATIVE_INFINITY ; Object maxMaxPayoffOption = null ; for ( Map . Entry < Object , AssociativeArray > entry : payoffMatrix . entrySet ( ) ) { //Object event = entry.getKey(); AssociativeArray optionList = entry . getValue ( ) ; for ( Map . Entry < Object , Object > entry2 : optionList . entrySet ( ) ) { Double payoff = TypeInference . toDouble ( entry2 . getValue ( ) ) ; //Object option = entry2.getKey(); if ( payoff > maxMaxPayoff ) { maxMaxPayoff = payoff ; maxMaxPayoffOption = entry2 . getKey ( ) ; } } } return new AbstractMap . SimpleEntry <> ( maxMaxPayoffOption , maxMaxPayoff ) ; }
Returns the best option and the payoff under maxMax strategy