optim patterns