>>14293329>shouldn't evolution optimizeThis is actually a pretty interesting question, and there's a prof at my uni who is an expert on that particular topic. There's really a lot to say about it, both in terms of empirical biology, and mathematical models of replication. Basically, however, evolution is not an optimization process, and the results in generate will not necessarily be optimal. In fact, there are cases where an organism can evolve into a sub-optimal position that it can't evolve out of - mathematically speaking this would correspond to some sort of local extrema. See the attached graph.
In mathematical biology, we often use graphs to represent what we call a "Fitness landscape", which is basically just a structured set of possible genotypes that could arise in a population, along with their associated fitness values. In evolutionary terms, if you get stuck in a local extrema, that means that your have some sort of genotype (or phenotype) that is suboptimal, but you can't evolve away from that genotype, so to speak, because it's still locally optimal, meaning that, whichever direction you move in, you will always be making yourself worse off in the short term before you actually reach a more optimal position. E.g. in the attached graph, if you find yourself local minimum, and your goal is to minimize that value of this function, you will not be able to reach the optimal point, i.e. the global minimum, because it order to do so, it requires you to first pass through regions where the function is increasing, which is the opposite of what you are trying to do.
We see this all the time in biological systems, which is one reason (amongst others), that evolution should not really be viewed as some sort of optimization process.