Model of the Optimal Development of a Plant Taking Into Account Defence and Competition