Top Level Namespace

Defined Under Namespace

Modules: Kernel, Rulp Classes: Array, BV, Cbc, Constraint, Expressions, Fragment, Glpk, Gurobi, IV, LV, Object, Scip, Solver

Constant Summary collapse

GLPK =
"glpsol"
SCIP =
"scip"
CBC =
"cbc"
GUROBI =
"gurobi_cl"

Instance Method Summary collapse

Instance Method Details

#choose_fileObject


1
2
3
4
5
6
7
8
9
# File 'lib/extensions/file_extensions.rb', line 1

def choose_file
  case os
  when :macosx
    command = "osascript -e 'set the_file to choose file name with prompt \"Select an output file\"' -e 'set the result to POSIX path of the_file'"
    File.absolute_path(`#{command}`.strip)
  else
    File.absolute_path(gets)
  end
end

#givenObject


71
72
73
74
75
76
77
78
79
80
# File 'lib/extensions/kernel_extensions.rb', line 71

def given
  @dummy ||= begin
   dummy =  {}
    class << dummy
      def [](*args)
      end
    end
    dummy
  end
end

#osObject


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/extensions/os_extensions.rb', line 1

def os
  @os ||= (
    require "rbconfig"
    host_os = RbConfig::CONFIG['host_os'].downcase

    case host_os
    when /linux/
      :linux
    when /darwin|mac os/
      :macosx
    when /mswin|msys|mingw32/
      :windows
    when /cygwin/
      :cygwin
    when /solaris|sunos/
      :solaris
    when /bsd/
      :bsd
    when /aix/
      :aix
    else
      raise Error, "unknown os: #{host_os.inspect}"
    end
  )
end