Ludii Forum
ai trainedHeuristics - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Questions (https://ludii.games/forums/forumdisplay.php?fid=13)
+--- Forum: About the Ludii Grammar (https://ludii.games/forums/forumdisplay.php?fid=15)
+--- Thread: ai trainedHeuristics (/showthread.php?tid=1105)



ai trainedHeuristics - noobby - 07-28-2022

In the LanguageReference is stated that if in the (ai ) ludeme a bestAgent is specified, 'this algorithm will be used when the “Ludii AI” option is selected'. ok.
So when I use bestAgent 'Alpha-Beta' with trainedHeuristics ( influence ) then the 'Ludii AI' will have built in ('trained') this style of play already, is that right ?

Code:
    (ai (bestAgent "Alpha-Beta")
         trainedHeuristics:(heuristics {(influence)})
     )

But what happenes if I choose 'Alpha-Beta' for the second player too?
 Will P2 perform an unbiased alphabeta-search or will it also use the heuristics stated in the ai-bestAgent-ludeme ? 

My goal would be to test games with Alpha-Beta:  heuristics (influence) or (material) against  Alpha-Beta without heuristics .  Is this possible ?
 (to see which one performs better in a series of games.)         

I tried to figure this out watching games of Chess (combining the above heuristics with the important pieceWeights seemed to work)
or English Draughts, but it was not clear if the heuristics had any effect to the style of play.


RE: ai trainedHeuristics - DennisSoemers - 07-29-2022

Alpha-Beta agents selected directly using that name in our dropdown menus will always use any heuristics that are specified in the way you described in the metadata of a game's .lud file. So no, through that mechanism you can't test different AlphaBeta agents with different heuristics against each other since they'll both be taking the heuristics from the game's metadata.

However, as of the latest release (or maybe also already the one before that, can't remember), all the way at the bottom of the dropdown menu for selecting AIs we also have an option labelled "From AI.DEF". After selecting this, you will be prompted with a filechooser to select a file describing (again in the metadata format as documented in Chapter 19 of the Ludii Language Reference) a complete agent, including things like heuristics, for that specific player. This should be a standalone *_ai.def file that only contains an (ai ...) entry, and nothing else.

So, you could for example write two such files, where the first file looks like this:

Code:
(ai
    (alphaBeta (heuristics (influence)))
)


And the second file looks like this:

Code:
(ai
    (alphaBeta (heuristics (nullHeuristic)))
)

And then you can select each of those files once. Then you'll have two different agents that are both using the Alpha-Beta search algorithm, but with different heuristics each.


RE: ai trainedHeuristics - noobby - 07-29-2022

perfect answer, thx !  This looks very good.