RangedIK: An Optimization-based Robot Motion Generation Method for Ranged-Goal Tasks