Loading...
Searching...
No Matches

GAMS Variable. More...

Inheritance diagram for Variable:
Symbol

GAMS Variable.

Example:

c = Container();
v1 = Variable(c, 'v1');
v2 = Variable(c, 'v2', 'binary', {'*', '*'});
v3 = Variable(c, 'v3', VariableType.BINARY, '*', 'description', 'var v3');
GAMS Transfer Container stores (multiple) symbols.
Definition: Container.m:104
GAMS Variable Types.
Definition: VariableType.m:48
Constant Property BINARY
identifier for binary variable
Definition: VariableType.m:56
GAMS Variable.
Definition: Variable.m:84
See also
Container, VariableType, Set

Public Member Functions

function Variable (in container, in name, in varargin)
 Constructs a GAMS Variable.
 
function equals (in obj, in symbol)
 Checks equivalence with other symbol.
 
function copy (in obj, in varargin)
 Copies symbol to destination container.
 
- Public Member Functions inherited from Symbol
function setRecords (in obj, in varargin)
 Sets symbol records in supported format.
 
function transformRecords (in obj, in target_format)
 Transforms symbol records into given format.
 
function equals (in obj, in symbol)
 Checks equivalence with other symbol.
 
function copy (in obj, in varargin)
 Copies symbol to destination container.
 
function isValid (in obj, in varargin)
 Checks correctness of symbol.
 
function getDomainViolations (in obj, in varargin)
 Get domain violations.
 
function resolveDomainViolations (in obj, in varargin)
 Extends domain sets in order to resolve domain violations.
 
function getSparsity (in obj)
 Returns the sparsity of symbol records.
 
function getMaxValue (in obj, in varargin)
 Returns the largest value in records.
 
function getMinValue (in obj, in varargin)
 Returns the smallest value in records.
 
function getMeanValue (in obj, in varargin)
 Returns the mean value over all values in records.
 
function getMaxAbsValue (in obj, in varargin)
 Returns the largest absolute value in records.
 
function countNA (in obj, in varargin)
 Returns the number of GAMS NA values in records.
 
function countUndef (in obj, in varargin)
 Returns the number of GAMS UNDEF values in records.
 
function countEps (in obj, in varargin)
 Returns the number of GAMS EPS values in records.
 
function countPosInf (in obj, in varargin)
 Returns the number of GAMS PINF (positive infinity) values in records.
 
function countNegInf (in obj, in varargin)
 Returns the number of GAMS MINF (negative infinity) values in records.
 
function getNumberRecords (in obj)
 Returns the number of GDX records (not available for matrix formats)
 
function getNumberValues (in obj, in varargin)
 Returns the number of values stored for this symbol.
 
function getUELs (in obj, in varargin)
 Returns the UELs used in this symbol.
 
function setUELs (in obj, in uels, in dim, in varargin)
 Sets UELs.
 
function reorderUELs (in obj, in uels, in dim)
 Reorders UELs.
 
function addUELs (in obj, in uels, in dim)
 Adds UELs to the symbol.
 
function removeUELs (in obj, in uels, in dim)
 Removes UELs from the symbol.
 
function renameUELs (in obj, in uels, in varargin)
 Renames UELs in the symbol.
 
function lowerUELs (in obj, in dim)
 Converts UELs to lower case.
 
function upperUELs (in obj, in dim)
 Converts UELs to upper case.
 

Public Attributes

Property name
 Variable name.
 
Property description
 Variable description.
 
Property type
 Variable type, e.g. 'free'.
 
Property default_values
 Variable default values.
 
- Public Attributes inherited from Symbol
Property dimension
 Dimension of symbol (in [0,20])
 
Property size
 Shape of symbol (length == dimension)
 
Property domain
 Domain of symbol (length == dimension)
 
Property domain_labels
 Domain labels in records.
 
Property domain_forwarding
 Enables domain entries in records to be recursively added to the domains in case they are not present in the domains already.
 
Property records
 Storage of symbol records.
 
Property modified
 Flag to indicate modification.
 

Additional Inherited Members

- Protected Member Functions inherited from Symbol
function Symbol (in container, in name, in description, in domain_size, in records, in domain_forwarding)
 Constructs a GAMS Symbol, see subclasses help.
 

Constructor & Destructor Documentation

◆ Variable()

function Variable ( in  container,
in  name,
in  varargin 
)

Constructs a GAMS Variable.

See Creating a Symbol for more information.

Required Arguments:

  1. container (Container): Container object this symbol should be stored in
  2. name (string): Name of variable

Optional Arguments:

  1. type (string or int): Specifies the variable type, either as string or as integer given by any of the constants in VariableType. Default is "free".
  2. domain (cellstr or Set): List of domains given either as string or as reference to a Set object. Default is {} (for scalar).

Parameter Arguments:

  • records: Set records, e.g. a list of strings. Default is [].
  • description (string): Description of symbol. Default is "".
  • domain_forwarding (logical): If true, domain entries in records will recursively be added to the domains in case they are not present in the domains already. With a logical vector domain forwarding can be enabled/disabled independently for each domain. Default: false.

Example:

c = Container();
v1 = Variable(c, 'v1');
v2 = Variable(c, 'v2', 'binary', {'*', '*'});
v3 = Variable(c, 'v3', VariableType.BINARY, '*', 'description', 'var v3');
See also
Container, VariableType, Set

Member Function Documentation

◆ copy()

function copy ( in  obj,
in  varargin 
)

Copies symbol to destination container.

Symbol domains are downgraded to relaxed if the destination container does not have equivalent domain sets, see also Symbol Domain.

Required Arguments:

  1. destination (Container): Destination Container

Optional Arguments:

  1. overwrite (bool): Overwrites symbol with same name in destination if true. Default: false.

◆ equals()

function equals ( in  obj,
in  symbol 
)

Checks equivalence with other symbol.

Note
A symbol is always linked to a container. This method does not check equivalence of the linked containers.

Required Arguments:

  1. symbol (any): Other symbol