Portfolio manager and optimizer