Solution of discrete optimal control problems via mathematical programming