Parameter Class =============== Represents an AMPL parameter. The values can be double or string (in case of symbolic parameters). Data can be assigned to the parameter using the methods :dn:method:`ampl.Entities.Parameter.Set` and :dn:method:`ampl.Entities.Parameter.SetValues` directly from objects of this class or using :dn:method:`ampl.AMPL.SetData` and a :dn:class:`DataFrame` object. Namespace :dn:ns:`ampl.Entities` Assemblies * AMPL ---- .. contents:: :local: Inheritance Hierarchy --------------------- * :dn:cls:`System.Object` * :dn:cls:`ampl.Entities.Entity` * :dn:cls:`ampl.Entities.Entity{ampl.VariantRef}` * :dn:cls:`ampl.Entities.Parameter` Syntax ------ .. code-block:: csharp public class Parameter : Entity, IEnumerable, IEnumerable .. dn:class:: ampl.Entities.Parameter :hidden: .. dn:class:: ampl.Entities.Parameter Methods ------- .. dn:class:: ampl.Entities.Parameter :noindex: :hidden: .. dn:method:: ampl.Entities.Parameter.Get(System.Object[]) :type index: System.Object[] :rtype: ampl.VariantRef .. code-block:: csharp public VariantRef Get(params object[] index) .. dn:method:: ampl.Entities.Parameter.Get(ampl.Tuple) :type t: ampl.Tuple :rtype: ampl.VariantRef .. code-block:: csharp public VariantRef Get(Tuple t = null) .. dn:method:: ampl.Entities.Parameter.GetEnumerator() :rtype: System.Collections.Generic.IEnumerator{ampl.VariantRef} .. code-block:: csharp public IEnumerator GetEnumerator() .. dn:method:: ampl.Entities.Parameter.Set(System.Object) Set the value of a scalar parameter. :param value: Value to be set to :type value: System.Object .. code-block:: csharp public void Set(object value) .. dn:method:: ampl.Entities.Parameter.Set(ampl.Tuple, System.Double) Set the value of a single instance of this parameter. See operator [] for an alternative way :type index: ampl.Tuple :type value: System.Double .. code-block:: csharp public void Set(Tuple index, double value) .. dn:method:: ampl.Entities.Parameter.Set(ampl.Tuple, System.String) :type index: ampl.Tuple :type value: System.String .. code-block:: csharp public void Set(Tuple index, string value) .. dn:method:: ampl.Entities.Parameter.SetValues(System.Double[]) Assign the specified n values to this parameter, assigning them to the parameter in the same order as the indices in the entity. The number of values in the array must be equal to the specified size. :param values: Values to be assigned :type values: System.Double[] .. code-block:: csharp public void SetValues(double[] values) .. dn:method:: ampl.Entities.Parameter.SetValues(System.Double[], System.Double[], System.Double[], System.Boolean) Assign the specified values to a 2-d parameter, using the two dimensions as two indices. :param row_indices: Indices of the rows :type row_indices: System.Double[] :param col_indices: Indices of the columns :type col_indices: System.Double[] :param data: Values to be assigned :type data: System.Double[] :param transpose: True to transpose the values in the matrix :type transpose: System.Boolean .. code-block:: csharp public void SetValues(double[] row_indices, double[] col_indices, double[] data, bool transpose) .. dn:method:: ampl.Entities.Parameter.SetValues(System.String[]) Assign the specified n values to this parameter, assigning them to the parameter in the same order as the indices in the entity. The number of values in the array must be equal to the specified size. :param values: Values to be assigned :type values: System.String[] .. code-block:: csharp public void SetValues(string[] values) .. dn:method:: ampl.Entities.Parameter.SetValues(System.String[], System.String[], System.Double[], System.Boolean) :type row_indices: System.String[] :type col_indices: System.String[] :type data: System.Double[] :type transpose: System.Boolean .. code-block:: csharp public void SetValues(string[] row_indices, string[] col_indices, double[] data, bool transpose) .. dn:method:: ampl.Entities.Parameter.SetValues(ampl.Tuple[], System.Double[]) Assign the values (string or double) to the parameter instances with the specified indices, equivalent to the AMPL code:: let { i in indices } par[i] := values[i]; :param indices: an array of indices of the instances to be set :type indices: ampl.Tuple[] :param values: values to set :type values: System.Double[] .. code-block:: csharp public void SetValues(Tuple[] indices, double[] values) .. dn:method:: ampl.Entities.Parameter.SetValues(ampl.Tuple[], System.String[]) :type indices: ampl.Tuple[] :type values: System.String[] .. code-block:: csharp public void SetValues(Tuple[] indices, string[] values) Properties ---------- .. dn:class:: ampl.Entities.Parameter :noindex: :hidden: .. dn:property:: ampl.Entities.Parameter.HasDefault Check if the parameter has a default initial value.In case of the following AMPL code: `param a;` `param b default a;` the function will return true for parameter ``b``. Note that if the parameter has a default expression which refers to another parameter which value is not defined, this will return true. :rtype: System.Boolean .. code-block:: csharp public bool HasDefault { get; } .. dn:property:: ampl.Entities.Parameter.IsSymbolic True if the parameter is declared as symbolic (can store both numerical and string values) :rtype: System.Boolean .. code-block:: csharp public bool IsSymbolic { get; } .. dn:property:: ampl.Entities.Parameter.Item[System.Object[]] :type index: System.Object[] :rtype: ampl.Variant .. code-block:: csharp public Variant this[params object[] index] { get; set; }