Completely new and optimized algorithm for smart positioning based on preference arrays