Ejemplo n.º 1
0
        /// <summary>
        /// Add an element to this set, if it is one dimensional.
        /// Duplicate entries are beeing ignored.
        /// </summary>
        /// <param name="element">The name of the element which only has one dimension.</param>
        public void AddElement(string element)
        {
            if (Dimension != 1)
            {
                throw new ArgumentException($"Cannot add a one dimensional element to a set with a dimension of {Dimension}.");
            }
            var gamsKey = new GamsKey(element);

            AddElement(gamsKey);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add a new record to this parameter.
        /// </summary>
        /// <param name="value">The value of the record.</param>
        /// <param name="keys">The keys for this record.</param>
        public void AddRecord(double value, params string[] keys)
        {
            if (keys.Length != Dimension)
            {
                throw new ArgumentException($"Cannot add a record with a dimension of {keys.Length} to a parameter with a dimension of {Dimension}.", nameof(keys));
            }

            var gamsKey = new GamsKey(keys);

            AddRecord(value, gamsKey);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Add an element to this set.
        /// Duplicate entries are beeing ignored.
        /// </summary>
        /// <param name="keys">The set of keys that create this element.</param>
        public void AddElement(params string[] keys)
        {
            if (keys.Length != Dimension)
            {
                throw new ArgumentException($"Cannot add a record with a dimension of {keys.Length} to a set with a dimension of {Dimension}.", nameof(keys));
            }

            var gamsKey = new GamsKey(keys);

            AddElement(gamsKey);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Add a new record to this variable.
        /// </summary>
        /// <param name="gamsKey">The <see cref="GamsKey"/> uniquely identifying this record.</param>
        /// <param name="value">The values (<see cref="VariableValues"/>) for this record.</param>
        public void AddRecord(GamsKey gamsKey, VariableValues value)
        {
            if (gamsKey is null)
            {
                throw new ArgumentNullException(nameof(gamsKey));
            }

            if (gamsKey.Length != Dimension)
            {
                throw new ArgumentException($"Cannot add a record with a dimension of {gamsKey.Length} to a variable with a dimension of {Dimension}.", nameof(gamsKey));
            }
            records.Add(gamsKey, value);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Add a new record to this parameter.
        /// </summary>
        /// <param name="gamsKey">The <see cref="GamsKey"/> uniquely identifying this record.</param>
        /// <param name="value">The value of the record.</param>
        public void AddRecord(double value, GamsKey gamsKey)
        {
            if (gamsKey is null)
            {
                throw new ArgumentNullException(nameof(gamsKey));
            }

            if (gamsKey.Length != Dimension)
            {
                throw new ArgumentException($"Cannot add a record with a dimension of {gamsKey.Length} to a parameter with a dimension of {Dimension}.", nameof(gamsKey));
            }
            records.Add(gamsKey, value);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Add a new element to the set.
        /// Duplicate entries are beeing ignored.
        /// </summary>
        /// <param name="gamsKey">The element to be added to this set.</param>
        public void AddElement(GamsKey gamsKey)
        {
            if (gamsKey is null)
            {
                throw new ArgumentNullException(nameof(gamsKey));
            }

            if (gamsKey.Length != Dimension)
            {
                throw new ArgumentException($"Cannot add a record with a dimension of {gamsKey.Length} to a set with a dimension of {Dimension}.", nameof(gamsKey));
            }
            elements.Add(gamsKey);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Add a new record to this parameter, if it is one dimensional.
        /// </summary>
        /// <param name="key">The key of this record.</param>
        /// <param name="value">The value of this record.</param>
        public void AddRecord(double value, string key)
        {
            if (key is null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (Dimension != 1)
            {
                throw new ArgumentException($"Cannot add a one dimensional record to a parameter with a dimension of {Dimension}.");
            }

            var gamsKey = new GamsKey(key);

            AddRecord(value, gamsKey);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Add a new record to this variable if it is one dimensional.
        /// </summary>
        /// <param name="key">The key uniquely identifying this record.</param>
        /// <param name="level">The level of the record.</param>
        /// <param name="lowerBound">The lower bound of the record.</param>
        /// <param name="upperBound">The upper bound of the record.</param>
        public void AddRecord(string key, double level, double lowerBound, double upperBound)
        {
            if (key is null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            if (Dimension != 1)
            {
                throw new ArgumentException($"Cannot add a one dimensional record to a variable with a dimension of {Dimension}.");
            }

            var gamsKey = new GamsKey(key);
            var values  = new VariableValues(level, lowerBound, upperBound);

            AddRecord(gamsKey, values);
        }