def save_solution
      status = gurobi_status

      if status == :optimized
        objective_value = gurobi_objective
        variable_values = @variables.map do |var|
          dblptr = FFI::MemoryPointer.new :pointer
          Gurobi.GRBgetdblattrarray @ptr, Gurobi::GRB_DBL_ATTR_X,
                                    var.index, 1, dblptr
          dblptr.read_array_of_double(1)[0]
        end
      else
        objective_value = nil
        variable_values = []
      end

      @solution = Solution.new status, objective_value, variable_values
    end
def save_solution
      status = gurobi_status

      if status == :optimized
        objective_value = gurobi_objective
        variable_values = @variables.map do |var|
          dblptr = FFI::MemoryPointer.new :pointer
          Gurobi.GRBgetdblattrarray @ptr, Gurobi::GRB_DBL_ATTR_X,
                                    var.index, 1, dblptr
          dblptr.read_array_of_double(1)[0]
        end
      else
        objective_value = nil
        variable_values = []
      end

      @solution = Solution.new status, objective_value, variable_values
    end
Save the solution to the model for access later