How to choose the weights for a linear combination of heuristic functions?

I need to write a minimax algorithm with alpha-beta pruning in limited time for the 2048 game. I know expectimax is better for this work.

Assume I wrote different heuristic functions. If I want to write an evaluation function as a linear combination of these heuristic functions, do I have to give random weights, or can I calculate the optimal weights with some optimization algorithm?

• What do you mean by "for good enough" in "can I calculate these weights for enough good with some algorithm?"?
– nbro
Oct 17 '19 at 14:15
• I meant for a linear combination like evaluation(s) = x1.f1(s) + x2.f2(s). Assume I choose x1 and x2 as 1 and 5. And with this weights my algorithm's succes chance is %50 and if I increase value of x1 algorithm's chance will increase. What if I have 20 weight? Is there a algorithm gonna find approximate weight? I heard a algorithm called CMA-ES. I'll look at it. Oct 17 '19 at 15:34
• Well, take a look at this duuh. Oct 17 '19 at 20:08