solver algorithm