`for x in problem.variables` should probably iterate over the variables themselves rather than the variable names.