Given a model based on a conservation law, we study how the solution
depends from the initial/boundary datum, from the flow and from
various constraints. With this tool, several control problems can be
addressed and the existence of an optimal control can be
proved. Models describing escape dynamics of pedestrians, traffic at
toll gates, open canals management and fluid flow in gas pipelines
fall within this framework. In particular, a necessary condition for
optimality is obtained, which applies to a supply chain model.