Existence theorems for optimal control problems in hereditary structures