Initializing help system before first use

XPRMgetattr

XPRMgetattr


Purpose
Get an attribute of an entity.
Synopsis
int XPRMgetattr(XPRMmodel model, XPRMattrdesc attrdesc, void *ref, XPRMalltypes *value);
Arguments
model 
Reference to a model
attrdesc 
An attribute descriptor
ref 
An entity of the type associated to the attribute
value 
Pointer to an area where the value of the attribute is returned
Return value
Type number of the returned value or 0 in case of error.
Example
The following example displays the reduced cost of variable x.
XPRMalltypes x,rcost;
XPRMattrdesc getrcost;
XPRMfindident(model,"x",&x);
getrcost=XPRMfindattrdesc(model,XPRM_TYP_MPVAR,"rcost");
XPRMgetattr(model,getrcost,x.ref,&rcost);
printf("getrcost(x)=%g\n",rcost.real);
Further information
1. This function makes it possible to retrieve an attribute of an entity using a type descriptor as returned by XPRMfindattrdesc.
2. The internal list of types attributes is deleted each time the model is run or reset: descriptors obtained before a model execution should not be used after the model has been run.
Related topics