There is no generalised algorithm as that page (and others on this problem such as
this one and
this one) hint at.
If you can't use the already-generated solutions on those pages you are going to need to build some method of spanning possible combinations either with brute force or some evaluation/backtracking algorithm.