37   The ZAIC Tools for Building One-Variable IvP Functions


37.1 The ZAIC_PEAK Tool
     37.1.1 Brief Overview
     37.1.2 The ZAIC_PEAK Parameters and Function Form
     37.1.3 The ZAIC_PEAK Interface Implementation
     37.1.4 The Value-Wrap and Summit-Insist Parameters
     37.1.5 Using the ZAIC_PEAK Tool
     37.1.6 Support for Multi-Modal Functions with the ZAIC_PEAK Tool
37.2 The ZAIC_LEQ and ZAIC_HEQ Tools
     37.2.1 Brief Overview
     37.2.2 The ZAIC_LEQ Parameters and Function Form
     37.2.3 The ZAIC_LEQ Interface Implementation
     37.2.4 Using the ZAIC_LEQ Tool
     37.2.5 The ZAIC_HEQ Tool
     37.2.6 A Warning about the Maximum Utility Plateau
37.3 The ZAIC_Vector Tool
     37.3.1 Brief Overview
     37.3.2 Using the ZAIC_Vector Tool


The ZAIC tools are part of the IvP Build Toolbox for facilitating the building of IvP functions over a single domain variable. There are three tools - ZAIC_PEAK, ZAIC_HEQ, ZAIC_LEQ, and ZAIC_Vector. To use the tools, in short, one creates a instance of the corresponding class, sets some parameters, and then extracts an IvP function. The tools described in Section 38 for n-variable functions can also be used for building one-variable functions but are perhaps overkill for certain classes of common one-variable functions that motivated the ZAIC tools. The term ZAIC is not an acronym, but merely a play on the word mosaic.

37.1   The ZAIC_PEAK Tool    [top]


37.1.1   Brief Overview    [top]


The ZAIC_PEAK tool is designed with the objective function shown in Figure 37.1 in mind. There is a identifiable preferred single decision choice (the summit) with maximum utility, and then a gradual drop in utility as the variable value varies from the preferred choice.

Figure 37.1: The ZAIC_PEAK tool: defines an IvP function over one variable defined by the six parameters shown here. In the case rendered here, the tool would create an IvP function with six pieces. The function rendered was created with summit=180, peakwidth=85, basewidth=70, maxutil=150, minutil=25, summitdelta=40.

    The form in which the utility drops is dependent on the settings of the six parameters shown in the figure. The summit, peakwidth, and basewidth values are given in units native to the decision variable, while the summitdelta, minutil, and maxutil values are given in terms of units of utility.

37.1.2   The ZAIC_PEAK Parameters and Function Form    [top]


The ZAIC_PEAK tool accepts six parameters in defining f(x). The summit parameter is the point of maximum utility. The minutil parameter is the minimum value of f(x), with a default value of zero. The maxutil is the maximum value of f(x), with a default value of 100. The utility of the function drops off linearly in two stages. In the first stage the utility drops linearly off from the maxutil to maxutil-summitdelta, and in the second stage it drops off linearly from maxutil-summitdelta to minutil. The function has the form:

where

To correlate the above five cases above with the six pieces in Figure 37.1, is piece #3, is piece #2, is piece #4, is piece #5, minutil for pieces #1 and #6. The two stage linear drop-off in utility is there to allow the shape of the function to approximate convex or concave functions as shown in Figure 37.2.

Figure 37.2: The ZAIC_PEAK tool: A convex uni-modal function (left) and a non-convex uni-modal function (right).

37.1.3   The ZAIC_PEAK Interface Implementation    [top]


