数理コンサルタントの備忘録

あなたの悩みを数理で解決する

GAMS事始め

授業でGAMSを使うことになったので, macに実装環境を整える方法を記載する. まずはホームページでmacOSのGAMSをインストール.

GAMS - Download

インストールが完了したら, アプリケーションに入れる. ライセンスファイルgamslice.txtを/Applications/GAMS24.8/sysdirに保存する.

.bash_proflie以下のPATHを通す

#GAMS
export PATH=$PATH:"/Applications/GAMS24.8/GAMS Terminal.app/../sysdir"

PATHが上手く通っているか以下のコマンドを打つことで確認する.

gamslib trnsport
gams trnsport

出力結果が以下のように表示されれば上手くいっている.

--- Job trnsport Start 06/26/14 11:24:56 24.3.1 r46409 DEX-DEG Mac x86_64/Darwin
GAMS 24.3.1   Copyright (C) 1987-2014 GAMS Development. All rights reserved
Licensee: ...
--- Starting compilation
--- trnsport.gms(69) 3 Mb
--- Starting execution: elapsed 0:00:00.024
--- trnsport.gms(45) 4 Mb
--- Generating LP model transport
--- trnsport.gms(66) 4 Mb
---   6 rows  7 columns  19 non-zeroes
--- Executing CPLEX: elapsed 0:00:00.114

IBM ILOG CPLEX   24.3.1 ... DEG Mac x86_64/Darwin    
Cplex 12.6.0.0

Reading data...
Starting Cplex...
Space for names approximately 0.00 Mb
Use option 'names no' to turn use of names off
Tried aggregator 1 time.
LP Presolve eliminated 1 rows and 1 columns.
Reduced LP has 5 rows, 6 columns, and 12 nonzeros.
Presolve time = 0.02 sec. (0.00 ticks)

Iteration      Dual Objective            In Variable           Out Variable
     1              73.125000    x(seattle.new-york) demand(new-york) slack
     2             119.025000     x(seattle.chicago)  demand(chicago) slack
     3             153.675000    x(san-diego.topeka)   demand(topeka) slack
     4             153.675000  x(san-diego.new-york)  supply(seattle) slack
LP status(1): optimal
Cplex Time: 0.03sec (det. 0.01 ticks)

Optimal solution found.
Objective :         153.675000

--- Restarting execution
--- trnsport.gms(66) 2 Mb
--- Reading solution for model transport
--- trnsport.gms(68) 3 Mb
*** Status: Normal completion
--- Job trnsport.gms Stop 06/26/14 11:24:57 elapsed 0:00:00.487