Optimization of the use of natural resources by agriculture and forestry