Abstract This paper introduces a computational approach for solving non-linear optimal control problems in which the objective function is a discontinuous function of the state. We illustrate this approach using a dynamic model of shrimp farming in which shrimp are harvested at several intermediate times during the production cycle. The problem is to choose the optimal harvesting times and corresponding optimal harvesting fractions (the percentage of shrimp stock extracted) to maximize total revenue. The main difficulty with this problem is that the selling price of shrimp is modelled as a piecewise constant function of the average shrimp weight and thus the revenue function is discontinuous. By performing a time-scaling transformation and introducing a set of auxiliary binary variables, we convert the shrimp harvesting problem into an equivalent optimization problem that has a smooth objective function. We then use an exact penalty method to solve this equivalent problem. We conclude the paper with a numerical example.