libSBML C API  5.18.0
Objective_t Class Reference

Detailed Description

fbc An objective function.

An integral component in a complete description of a steady-state model is the so-called objective function, which generally consists of a linear combination of model variables (fluxes) and a sense (direction). In the SBML Level 3 Flux Balance Constraints (“fbc”) package, this concept is succinctly captured in the Objective_t class.

The Objective_t class is derived from the normal SBML SBase_t class and inherits the "metaid" and "sboTerm" attributes, as well as the subcomponents for Annotation and Notes. To these, the Objective_t class adds an optional attribute named "type". The type attribute can take one of two literal values: "maximize" or "minimize". The values represent the sense of the optimality constraint for the FBC model.

The “fbc” package allows for the definition of multiple model objectives, with one being designated as active. The active objective is indicated using the attribute "activeObjective" on the ListOfObjectives_t object. Here is an example of the XML encoding of a model with a list of objective functions:

<fbc:listOfObjectives fbc:activeObjective="obj1">
 <fbc:objective fbc:id="obj1" fbc:type="maximize">
  <fbc:listOfFluxObjectives>
   <fbc:fluxObjective fbc:reaction="R101" fbc:coefficient="1"/>
  </fbc:listOfFluxObjectives>
 </fbc:objective>
 <fbc:objective fbc:id="obj2" fbc:type="minimize">
  <fbc:listOfFluxObjectives>
   <fbc:fluxObjective fbc:reaction="R102" fbc:coefficient="-2.5"/>
   <fbc:fluxObjective fbc:reaction="R103" fbc:coefficient="1"/>
  </fbc:listOfFluxObjectives>
 </fbc:objective>
</fbc:listOfObjectives>
See also
FluxObjective_t
ListOfObjectives_t

Public Member Functions

Objective_tObjective_clone (Objective_t *o)
 Creates a deep copy of the given Objective_t structure. More...
 
Objective_tObjective_create (unsigned int level, unsigned int version, unsigned int pkgVersion)
 Creates a new Objective_t structure using the given SBML level and version, and the pkgVersion package version. More...
 
void Objective_free (Objective_t *o)
 Frees the given Objective_t structure. More...
 
const char * Objective_getId (const Objective_t *o)
 Returns the value of the "id" attribute of the given Objective_t structure. More...
 
const char * Objective_getName (const Objective_t *o)
 Returns the value of the "name" attribute of the given Objective_t structure. More...
 
const char * Objective_getType (Objective_t *obj)
 Takes a Objective_t structure and returns its type. More...
 
int Objective_hasRequiredAttributes (const Objective_t *o)
 Predicate returning 1 (true) or 0 (false) depending on whether all the required attributes of the given Objective_t structure have been set. More...
 
int Objective_hasRequiredElements (const Objective_t *o)
 Predicate returning 1 (true) or 0 (false) depending on whether all the required sub-elements of the given Objective_t structure have been set. More...
 
int Objective_isSetId (const Objective_t *o)
 Predicate returning 1 (true) if the given Objective_t structure's "id" is set. More...
 
int Objective_isSetName (const Objective_t *o)
 Predicate returning 1 (true) if the given Objective_t structure's "name" is set. More...
 
int Objective_isSetType (const Objective_t *o)
 Predicate returning 1 (true) if the given Objective_t structure's "type" is set. More...
 
int Objective_setId (Objective_t *o, const char *id)
 Sets the "id" attribute of the given Objective_t structure. More...
 
int Objective_setName (Objective_t *o, const char *name)
 Sets the "name" attribute of the given Objective_t structure. More...
 
int Objective_setType (Objective_t *o, const char *type)
 Sets the "type" attribute of the given Objective_t structure. More...
 
int Objective_unsetId (Objective_t *o)
 Unsets the value of the "id" attribute of the given Objective_t structure. More...
 
int Objective_unsetName (Objective_t *o)
 Unsets the value of the "name" attribute of the given Objective_t structure. More...
 
