Optimal investments for risk- and ambiguity-averse preferences: a duality approach