RAMS assumes you have the solver you're using in your PATH
. The default solver is GLPK, but you can also use CLP, CBC, CPLEX,
and SCIP.
First make sure you have the latest RAMS installed.
gem install rams
Now install GLPK or whatever solver you wish.
sudo apt-get install glpk-utils
brew install glpk
You are now ready to formulate and solve models. Try running a script like this:
require 'rams'
m = RAMS::Model.new
x1 = m.variable type: :binary
x2 = m.variable type: :binary
x3 = m.variable type: :binary
m.constrain(x1 + x2 + x3 <= 2)
m.constrain(x2 + x3 <= 1)
m.sense = :max
m.objective = 1 * x1 + 2 * x2 + 3 * x3
solution = m.solve
puts <<-HERE
objective: #{solution.objective}
x1 = #{solution[x1]}
x2 = #{solution[x2]}
x3 = #{solution[x3]}
HERE
You should get output along the lines of the following:
objective: 4.0
x1 = 1.0
x2 = 0.0
x3 = 1.0
More examples are available here. Happy modeling!