CompactQuasiNewtonModel.AddVariable Method
Adds a user variable to a model.
Namespace: Microsoft.SolverFoundation.Solvers
Assembly: Microsoft.Solver.Foundation (in Microsoft.Solver.Foundation.dll)
Syntax
'Declaration
Public Function AddVariable ( _
key As Object, _
<OutAttribute> ByRef vid As Integer _
) As Boolean
public bool AddVariable(
Object key,
out int vid
)
public:
virtual bool AddVariable(
Object^ key,
[OutAttribute] int% vid
) sealed
abstract AddVariable :
key:Object *
vid:int byref -> bool
override AddVariable :
key:Object *
vid:int byref -> bool
public final function AddVariable(
key : Object,
vid : int
) : boolean
Parameters
- key
Type: System.Object
The variable key.
- vid
Type: System.Int32%
The variable index.
Return Value
Type: System.Boolean
true if the variable is added successfully; otherwise, false.
Implements
IRowVariableModel.AddVariable(Object, Int32%)
Remarks
The AddVariable method ensures that a user variable that has the specified key is present in the model.
The following table shows the value of vid, depending on key.
key in the model |
Value of vid |
---|---|
The model already includes a user variable that is referenced by key. |
vid is set to the variable index. |
The model already includes a row that is referenced by key. |
vid is set to -1. |
A new user variable associated with key is added to the model. |
vid is set to the new variable index. |
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.