A general framework for crankshaft balancing and counterweight design