我在GAMS中编写了一个调度模型,通过最小化系统成本进行优化。我想循环模型的运行;运行优化,保存输出,改变单个参数(storageCap) - 每次迭代增加一小部分,然后再次运行模型。 GDXRRW似乎无法在R v.3.3.1上运行 - “你头发中的虫子”。
答案 0 :(得分:0)
你确定gdxrrw
没有使用R 3.3.1吗?它肯定适合我:
(1)使用安装gdxxrw
install.packages("C:\\GAMS\\win64\\24.7\\gdxrrw\\win3264\\gdxrrw_1.0.0.zip",repos=NULL)
(2)使用GAMS脚本,如:
set i /i1*i10/;
parameter p(i);
p(i) = uniform(0,1);
display p;
execute_unload "p.gdx",p;
execute '"c:\program files\R\R-3.3.1\bin\Rscript.exe" p.R';
$onecho > p.R
R.version
library(gdxrrw)
p<-rgdx.param("p.gdx","p");
p
$offecho
你会看到类似的东西:
--- Job Untitled_56.gms Start 08/18/16 15:29:58 24.6.1 r55820 WEX-WEI x86 64bit/MS Windows
GAMS 24.6.1 Copyright (C) 1987-2016 GAMS Development. All rights reserved
Licensee: Erwin Kalvelagen G150803/0001CV-GEN
Amsterdam Optimization Modeling Group DC10455
--- Starting compilation
--- Untitled_56.gms(17) 3 Mb
--- Starting execution: elapsed 0:00:00.013
--- Untitled_56.gms(5) 4 Mb
--- GDX File C:\tmp\p.gdx
--- Untitled_56.gms(6) 4 Mb
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 3.1
year 2016
month 06
day 21
svn rev 70800
language R
version.string R version 3.3.1 (2016-06-21)
nickname Bug in Your Hair
i p
1 i1 0.17174713
2 i2 0.84326671
3 i3 0.55037536
4 i4 0.30113790
5 i5 0.29221212
6 i6 0.22405287
7 i7 0.34983050
8 i8 0.85627035
9 i9 0.06711372
10 i10 0.50021067
*** Status: Normal completion
--- Job Untitled_56.gms Stop 08/18/16 15:29:59 elapsed 0:00:00.907