There is a rough dosing calculator on the Lantus website.
Unlikely that there will be an algorithm that takes into account your personal level of insulin resistance and how well metformin works on your liver.
I've just finished 5 weeks of Lantus (@80 units a day) that didn't bring my sugars to single digits, (along with metformin, gliclazide and sitagliptan).
In the same 5 weeks I put on 10kg, mainly around the belly and it is so taught from bloating you'd swear I was pregnant!
Just saying, the Lantus website suggested 23 units as my max dose, but even 80 units wasn't enough, and at that level of Lantus, the lbs piled on!