int Objective_unsetType (Objective_t *o)
 Unsets the value of the "type" attribute of the given Objective_t structure. More...
 
ObjectiveType_t ObjectiveType_fromString (const char *s)
 Returns the ObjectiveType_t enumeration corresponding to the given string, or OBJECTIVE_TYPE_UNKNOWN if there is no such match. More...
 
int ObjectiveType_isValidObjectiveType (ObjectiveType_t type)
 Predicate returning 1 (true) or 0 (false) depending on whether the given ObjectiveType_t is valid. More...
 
int ObjectiveType_isValidObjectiveTypeString (const char *s)
 Predicate returning 1 (true) or 0 (false) depending on whether the given string is a valid ObjectiveType_t. More...
 
const char * ObjectiveType_toString (ObjectiveType_t type)
 Returns the string version of the provided ObjectiveType_t enumeration. More...
 

Member Function Documentation

Objective_t * Objective_clone ( Objective_t o)

Creates a deep copy of the given Objective_t structure.

Parameters
othe Objective_t structure to be copied.
Returns
a (deep) copy of the given Objective_t structure, or a null pointer if a failure occurred.
Objective_t * Objective_create ( unsigned int  level,
unsigned int  version,
unsigned int  pkgVersion 
)

Creates a new Objective_t structure using the given SBML level and version, and the pkgVersion package version.

Parameters
levelan unsigned int, the SBML level to assign to this Objective_t structure.
versionan unsigned int, the SBML version to assign to this Objective_t structure.
pkgVersionan unsigned int, the version of the package to assign to this Objective_t structure.
Returns
the newly-created Objective_t structure, or a null pointer if an error occurred during construction.
Note
Attempting to add an object to an SBMLDocument_t having a different combination of SBML Level, Version and XML namespaces than the object itself will result in an error at the time a caller attempts to make the addition. A parent object must have compatible Level, Version and XML namespaces. (Strictly speaking, a parent may also have more XML namespaces than a child, but the reverse is not permitted.) The restriction is necessary to ensure that an SBML model has a consistent overall structure. This requires callers to manage their objects carefully, but the benefit is increased flexibility in how models can be created by permitting callers to create objects bottom-up if desired. In situations where objects are not yet attached to parents (e.g., SBMLDocument_t), knowledge of the intented SBML Level and Version help libSBML determine such things as whether it is valid to assign a particular value to an attribute.
void Objective_free ( Objective_t o)

Frees the given Objective_t structure.

Parameters
othe Objective_t structure to be freed.
const char * Objective_getId ( const Objective_t o)

Returns the value of the "id" attribute of the given Objective_t structure.

Parameters
othe Objective_t structure.
Returns
the id of this structure.
const char * Objective_getName ( const Objective_t o)

Returns the value of the "name" attribute of the given Objective_t structure.

Parameters
othe Objective_t structure.
Returns
the name of this structure.
const char * Objective_getType ( Objective_t obj)

Takes a Objective_t structure and returns its type.

Parameters
objthe Objective_t whose type is sought.
Returns
the type of the given Objective_t, as a pointer to a string.
int Objective_hasRequiredAttributes ( const Objective_t o)

Predicate returning 1 (true) or 0 (false) depending on whether all the required attributes of the given Objective_t structure have been set.

Parameters
othe Objective_t structure to check.
Returns
1 (true) if all the required attributes for this structure have been defined, 0 (false) otherwise.
int Objective_hasRequiredElements ( const Objective_t o)

Predicate returning 1 (true) or 0 (false) depending on whether all the required sub-elements of the given Objective_t structure have been set.

Parameters
othe Objective_t structure to check.
Returns
1 (true) if all the required sub-elements for this structure have been defined, 0 (false) otherwise.
int Objective_isSetId ( const Objective_t o)

Predicate returning 1 (true) if the given Objective_t structure's "id" is set.

Parameters
othe Objective_t structure.
Returns
1 (true) if the "id" of this Objective_t structure is set, 0 (false) otherwise.
int Objective_isSetName ( const Objective_t o)

