• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

ojdo/gams-matlab: Helper functions for coupling GAMS optimisation models with MA ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

ojdo/gams-matlab

开源软件地址(OpenSource Url):

https://github.com/ojdo/gams-matlab

开源编程语言(OpenSource Language):

MATLAB 93.9%

开源软件介绍(OpenSource Introduction):

GAMS-MATLAB

Documentation Status

This repository contains a small, but helpful collction of MATLAB functions that allow reading output, writing input and transforming data to facilitate working with GAMS models.

Dependencies

  1. MATLAB (all 201x versions should work)
  2. GAMS (must include the GDXMRW interface, providing the rgdx and wgdx functions)

Installation

  1. Put file GAMS.m anywhere into your MATLAB path, e.g. in C:\Users\%username%\Documents\MATLAB

  2. Verify that the main directory of your local GAMS installation is in the MATLAB path (e.g. C:\GAMS\win64\24.5, depending on your installed version). To test this, you can type help rgdx within MATLAB. This should yield a help message, not an error. Detail: make sure that this directory is below the line of the directory that points to the file GAMS.m. You can check this by typing help GAMS and check whether the output starts like this:

    %GAMS Interface class to call GAMS models from within Matlab
    % This class can be used for quick scenario generation and result
    % [...]

Usage

MATLAB

% read input data from any source or - for sake of an example -
% create it in MATLAB programmatically
cities = GAMS.set('cities', {'New York City' 'Los Angeles' 'Washington D.C.'})
population = GAMS.param('population', [8046 3884 659]*1e3, cities.uels);

% write both to a GDX file
GAMS.putGDX('input.gdx', cities, population);

GAMS

$gdxin input.gdx
Set   cities;
Param pop(cities);
$load cities pop
[... remaining model code ...]

MATLAB

% after running the model using 'gams model.gmx -gdx=output.gdx'
growth = GAMS.getGDX('output.gdx', 'growth');

% plot it
bar(growth.val);
ylabel('Annual population growth (%)');
xticklabels(growth.uels{1}); % matching labels automatically

% or export to a spreadsheet
GAMS.putXLS('growth.xlsx', growth)

Documentation

A pretty verbose technical documentation is hosted on ReadTheDocs, including a short syntax primer on GAMS. The three numbered folders contain accompanying code examples that range from an independent GAMS model to one that is coupled tightly to a MATLAB data handling object, providing a scaffold for one's own models.

Copyright

Copyright (C) 2011-2014, 2016 Johannes Dorfner

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap