Loading...
Searching...
No Matches

GAMS Variable. More...

Inheritance diagram for Variable:
Abstract

GAMS Variable.

Represents a GAMS Variable.

Example:

c = Container();
v1 = symbol.Variable.construct(c, 'v1');
v2 = symbol.Variable.construct(c, 'v2', 'binary', {'*', '*'});
v3 = symbol.Variable.construct(c, 'v3', VariableType.BINARY, '*', 'description', 'var v3');
GAMS Transfer Container stores (multiple) symbols.
Definition: Container.m:67
GAMS Variable Type.
Definition: VariableType.m:47
Constant Property BINARY
identifier for binary variable
Definition: VariableType.m:55
See also
Variable, Container.addVariable, VariableType

Public Member Functions

function copy (in obj, in varargin)
 Copies symbol to destination container.
 
- Public Member Functions inherited from Abstract
function copy (in obj, in varargin)
 (Abstract) Copies symbol to destination container
 
function equals (in obj, in symbol)
 Checks equivalence with other 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 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 countDuplicateRecords (in obj)
 Counts duplicate records.
 
function findDuplicateRecords (in obj, in varargin)
 Finds duplicate records.
 
function hasDuplicateRecords (in obj)
 Checks if duplicate records exist.
 
function dropDuplicateRecords (in obj, in varargin)
 Drops duplicate records.
 
function countDomainViolations (in obj)
 Counts domain violations.
 
function findDomainViolations (in obj)
 Counts domain violations.
 
function hasDomainViolations (in obj)
 Checks if duplicate records exist.
 
function dropDomainViolations (in obj)
 Drops duplicate records in symbols.
 
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 dropDefaults (in obj, in varargin)
 Drops default values from records.
 
function dropNA (in obj, in varargin)
 Drops NA values from records.
 
function dropUndef (in obj, in varargin)
 Drops Undef values from records.
 
function dropMissing (in obj, in varargin)
 Drops NaN (includes NA and Undef) values from records.
 
function dropEps (in obj, in varargin)
 Drops Eps values from records.
 
function getUELs (in obj, in varargin)
 Returns the UELs used in this symbol.
 
function setUELs (in obj, in varargin)
 Sets UELs.
 
function reorderUELs (in obj, in varargin)
 Reorders UELs.
 
function addUELs (in obj, in varargin)
 Adds UELs to the symbol.
 
function removeUELs (in obj, in varargin)
 Removes UELs from the symbol.
 
function renameUELs (in obj, in varargin)
 Renames UELs in the symbol.
 
function lowerUELs (in obj, in varargin)
 Converts UELs to lower case.
 
function upperUELs (in obj, in varargin)
 Converts UELs to upper case.
 

Static Public Member Functions

static function construct (in varargin)
 Constructs a GAMS Variable.
 
static function describe (in symbols)
 Returns an overview over all variables given.
 

Public Attributes

Property type
 Variable type, e.g. 'free'.
 
- Public Attributes inherited from Abstract
Property container
 Container the symbol is stored in.
 
Property name
 Symbol name.
 
Property description
 Symbol description.
 
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 format
 Format in which records are stored in.
 
Property modified
 Flag to indicate modification.
 

Private Attributes

Property default_values
 Variable default values.
 
Property indexed
 Flag if symbol can be used in indexed mode.
 

Member Function Documentation

◆ construct()

static function construct ( in  varargin)
static

Constructs a GAMS Variable.

Required Arguments:

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

Optional Arguments:

  1. type (string, int or VariableType): Specifies the variable type, either as string, as integer given by any of the constants in VariableType or VariableType. Default is "free".
  2. domain (cellstr or Set): List of domains given either as string or as reference to a symbol.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 = symbol.Variable.construct(c, 'v1');
v2 = symbol.Variable.construct(c, 'v2', 'binary', {'*', '*'});
v3 = symbol.Variable.construct(c, 'v3', VariableType.BINARY, '*', 'description', 'var v3');
See also
Variable, Container.addVariable, VariableType

◆ 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.

◆ describe()

static function describe ( in  symbols)
static

Returns an overview over all variables given.

See Symbol Overview for more information.

Required Arguments:

  1. symbols (list): List of variables to include.

The overview is in form of a table listing for each symbol its main characteristics and some statistics.