Predicate returning 1 (true) if the given Objective_t structure's "name" is set.

Parameters
othe Objective_t structure.
Returns
1 (true) if the "name" of this Objective_t structure is set, 0 (false) otherwise.
int Objective_isSetType ( const Objective_t o)

Predicate returning 1 (true) if the given Objective_t structure's "type" is set.

Parameters
othe Objective_t structure.
Returns
1 (true) if the "type" of this Objective_t structure is set, 0 (false) otherwise.
int Objective_setId ( Objective_t o,
const char *  id 
)

Sets the "id" attribute of the given Objective_t structure.

This function copies the string given in id. If the string is a null pointer, this function is equivalent to calling Objective_unsetId().

Parameters
othe Objective_t structure.
idthe string to which the structures "id" attribute should be set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
Note
Using this function with a null pointer for id is equivalent to unsetting the value of the "id" attribute.
int Objective_setName ( Objective_t o,
const char *  name 
)

Sets the "name" attribute of the given Objective_t structure.

This function copies the string given in name. If the string is a null pointer, this function is equivalent to calling Objective_unsetName().

Parameters
othe Objective_t structure.
namethe string to which the structures "name" attribute should be set.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
Note
Using this function with a null pointer for name is equivalent to unsetting the value of the "name" attribute.
int Objective_setType ( Objective_t o,
const char *  type 
)

Sets the "type" attribute of the given Objective_t structure.

Parameters
othe Objective_t structure.
typethe string to which the structures "type" attribute should be set. Valid values include:
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int Objective_unsetId ( Objective_t o)

Unsets the value of the "id" attribute of the given Objective_t structure.

Parameters
othe Objective_t structure.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int Objective_unsetName ( Objective_t o)

Unsets the value of the "name" attribute of the given Objective_t structure.

Parameters
othe Objective_t structure.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
int Objective_unsetType ( Objective_t o)

Unsets the value of the "type" attribute of the given Objective_t structure.

Parameters
othe Objective_t structure.
Returns
integer value indicating success/failure of the function. The value is drawn from the enumeration OperationReturnValues_t. The possible values returned by this function are:
ObjectiveType_t ObjectiveType_fromString ( const char *  s)

Returns the ObjectiveType_t enumeration corresponding to the given string, or OBJECTIVE_TYPE_UNKNOWN if there is no such match.

The matching is case-sensitive: "maximize" will return OBJECTIVE_TYPE_MAXIMIZE, but "Maximize" will return OBJECTIVE_TYPE_UNKNOWN.

Parameters
sthe string to convert to an ObjectiveType_t.
Returns
The corresponding ObjectiveType_t, or OBJECTIVE_TYPE_UNKNOWN if no match found.
int ObjectiveType_isValidObjectiveType ( ObjectiveType_t  type)

Predicate returning 1 (true) or 0 (false) depending on whether the given ObjectiveType_t is valid.

Parameters
typethe ObjectiveType_t enumeration to query.
Returns
1 (true) if the ObjectiveType_t is OBJECTIVE_TYPE_MAXIMIZE or OBJECTIVE_TYPE_MINIMIZE; 0 (false) otherwise (including OBJECTIVE_TYPE_UNKNOWN).
int ObjectiveType_isValidObjectiveTypeString ( const char *  s)

Predicate returning 1 (true) or 0 (false) depending on whether the given string is a valid ObjectiveType_t.

The matching is case-sensitive: "maximize" will return true, but "Maximize" will return false.

Parameters
sthe string to query.
Returns
1 (true) if the string is "maximize" or "minimize"; 0 (false) otherwise.
const char * ObjectiveType_toString ( ObjectiveType_t  type)

Returns the string version of the provided ObjectiveType_t enumeration.

Parameters
typethe ObjectiveType_t enumeration to convert.
Returns
A string corresponding to the given effect: "maximize", "minimize", or NULL if the value is OBJECTIVE_TYPE_UNKNOWN or another invalid enumeration value.