Similar Items: Automata-Theoretic Framework for Modeling and Optimizing Library Resource Allocation