  Although optimal control (OC) has been studied in stochastic thermodynamics
for systems with continuous state variables, less is known in systems with
discrete state variables, such as Chemical Reaction Networks (CRNs). Here, we
develop a general theoretical framework to study OC of CRNs for changing the
system from an initial distribution of states to a final distribution with
minimum dissipation. We derive a ``Kirchhoff's law" for the probability current
in the adiabatic limit, from which the optimal kinetic rates are determined
analytically for any given probability trajectory. By using the optimal rates,
we show that the total dissipation is determined by a $L_2$-distance measure in
the probability space and derive an analytical expression for the metric tensor
that depends on the probability distribution, network topology, and capacity of
each link. Minimizing the total dissipation leads to the geodesic trajectory in
the probability space and the corresponding OC protocol is determined by the
Kirchhoff's law. To demonstrate our general approach, we use it to find a lower
bound for the minimum dissipation that is tighter than existing bounds obtained
with only global constraints. We also apply it to simple networks, e.g., fully
connected 3-state CRNs with different local constraints and show that indirect
pathway and non-functional transient state can play a crucial role in switching
between different probability distributions efficiently. Future directions in
studying OC in CRNs by using our general framework are discussed.