The following functions define the interface to the ZAIC_PEAK tool. In constructing and setting parameters, the instance maintains a Boolean flag indicating if any fatal configuration errors were detected. In such cases, a warning string is generated for optional retrieval, and the error renders the instance effectively useless, never yielding an IvP function when requested.

    Many of the below functions take an optional index parameter. This is used for creating functions with multiple modes or peaks as described in Section 37.1.6. The default value is zero, or the zeroth index, when only one mode or peak is being implemented. If the given index references a non-existing component, this is considered a fatal configuration error. Example usage is provided in Listing 37.1.

  • bool setSummit(double val, int index=0): Sets the summit value of the component at the given index. If no index parameter is provided, the index is zero. If the summit value is outside the range of the domain, it is clipped to the appropriated end. For example if the domain were [0,359] as the example in Figure 37.1, and the requested summit value were 550, the summit parameter would be set to 359. This is therefore not regarded as a fatal configuration error, but a warning would be generated anyway. This returns false only if index referencing a non-existent component is provided.
  • bool setPeakWidth(double val, int index=0): Sets the peakwidth value of the component at the given index. If no index parameter is provided, the index is zero.
  • bool setBaseWidth(double val, int index=0): Sets the basewidth value of the component at the given index. If no index parameter is provided, the index is zero.
  • bool setSummitDelta(double val, int index=0): Sets the summitdelta value of the component at the given index. If no index parameter is provided, the index is zero. A fatal error is declared and false is returned if the index is out of range, or if the value is less than zero. Otherwise true is returned. If the sumitdelta value is greater than the range determined by maxutil - minutil, this is not interpreted as a fatal error, but the summitdelta is clipped to the range.
  • bool setMinMaxUtil(double min, double, max, int index=0): Sets the minutil and maxutil values of the component at the given index. If no index parameter is provided, the index is zero. A fatal error is declared and false is returned if the index is out of range, or if the min value is greater than or equal to the max value. Otherwise true is returned. If the existing summitdelta value is greater than the range determined by maxutil - minutil, this is not interpreted as a fatal error, but the summitdelta is clipped to the range.
  • bool setParams(double summit, double peakwidth, double basewidth, double summitdelta, \\ double minutil, double maxutil, int index=0:: Sets the six configuration parameters summit, peakwidth, basewidth, summitdelta, minutil and maxutil all at once. If the summitdelta value is greater than the range determined by maxutil - minutil, this is not interpreted as a fatal error, but the summitdelta is clipped to the range.
  • void setSummitInsist(bool val): Sets the summitinsist flag to the given value. The default is true. See Section 37.1.4 for more on this parameter.

\label{lab_valuewrap}

  • void setValueWrap(bool val): Sets the valuewrap flag to the given value. The default is false. See Section 37.1.4 for more on this parameter.
  • int addComponent(): Allocates a new component and returns the index of the new component. Since the first component exists upon ZAIC creation, the first call to this function will return 1, and will result in the ZAIC_PEAK instance having two components at index 0 and 1. The default values for the new component are summit=0, peakwidth=0, basewidth=0, summitdelta=50, minutil=0, maxutil=100.
  • IvPFunction* extractIvPFunction(bool maxval=true): This function generates a new IvP function based on the prevailing parameter settings at the time of invocation. If a fatal error was detected in prior parameter setting attempts, this function will simply return the NULL pointer. When the IvP function is extracted from the ZAIC, an IvPFunction instance is created from the heap that needs to be later deleted. The ZAIC tool does not delete this. It is the responsibility of the caller. Typically this tool is used within a behavior, and the behavior passes the IvP function to the helm and the helm deletes all IvP functions.
  • string getWarnings(): When or if fatal (or non-fatal) problems are encountered in setting the parameters, the tool appends a message to a local warning string. This string can be retrieved by this function. A non-empty string does not necessarily mean a fatal configuration error was encountered. Instead, the stateOK() function below should be consulted.
  • bool stateOK(): This function returns true if no fatal errors were encountered during configuration attempts, otherwise it returns false. If an error has been encountered, this state cannot be reversed. The instance has been rendered effectively useless. To gain insight into the nature of the error, the getWarnings() function above can be consulted.

37.1.4   The Value-Wrap and Summit-Insist Parameters    [top]


Two additional Boolean parameters may be set for an instance of ZAIC_PEAK. They are the valuewrap and summitinsist parameters set with the following functions with the defaults shown:

     zaic.setValueWrap(false);     // Default value is false
     zaic.setSummitInsist(true);   // Default value is true

When the valuewrap parameter is true, the utility associated with the domain variable value "wraps" around. For example, if the domain variable is the vehicle heading, which may have the domain [0, 359], a value of 10 degrees is evaluated as being only 20 degrees different from 350, rather than being different by 330 degrees. The two functions depicted in Figure 37.3 differ only in the setting of the valuewrap parameter.

Figure 37.3: The valuewrap parameter in the ZAIC_PEAK tool: A function generated with valuewrap=false on the left, and function generated with valuewrap=true and otherwise identical parameters on the right.

    The value of the summitinsist parameter can affect the generated objective function in the following two scenarios. In the first case, consider the domain to be the possible headings with 360 discrete choices [0, 359], and the peakwidth and basewidth are both zero. If the summit were then set to 90.25, one way to interpret this is that all 360 discrete heading choices have a utility of zero, since none are equal exactly to 90.25. This is the interpretation when summitinsist is false. When set to true, the same set of parameters would generate an objective function that ranked the heading of 90 degrees with maximum utility and all other heading choices with the minimum utility (an IvP function with 3 pieces, i.e., intervals). In the second case, consider the domain to be possible speeds with 31 discrete choices [0, 3.0], with the summit set to 4.0 with a peakwidth and basewidth of 0.25. The ZAIC_PEAK tool would generate an objective function ranking all speeds equally with the minimum utility when summitinsist is set to false. When set to true, the ZAIC_PEAK tool would generate an objective function ranking the highest speed in the domain (3.0) with maximum utility (maxutil), and all other speeds with minimum utility (minutil). The default setting is summitinsist=true since this seems the more reasonable thing to do in most such cases.

37.1.5   Using the ZAIC_PEAK Tool    [top]


Usage of the ZAIC_PEAK tool boils down to the following four steps.

  • Step 1: Create the IvP domain, or retrieve it if otherwise already created.
  • Step 2: Create the ZAIC_PEAK instance with a domain and domain variable.
  • Step 3: Set the ZAIC_PEAK parameters.
  • Step 4: Extract the IvP function.

A code example of the four steps is provided in Listing 37.1 below. This code example describes a function that builds and returns an IvP function using the ZAIC_LEQ tool. It is not too different from the activity inside a typical implementation of onRunState in an IvP behavior.

Listing 37.1 - Example usage of the ZAIC_Peak tool corresponding to Figure 37.1.

      #include "ZAIC_PEAK.h"
      ...
   1  IvPFunction *buildIvPFunction()
   2  {
   3    // Step 1 - Create the IvPDomain, the function's domain
   4    IvPDomain domain;
   5    domain.addDomain("depth", 0, 600, 601);
   6  
   7    // Step 2 - Create the ZAIC_PEAK with the domain and variable name
   8    ZAIC_PEAK  zaic_peak(domain, "depth");
   9  
  10    // Step 3 - Configure the ZAIC_PEAK parameters
  11    zaic_peak.setSummit(150);
  12    zaic_peak.setMinMaxUtil(20, 120);
  13    zaic_peak.setBaseWidth(60);
  14  
  15    // Step 4 - Extract the IvP function
  16    IvPFunction *ivp_function = 0;
  17    if(zaic_peak.stateOK())
  18      ivp_function = zaic_peak.extractIvPFunction();
  19    else
  20      cout << zaic_peak.getWarnings();
  21    return(ivp_function)     

The lines comprising step 4 (lines 15-20) are conservative in that they first check to see if no fatal configuration errors were encountered, and writes the warnings to the terminal if found. It does not even attempt to extract an IvP function if an error was encountered. These five lines could have been replaced by one line:

    return(zaic_peak.extractIvPFunction());

This is simpler, but the warning information is potentially useful. When the ZAIC_PEAK tool is used within an IvP behavior, the warnings can be posted to the MOOSDB in the variable BHV_WARNING which is monitored by other tools.

37.1.6   Support for Multi-Modal Functions with the ZAIC_PEAK Tool    [top]


The ZAIC_PEAK tool will allow additional components to be added to provide a multi-modal effect. A component refers to the set of six parameters summit, peakwidth, basewidth, summitdelta, minutil, maxutil. Adding a second component creates a multi-modal function as shown in Figure 37.4.

Figure 37.4: Multiple modes with the ZAIC_PEAK tool: additional components can be added to create a multi-modal objective function. Each component is comprised of the six parameters summit, peakwidth, basewidth, summitdelta, minutil, and maxutil.

Listing 37.2 shows how this is done. In lines 2-3, the ZAIC_PEAK instance is created and the parameters are set for the first component. A second component is allocated in line 5 with the call to addComponent() which returns the index of the newly created component. This index is passed as the last argument to the function call on line 6 to clarify that the parameters are to be applied to the second component (at index 1).

Listing 37.2 - Using the ZAIC_PEAK tool to build and return a multi-mode IvP Function.

      #include "ZAIC_PEAK.h"
      ...
   1  IvPFunction *buildIvPFunction(IvPDomain domain, string varname)
   2  {
   3    ZAIC_PEAK zaic(domain, varname);
   4    zaic.setParams(300, 80, 100, 15, 0, 100);  // No index given - assumed to be zero.
   5    
   6    int index = zaic.addComponent();
   7    zaic.setParams(600, 130, 35, 30, 0, 147, index); // Last param is component index
   8
   9    zaic.setValueWrap(false);     // Not component specific - no index given
  10    zaic.setSummitInsist(true);   // Not component specific - no index given
  11    bool take_the_max = true
  12    IvPFunction *ipf = zaic.extractIvPFunction(take_the_max);
  13    return(ipf);
  14  }

When the IvP function is extracted from the ZAIC_PEAK, in line 12, the composition of the multiple components can be interpreted in one of two ways - by taking the maximum or the sum of the two components. In the former, the combined utility is the maximum of the values given by the individual components. In the latter the combined utility is the sum of the individual components. The extractIvPFunction(bool) function on line 12 will return a composition based on taking the max if passed true, and will take the sum otherwise. The default (if no value is passed) is true. The difference between the two extractions is shown in Figure 37.5 for the two components shown in Figure 37.4.

Figure 37.5: Options for combining components: On the left is the result of combining the two components in Figure 37.4 by using the max value from the two components. On the right is the result of combining the two components by using the sum of the values from the two components.

    All component parameter-setting functions defined for the ZAIC_PEAK class take an optional final argument indicating the intended component index. If the argument is not provided, it is assumed to be zero, the index of the one component created automatically when the ZAIC_PEAK instance is created. The default values of a newly added component are are summit=0, peakwidth=0, basewidth=0, summitdelta=50, minutil=0, maxutil=100. The valuewrap and summitinsist parameters are not component-specific parameters, and therefore are only called once on a particular ZAIC_PEAK instance, and do not have an optional index parameter.

37.2   The ZAIC_LEQ and ZAIC_HEQ Tools    [top]


37.2.1   Brief Overview    [top]


The ZAIC_LEQ tool is used for generating IvP functions where there is a constant, maximum utility associated with a decision variable whose value is kept less than or equal to (LEQ) a given value. For example if a UUV component is known to work reliably up to a certain depth, or if a vehicle's speed is to be kept below a certain value to prevent interference with another sensor or communications equipment. The ZAIC_LEQ tool allows for expressing a linear drop-off in utility between two values. For example, if the fictional UUV component is rated to a depth of 200 meters, the utility function may have a maximum utility for depths up to 150 meters and minimum utility at 210 meters as in the example in Figure 37.6.

Figure 37.6: The ZAIC_LEQ tool: facilitates building simple 2-3 piece piecewise defined utility functions over a single decision variable whose value is to be kept less than or equal to a given value. It accepts four parameters, the summit, minutil, maxutil, basewidth. In the figure summit=150, minutil=20, maxutil=120, basewidth=60.

    Likewise, the ZAIC_HEQ tool is used for generating objective functions where there is a constant, maximum utility associated with a decision variable whose value is kept greater than or equal to (HEQ) a given value. These two tools have a similar interface. Most of what is described below for one tool applies to the other. The differences are distinguished in Section 37.2.5. The IvP functions generated by these ZAIC tools have a small footprint, having either two or three pieces.

37.2.2   The ZAIC_LEQ Parameters and Function Form    [top]


The ZAIC_LEQ tool accepts four parameters in defining f(x). The summit parameter is the point where maximum utility begins to drop off. The minutil parameter is the minimum value of f(x), with a default value of zero. The maxutil is the maximum value of f(x), with a default value of 100. The function has the form:

The basewidth parameter can be used to soften the drop in utility as shown in Figure 37.6. When basewidth has the default value of zero, the general form is as above. When basewidth is configured with a positive value, the general form is:

For the example in Figure 37.6, the function is given below.

The three above cases corresponds to the three pieces generated for the IvP function shown in Figure 37.6.

37.2.3   The ZAIC_LEQ Interface Implementation    [top]


The following functions define the interface to the ZAIC_LEQ tool. In constructing and setting parameters, the instance maintains a Boolean flag indicating if any fatal configuration errors were detected. In such cases, a warning string is generated for optional retrieval, and the error renders the instance effectively useless, never yielding an IvP function when requested. Example usage is provided in Listing 37.3.

  • ZAIC_LEQ(IvPDomain domain, string varname): The constructor takes two arguments, an IvP domain and a variable name contained in the domain. The named variable needs to be just one of the variables used in the IvP domain; not necessarily the only one. If the named variable is not part of the IvP domain, this is regarded as a fatal error.
  • bool setSummit(double summit): Sets the summit value. If the summit value is outside the range of the domain, it is clipped to the appropriated end. For example if the domain were [0,600] as the example in Figure 37.6, and the requested summit value were 650, the summit parameter would be set to 600. This is therefore not regarded as a fatal configuration error, but a warning would be generated anyway. This function always returns true.
  • bool setMinMaxUtil(double min, double max): Sets the values for minutil and maxutil. If the minutil is greater or equal to maxutil, this is regarded as a fatal configuration error, a warning is generated, and the function returns false.
  • bool setBaseWidth(double basewidth): Sets the basewidth parameter value. The given value must be greater than or equal to zero. Otherwise this is regarded as a fatal configuration error, a warning is generated, and the function returns false.
  • IvPFunction *extractIvPFunction(): This function generates a new IvP function based on the prevailing parameter settings at the time of invocation. If a fatal error was detected in prior parameter setting attempts, this function will simply return the NULL pointer. When the IvP function is extracted from the ZAIC, an IvPFunction instance is created from the heap that needs to be later deleted. The ZAIC tool does not delete this. It is the responsibility of the caller. Typically this tool is used within a behavior, and the behavior passes the IvP function to the helm and the helm deletes all IvP functions.
  • string getWarnings(): When or if fatal (or non-fatal) problems are encountered in setting the parameters, the tool appends a message to a local warning string. This string can be retrieved by this function. A non-empty string does not necessarily mean a fatal configuration error was encountered. Instead, the stateOK() function below should be consulted.
  • bool stateOK(): This function returns true if no fatal errors were encountered during configuration attempts, otherwise it returns false. If an error has been encountered, this state cannot be reversed. The instance has been rendered effectively useless. To gain insight into the nature of the error, the getWarnings() function above can be consulted.

37.2.4   Using the ZAIC_LEQ Tool    [top]


Usage of the ZAIC_LEQ tool boils down to the following four steps.

  • Step 1: Create the IvP domain, or retrieve it if otherwise already created.
  • Step 2: Create the ZAIC_LEQ instance with a domain and domain variable.
  • Step 3: Set the ZAIC_LEQ parameters.
  • Step 4: Extract the IvP function.

A code example of the four steps is provided in Listing 37.3 below. This code example describes a function that builds and returns an IvP function using the ZAIC_LEQ tool. It is not too different from the activity inside a typical implementation of onRunState in an IvP behavior.

Listing 37.3 - Example usage of the ZAIC_LEQ tool corresponding to Figure 37.6.

      #include "ZAIC_LEQ.h"
      ...
   1  IvPFunction *buildIvPFunction()
   2  {
   3    // Step 1 - Create the IvPDomain, the function's domain
   4    IvPDomain domain;
   5    domain.addVar("depth", 0, 600, 601);
   6  
   7    // Step 2 - Create the ZAIC_LEQ with the domain and variable name
   8    ZAIC_LEQ  zaic_leq(domain, "depth");
   9  
  10    // Step 3 - Configure the ZAIC_LEQ parameters
  11    zaic_leq.setSummit(150);
  12    zaic_leq.setMinMaxUtil(20, 120);
  13    zaic_leq.setBaseWidth(60);
  14  
  15    // Step 4 - Extract the IvP function
  16    IvPFunction *ivp_function = 0;
  17    if(zaic_leq.stateOK())
  18      ivp_function = zaic_leq.extractIvPFunction();
  19    else
  20      cout << zaic_leq.getWarnings();
  21    return(ivp_function)     

The lines comprising step 4 (lines 15-20) are conservative in that they first check to see if no fatal configuration errors were encountered, and writes the warnings to the terminal if found. It does not even attempt to extract an IvP function if an error was encountered. These five lines could have been replaced by one line:

    return(zaic_leq.extractIvPFunction());

This is simpler, but the warning information is potentially useful. When the ZAIC_LEQ tool is used within an IvP behavior, the warnings can be posted to the MOOSDB in the variable BHV_WARNING which is monitored by other tools.

37.2.5   The ZAIC_HEQ Tool    [top]


Like the ZAIC_LEQ tool, the ZAIC_HEQ too is used for generating objective functions where there is a constant, maximum utility associated with a decision variable whose value is kept greater than or equal to a given value. The parameters described in Section 37.2.2 and interface implementation described in Section 37.2.3 for the ZAIC_LEQ tool are identical for the ZAIC_HEQ tool. The parameters are interpreted differently however. The same parameters used in Figure 37.6 are used in the ZAIC_HEQ tool to give the function shown in Figure 37.7.

Figure 37.7: The ZAIC_HEQ tool: facilitates building simple 2-3 piece piecewise defined utility functions over a single decision variable whose value is to be kept greater than or equal to a given value. It accepts four parameters, the summit, minutil, maxutil, basewidth. In the figure summit=150, minutil=20, maxutil=120, basewidth=60.

37.2.6   A Warning about the Maximum Utility Plateau    [top]


It is worth noting a potential pitfall regarding the maximum utility plateau generated by both the ZAIC_LEQ and ZAIC_HEQ tools. By having equal utility for all domain values in the plateau range, no one domain value is preferred. If this is the only IvP objective function involved in the decision process for the particular domain variable, it is not clear what value will be chosen by the IvP solver. Even more troublesome is that the chosen value may change between iterations giving the appearance that the decision engine is thrashing. In this case the solver is simply faithfully and strictly interpreting the problem it was given. In short, these objective functions are designed to work in conjunction with others that express preferences in a non-plateau manner.

37.3   The ZAIC_Vector Tool    [top]


37.3.1   Brief Overview    [top]


The ZAIC_Vector tool is used for generating IvP functions over one variable, given some number of explicit domain-range mappings. These mappings are passed to the ZAIC_Vector tool as two equally sized vectors; a vector of domain values and a vector of range values. An IvP function is created that typically has a piece per given domain-range pair, where the slope of each piece simply approximates the domain-range characteristics for domain-range pairs not explicitly given.

Figure 37.8: The ZAIC_Vector tool: defines an IvP function over one variable defined by a set of explicit domain-range mappings.

37.3.2   Using the ZAIC_Vector Tool    [top]


Usage of the ZAIC_Vector tool boils down to the following four steps.

  • Step 1: Create the IvP domain, or retrieve it if otherwise already created.
  • Step 2: Create the ZAIC_Vector instance with a domain and domain variable.
  • Step 3: Set the ZAIC_Vector parameters.
  • Step 4: Extract the IvP function.

A code example of the four steps is provided in Listing 37.4 below. This code example describes a function that builds and returns an IvP function using the ZAIC_Vector tool. It is not too different from the activity inside a typical implementation of onRunState in an IvP behavior.

Listing 37.4 - Example usage of the ZAIC_Vector tool corresponding to Figure 37.8.

      #include "ZAIC_Vector.h"
      ...
   1  IvPFunction *buildIvPFunction()
   2  {
   3    // Step 1 - Create the IvPDomain, the function's domain
   4    IvPDomain domain;
   5    domain.addVar("depth", 0, 600, 601);
   6  
   7    // Step 2 - Create the ZAIC_Vector with the domain and variable name
   8    ZAIC_Vector  zaic_vector(domain, "depth");
   9  
  10    // Step 3 - Configure the ZAIC_Vector parameters
  11    vector<double> domain_vals;
  12    vector<double> range_vals;
  13    domain_vals.push_back(100); range_vals.push_back(80);
  14    domain_vals.push_back(150); range_vals.push_back(15);
  15    domain_vals.push_back(180); range_vals.push_back(35);
  16    domain_vals.push_back(220); range_vals.push_back(40);
  17    domain_vals.push_back(360); range_vals.push_back(55);
  18    domain_vals.push_back(419); range_vals.push_back(95);
  19    domain_vals.push_back(480); range_vals.push_back(75);
  20    domain_vals.push_back(520); range_vals.push_back(65);
  21    domain_vals.push_back(560); range_vals.push_back(85);
  22    domain_vals.push_back(999); range_vals.push_back(34);
  23    zaic_vecctor.setDomainVals(domain_vals);
  24    zaic_vecctor.setRangeVals(range_vals);
  25  
  26    // Step 4 - Extract the IvP function
  27    IvPFunction *ivp_function = 0;
  28    if(zaic_vector.stateOK())
  29      ivp_function = zaic_vector.extractIvPFunction();
  30    else
  31      cout << zaic_vector.getWarnings();
  32    return(ivp_function)     

The lines comprising step 4 (lines 26-31) are conservative in that they first check to see if no fatal configuration errors were encountered, and writes the warnings to the terminal if found. It does not even attempt to extract an IvP function if an error was encountered. These five lines could have been replaced by one line:

    return(zaic_vector.extractIvPFunction());

This is simpler, but the warning information is potentially useful. When the ZAIC_LEQ tool is used within an IvP behavior, the warnings can be posted to the MOOSDB in the variable BHV_WARNING which is monitored by other tools.


Page built from LaTeX source using the texwiki program.