title: Python Pyomo: Variables domain error in Pyomo
body: <p>I want to solve an integer programming problem in which the decision variables are restricted in a specific set. </p>
  
  <p>For example, decision variables xi must be chosen in [2,5,7,10].</p>
  
  <p>For testing, I wrote the python code using Pyomo as follows:</p>
  
  <pre><code>from pyomo.environ import *
  model = AbstractModel()
  model.X = Set(initialize=[2, 5, 7, 10])
  model.x = Var(within=model.X)
  model.obj = Objective(expr=model.x+1)
  m = model.create_instance()
  opt = SolverFactory("glpk")
  results = opt.solve(m)
  </code></pre>
  
  <p>When these codes are executed, I got an error message: 
  "TypeError: Invalid domain type for variable with name 'x'. Variable is not continuous, integer, or binary" </p>
  
  <p>Here are my questions:</p>
  
  <ul>
  <li>What is the reason of this error?</li>
  <li>How to deal with it? </li>
  <li>Is there any other optimization tools that can handle this type of problems?</li>
  </ul>
  
  <p>Thanks for helping!</p>