Artificial intelligence to run the chemical factories of the future