Parameters

GamsStructure.ParameterType
Parameter(GU,domain::Tuple{Vararg{Symbol}};description::String="") = new{Float64,length(domain)}(GU,domain,Dict{Any,Float64}(),description)

Container to hold parameters. Highly recommended to create using the @parameter macro.

Parameters can be indexed either by set name

P[:set1,:set2]

or by list of element names

P[[:element1,:element2],[:e1,:e2]]

or a mix of both

P[:set1,:e1]

Order of precedence is set then element, so if you have an element with the same symbol as the set name, there will be a conflict. You can either wrap the element name in a vector or avoid this.

source
GamsStructure.@parameterMacro
@parameter(GU, name, domain, kwargs...)

Create a parameter in the universe. Also puts the name in the local namespace.

@parameter(GU, p, (:I,:J), description = "this is p")

This assumes both I and J are sets already in GU. The description is an optional (but recommended) argument.

source
GamsStructure.@parametersMacro
@parameters(model, block)

Plural version of @parameter.

@parameters(GU, begin
    p, (:i,:j), (description = "This is p",)
    t, :i

This create two parameters, p and t. p will have a description.

source
GamsStructure.load_parameterMethod
load_parameter(GU::GamsUniverse,
               path_to_parameter::String,
               domain::Tuple{Vararg{Symbol}};
               description::String = "",
               columns::Union{Vector{Int},Missing} = missing,
               value_name = :value
               )

Load and return a parameter from a CSV file.

GU - Parent universe. The parameter will not be added to the universe

path_to_parameter - Where the parameter lives

domain - A tuple of the names of the domain sets

description - A description of the parameter. Defaults to empty string

columns - If the names in the CSV don't match the set names, use this to specify which columns correspond to the sets.

value_name - The name of the column where the values live. Can also be an integer.

This function requires a specific format of CSV file:

set_1set_2value
.........

By default, the function expects the columns names in the CSV to match the set names, however, this can be modified using the columns parameter.

source
GamsStructure.load_parameter!Method
load_parameter!(GU::GamsUniverse,
                path_to_parameter::String,
                name::Symbol,
                domain::Tuple{Vararg{Symbol}};
                description::String = "",
                columns::Union{Vector{Int},Missing} = missing,
                value_name = :value
                )

Identical to load_parameter except it includes the parameter in GU.

source