Photo Layout with a Fast Evaluation Method and Genetic Algorithm by Jian Fan describes a genetic algorithm for making collage layouts which perfectly fits our needs.
However, in order to actually implement the algorithm, we need to take care of some other stuff first.
III.B and III.C might need to be slightly changed. The original algorithm treats the resulting canvas size as the input, whereas we don't know the size upfront and just want to optimize for the biggest one. Perhaps the cost function will need to control the trade-off between canvas size and coverage of canvas area by images.
Photo Layout with a Fast Evaluation Method and Genetic Algorithm by Jian Fan describes a genetic algorithm for making collage layouts which perfectly fits our needs.
However, in order to actually implement the algorithm, we need to take care of some other stuff first.
--target webrather than--target no-modules.--target web.--target weband no bundler, we have to use module-workers-polyfill as described in wasm-bindgen-rayon readme.III.B and III.C might need to be slightly changed. The original algorithm treats the resulting canvas size as the input, whereas we don't know the size upfront and just want to optimize for the biggest one. Perhaps the cost function will need to control the trade-off between canvas size and coverage of canvas area by images.