US President Barack Obama has attempted to paint an optimistic vision of the future during his final State of the Union address.