This paper studies the optimal charging problem for future plug-in electric taxi (PET) with time-varying profits, i.e., time-varying service incomes and charging costs. Aiming at maximizing the average profit of a PET in long term under the constraint of state of charge (SoC) dynamics of PET battery, this problem is formulated as a constrained binary programming problem in infinite time horizon. The main contribution of this paper consists of three parts. First, because the original infinite binary programming problem cannot be directly solved, it is divided into a series of periodic subproblems. Each of the subproblems is in finite time horizon and much easier to solve, which is also proven rigorously to be equivalent to the original one. Second, an efficient and optimal algorithm is proposed to solve the finite time constrained binary programming subproblem, which also yields the optimal initial SoC of PET. Third, a transient control strategy is proposed to transfer the any initial SoC to the optimal one, if they are not identical. The performance of the proposed method is verified by numerical results.Index Terms-Binary programming, infinite time horizon, optimization, periodicity, plug-in electric taxi (PET).