Text this: Optimization Framework and Parameter Determination for Proximity-Based Device Discovery in D2D Communication Systems