Phenomena
This page describes the organizational forces that limit change.  It explains how to overcome them when necessary. 

Power& tradition holding back progress
This page uses an example to illustrate how:
  • A business can gain focus from targeting key customers,
  • Business planning activities performed by the whole organization can build awareness, empowerment and coherence. 
  • A program approach can ensure strategic alignment. 
Be responsive to market dynamics
This page uses the example of HP's printer organization freeing itself from its organizational constraints to sell a printer targeted at the IBM pc user. 
The constraints are described. 
The techniques to overcome them are implied. 
Overcome reactionaries
Primary Navigation

Phenomena

Summary
This page describes the
This page describes the Adaptive Web framework (AWF) test system and the agent programming framework (Smiley) that supports its operation. 
Example test system statements are included.  To begin a test a test statement is loaded into Smiley while Smiley executes on the Perl interpreter. 
Part of Smiley's Perl code focused on setting up the infrastructure is included bellow. 
The setup includes:
  • Loading the 'Meta file' specification,
  • Initializing the Slipnet, and Workspaces and loading them
  • So that the Coderack can be called. 
The Coderack, which is the focus of a separate page of the Perl frame then schedules and runs the codelets that are invoked by the test statement structures. 
Smiley
infrastructure and codelets that instantiate the
This page discusses the physical foundations of complex adaptive systems (CAS).  A small set of rules is obeyed.  New [epi]phenomena then emerge.  Examples are discussed. 
epiphenomena
defined in the Meta file is loaded by the adaptive web framework's (AWF) Smiley.  It defines the application system's basic rules, its keywords and their properties and the form of the assertion or implementation statement the application uses.   and
This page describes the Copycat Slipnet. 
The goal of the Slipnet is reviewed. 
Smiley's specialized use of the Slipnet is introduced. 
The initial Slipnet network used by the 'Merge Streams' and 'Virtual Robot' agent-based applications is setup in initchemistry and is included. 
The Slipnet infrastructure and initialization functions are included. 
Slipnet

Infrastructure
Agents use sensors to detect events in their environment.  This page reviews how these events become signals associated with beneficial responses in a complex adaptive system (CAS).  CAS signals emerge from the Darwinian information model.  Signals can indicate decision summaries and level of uncertainty. 
sensors
are introduced
The role of phenomena in shaping the environment is discussed
The focusing of forces by phenomena in Smiley is discussed
The Meta file association of case, in a high level computing language a case, or switch, statement allows the specification of a series of alternative labeled items.  Any of these labels can be assigned to the case selector.  On entry to the case statement the compiler will allocate a jump to the item that is associated with a label that has the same value as is currently assigned to the case selector.   keywords with phenomena is included
The codelets and supporting functions are included
Introduction
In Smiley , an
This page describes the Adaptive Web framework (AWF) test system and the agent programming framework (Smiley) that supports its operation. 
Example test system statements are included.  To begin a test a test statement is loaded into Smiley while Smiley executes on the Perl interpreter. 
Part of Smiley's Perl code focused on setting up the infrastructure is included bellow. 
The setup includes:
  • Loading the 'Meta file' specification,
  • Initializing the Slipnet, and Workspaces and loading them
  • So that the Coderack can be called. 
The Coderack, which is the focus of a separate page of the Perl frame then schedules and runs the codelets that are invoked by the test statement structures. 
agent programming framework
, the
This page discusses the physical foundations of complex adaptive systems (CAS).  A small set of rules is obeyed.  New [epi]phenomena then emerge.  Examples are discussed. 
physical environment
is defined by a network of concepts in the
This page describes the Copycat Slipnet. 
The goal of the Slipnet is reviewed. 
Smiley's specialized use of the Slipnet is introduced. 
The initial Slipnet network used by the 'Merge Streams' and 'Virtual Robot' agent-based applications is setup in initchemistry and is included. 
The Slipnet infrastructure and initialization functions are included. 
Slipnet
and, in an addition to the architecture of
This page discusses the interdependence of perception and representation in a complex adaptive system (CAS).  Hofstadter and Mitchell's research with Copycat is reviewed. 
Copycat
as supported keyword-token associations in the Meta file is loaded by the adaptive web framework's (AWF) Smiley.  It defines the application system's basic rules, its keywords and their properties and the form of the assertion or implementation statement the application uses.  
Infrastructure sensors are provided by Smiley
AWF's 'physical' phenomena, really epiphenomena, based on tokens, such as pttruet once defined in the Slipnet can be associated with keywords in the Meta file specification.  These phenomena are detected
Rather than oppose the direct thrust of some environmental flow agents can improve their effectiveness with indirect responses.  This page explains how agents are architected to do this and discusses some examples of how it can be done. 
indirectly
through calls to chmdefis. 
Phenomena shape the local environment
Phenomena increase the specificity of environments where they occur.  For example:
Phenomena focus forces
Phenomena can have effects in Smiley, when they become associated with forces based on
This page describes the Copycat Workspace. 
The specialized use of the Workspace by the adaptive web framework's (AWF) Smiley is discussed. 
How text and XML are imported into the Smiley Workspace is described. 
Telomeric aging of schematic structures is introduced. 
The internal data structure used to represent the state of each workspace object is included. 
The Workspace infrastructure functions are included. 
Workspace
focused codelets operating on the
This page describes the Copycat Coderack. 
The details of the codelet architecture are described. 
The specialized use of the Coderack by the adaptive web framework's (AWF) Smiley is discussed. 
The codelet scheduling mechanism is discussed. 
A variety of Smiley extensions to the Coderack are reviewed. 
The Coderack infrastructure functions are included. 
Coderack
.  These codelets include: descriptions (builder), relations (builder), chemical bonds (builder), and molecular groups (builder). 

The physical phenomena are AWF's equivalents of the quarks that constitute a physical atom, providing component attributes to the keywords which they make up. 
Agents use sensors to detect events in their environment.  This page reviews how these events become signals associated with beneficial responses in a complex adaptive system (CAS).  CAS signals emerge from the Darwinian information model.  Signals can indicate decision summaries and level of uncertainty. 
Sensors
such as ipartseqcount typically use a response to the phenomena to detect the presence of a keyword.

Chemical phenomena are represented by Workspace descriptors.  They can be created with setupdesc, and inccounter and detected with calls to findbond, findtdesc, or findcounter and counters can be masked with maskcounter

Synchronization
The scheduling of codelets based on deployment of specific descriptors in specific Workspace objects allows
Representing state in emergent entities is essential but difficult.  Various structures are used to enhance the rate and scope of state transitions.  Examples are discussed. 
structurally enhanced state
to be associated with 'chemical forces'. 

Meta file association of tokens with conceptual keywords
The case for Meta file specification is deployed as html source below.  mdft tags enclose each set of tokens that will become the attributes associated with the included keyword.
 
<h3> <a name="CASE_FOR"> </a> CASE FOR/<a name="CASE_IF_"> </a> IF</h3>
<br>
<table style="width: 100%; text-align: left;" border="1" cellpadding="2"
cellspacing="2">
<tbody>
<tr align="center">
<td style="vertical-align: top;">   <<span
style="font-weight: bold;"> <mfdt ptbegint="" ptstartt="" ptlistt="" ptcaset="" ptinstancet="" ttresolvedt="" ttassertt="" ttnamet="" > rhlcasefor</mfdt> </span> > <span
style="font-weight: bold;"> </span> selector name<<span
style="font-weight: bold;"> <mfdt ptbegint="" ptstopt="" ptlistt="" ptcaset="" ptinstancet="" ttnamet="" > /rhlcasefor</mfdt> </span> ><<span
style="font-weight: bold;"> <mfdt ptstartt="" ptvaluet="" ptcaset="" ptinstancet=""> rhlcasefori</mfdt> </span> >instance<<span
style="font-weight: bold;"> <mfdt ptstopt="" ptvaluet="" ptcaset="" ptinstancet=""> /rhlcasefori</mfdt> </span> ><br>
[<a name="istring_body_start_"> </a> <<span
style="font-weight: bold;"> <mfdt ptinstancet="" ptbodyt="" ptexclusivet="" ptcbodyt="" > rhlcbody</mfdt> </span> >]?<br>
</td>
</tr>
<tr align="center">
<td style="vertical-align: top;"> <<span
style="font-weight: bold;"> <mfdt ptstartt="" ttrecordt="" ptcaset="" ptinstancet="" ptfort=""> rhlcaseforr</mfdt> </span> ><<span
style="font-weight: bold;"> <mfdt ptstartt="" ptcaset="" ptinstancet="" ptfort="" ptvaluet="" tttargett=""> rhlcasertspo</mfdt> </span> >target<<span
style="font-weight: bold;"> <mfdt ptstopt="" ptcaset="" ptinstancet="" ptfort="" ptvaluet="" tttargett=""> /rhlcasertspo</mfdt> </span> >
( <mfdt ptmcaset="" ptinstancet="" ptfort="" ttint=""> in</mfdt> <<span
style="font-weight: bold;"> <mfdt ptstartt="" ptvaluet="" ptcaset="" ptinstancet="" ptfort="" ptsmallt="" ptpolart="" ptphysicst=""> rhlcaseisspo</mfdt> </span> >string<<span
style="font-weight: bold;"> <mfdt ptstopt="" ptvaluet="" ptcaset="" ptinstancet="" ptfort="" ptsmallt="" ptpolart="" ptphysicst=""> /rhlcaseisspo</mfdt> </span> >
<mfdt ptmcaset="" ptinstancet="" ptfort="" ptort=""> |</mfdt>
<mfdt ptmcaset="" ptinstancet="" ptfort="" ttmwithint=""> within</mfdt>
if strings<br>
[<<span style="font-weight: bold;"> rhlcaseifri</span> >instance</<span
style="font-weight: bold;"> rhlcaseifri</span> >](<<span
style="font-weight: bold;"> <mfdt ptstartt="" ptselectort="" ptvaluet="" ptcaset="" ptinstancet="" ptift="" ptmat="" ptmelset="" ptelset=""> rhlcaseifsispo</mfdt> </span> >selector value<<span
style="font-weight: bold;"> <mfdt ptstopt="" ptselectort="" ptvaluet="" ptcaset="" ptinstancet="" ptift="" ptmat="" ptmelset="" ptelset=""> /rhlcaseifsispo</mfdt> </span> >)+
<mfdt ptmcaset="" ptinstancet="" ptift="" ttint=""> in</mfdt> <<span
style="font-weight: bold;"> <mfdt ptstartt="" ptvaluet="" ptcaset="" ptinstancet="" ptift="" ptsmallt="" ptpolart="" ptphysicst=""> rhlcaseifsspo</mfdt> </span> >string<<span
style="font-weight: bold;"> <mfdt ptstopt="" ptvaluet="" ptcaset="" ptinstancet="" ptift="" ptsmallt="" ptpolart="" ptphysicst=""> /rhlcaseifsspo</mfdt> </span> >
<mfdt ptmcaset="" ptinstancet="" ptift="" ttmwithint=""> within</mfdt>
(<<span
style="font-weight: bold;"> <mfdt ptstartt="" ptselectort="" ptvaluet="" ptcaset="" ptinstancet="" ptelsift="" ptpolart="" ptphysicst=""> rhlcaseeifsispo</mfdt> </span> >selector value<<span
style="font-weight: bold;"> <mfdt ptstopt="" ptselectort="" ptvaluet="" ptcaset="" ptinstancet="" ptelsift="" ptpolart="" ptphysicst=""> /rhlcaseeifsispo</mfdt> </span> >)+
<<span
style="font-weight: bold;"> <mfdt ptstartt="" ptvaluet="" ptcaset="" ptinstancet="" ptelsift="" ptsmallt="" ptpolart="" ptphysicst=""> rhlcaseeifsspo</mfdt> </span> >string<<span
style="font-weight: bold;"> <mfdt ptstopt="" ptvaluet="" ptcaset="" ptinstancet="" ptelsift="" ptsmallt="" ptpolart="" ptphysicst=""> /rhlcaseeifsspo</mfdt> </span> >
<mfdt ptmcaset="" ptinstancet="" ptift="" ttmwithint=""> within</mfdt>
<<span
style="font-weight: bold;"> <mfdt ptstartt="" ptvaluet="" ptcaset="" ptinstancet="" ptelset="" ptsmallt="" ptpolart="" ptphysicst=""> rhlcaselsespo</mfdt> </span> >string<<span
style="font-weight: bold;"> <mfdt ptstopt="" ptvaluet="" ptcaset="" ptinstancet="" ptelset="" ptsmallt="" ptpolart="" ptphysicst=""> /rhlcaselsespo</mfdt> </span> >
<mfdt ptmcaset="" ptinstancet="" ptelset="" ttmwithint=""> within</mfdt>
or match strings
<<span
style="font-weight: bold;"> <mfdt ptstartt="" ptvaluet="" ptcaset="" ptinstancet="" ptmat="" ptsmallt="" ptpolart="" ptphysicst=""> rhlcasemasspo</mfdt> </span> >string<<span
style="font-weight: bold;"> <mfdt ptstopt="" ptvaluet="" ptcaset="" ptinstancet="" ptmat="" ptsmallt="" ptpolart="" ptphysicst=""> /rhlcasemasspo</mfdt> </span> >
<mfdt ptmcaset="" ptinstancet="" ptmat="" ttmwithint=""> within</mfdt>
<mfdt ptmcaset="" ptinstancet="" ptmelset="" ttint=""> in</mfdt>
<<span
style="font-weight: bold;"> <mfdt ptstartt="" ptvaluet="" ptcaset="" ptinstancet="" ptmelset="" ptsmallt="" ptpolart="" ptphysicst=""> rhlcasemelsespo</mfdt> </span> >string<<span
style="font-weight: bold;"> <mfdt ptstopt="" ptvaluet="" ptcaset="" ptinstancet="" ptmelset="" ptsmallt="" ptpolart="" ptphysicst=""> /rhlcasemelsespo</mfdt> </span> >
<mfdt ptmcaset="" ptinstancet="" ptmelset="" ttmwithint=""> within</mfdt>
)<br>
<<span style="font-weight: bold;"> <mfdt ptstopt="" ttrecordt="" ptcaset="" ptinstancet="" ptfort=""> /rhlcaseforr</mfdt> </span> > </td>
</tr>
<tr align="center">
<td style="vertical-align: top;"> <span style="font-weight: bold;"> </span> [<<span
style="font-weight: bold;"> <mfdt ptinstancet="" ptbodyt="" ptexclusivet="" ptcbodyt="" > /rhlcbody</mfdt> </span> >]?<br>
<<span style="font-weight: bold;"> <mfdt ptendt="" ptstartt="" ptsvaluet="" ptlistt="" ptcaset="" ptinstancet=""> rhltcasefore</mfdt> </span> >instance<<span
style="font-weight: bold;"> <mfdt ptendt="" ptstopt="" ptsvaluet="" ptlistt="" ptcaset="" ptinstancet=""> /rhltcasefore</mfdt> </span> ></td>
</tr>
</tbody>
</table>

CASE FOR/IF


  <rhlcasefor> selector name</rhlcasefor><rhlcasefori>instance</rhlcasefori>
[<rhlcbody>]?
<rhlcaseforr><rhlcasertspo>target</rhlcasertspo> ( in <rhlcaseisspo>string</rhlcaseisspo> | within if strings
[<rhlcaseifri>instance</rhlcaseifri>](<rhlcaseifsispo>selector value</rhlcaseifsispo>)+ in <rhlcaseifsspo>string</rhlcaseifsspo> within (<rhlcaseeifsispo>selector value</rhlcaseeifsispo>)+ <rhlcaseeifsspo>string</rhlcaseeifsspo> within <rhlcaselsespo>string</rhlcaselsespo> within or match strings <rhlcasemasspo>string</rhlcasemasspo> within in <rhlcasemelsespo>string</rhlcasemelsespo> within )
</rhlcaseforr>
[</rhlcbody>]?
<rhltcasefore>instance</rhltcasefore>

Functions

#
sub findbond {# type structure i.e. bond or group
    my ($linksi, $pi, $bondc, $structure) = @_;# with $pi made relative
    my ($bondpresent, $linki);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih}{$bondc};
      print ("findbond linksi $linksi pi $pi bondc $pr ");
      };
    $bondpresent = "";
    $linki = $linksi;#the head attribute
# all objects should have at least one descriptor - but ....
    if ($linki != 0) {# at least one descriptor for this object

      while (($linki != 0) && (!($bondpresent))) {
        if (($Awfif::workspace-> {l} [$linki] [2] == ($Awfif::memes-> {snnh} {wsi} + $pi))
        && ($Awfif::workspace-> {l} [$linki] [3] == $bondc)
# && ($Awfif::workspace-> {l} [$linki] [4] == $Awfif::memes-> {snnh} {bondcategory})){
        && ($Awfif::workspace-> {l} [$linki] [4] == $structure)){

          $bondpresent = "T";# reward for same bonds in proximity
          };#if
        $linki = $Awfif::workspace-> {l} [$linki] [0];
        };#while
      };# there are descriptors to check
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("findbondx ret ($bondpresent)\n");
      };
    return $bondpresent
    }# findbond
#<!-- start tag aso -->
#
sub findtdesc {# type structure i.e. bond or group
    my ($linksi, $structure, $typest, $toost) = @_;#
    my ($structpresent, $linki);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("findtdesc linksi $linksi ");
      };
    $structpresent = 0;
    $linki = $linksi;#the head attribute
# all objects should have at least one descriptor - but ....
    if ($linki != 0) {# at least one descriptor for this object

      while (($linki != 0) && (($structpresent == 0))) {
        if ((defined ($typest)) && (defined ($toost))) {
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [3] == $typest)
          && ($Awfif::workspace-> {l} [$linki] [2] == $toost)
        ){

            $structpresent = $linki;
            };#if
          }#if
        elsif ((!defined ($typest)) && (!defined ($toost)) ){
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)){

            $structpresent = $linki;
            };#if
          }#if
        else {
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [3] == $typest)
          ){

            $structpresent = $linki;
            };#if
          };#else
        $linki = $Awfif::workspace-> {l} [$linki] [0];
        };#while
      };# there are descriptors to check
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("findtdescx ret ($structpresent)\n");
      };
    return $structpresent
    }# findtdesc
#
#
sub findcounter {# find an iterator tagged descriptor
# could be different in each subprogram. In that case the transaction manager id will exist and match element 11 if rolled in or its complement if rolled out
# but the parameters subpid atelhwsoid and active should typically only be used by rolein or roleout code
# masking is conventionally supported by adding 1 to the structure
    my ($linksi, $structure, $arcounter, $tooconc, $typeconc, $subpid, $atelhwsoid, $active) = @_;#
    my ($structpresent, $linki, $transmgrid);
# checked for slipnet per workspace

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("findcounter linksi $linksi ");
      if ( (defined ($subpid))
      && (defined ($atelhwsoid))
      && (defined ($active))
      ){
        print ("subpid $subpid atelhwsoid $atelhwsoid active $active ");
        };#if
      };#if
    $structpresent = "";
    $$arcounter = 0;
    if ((defined ($subpid)) && (defined ($atelhwsoid)) && (defined ($active))) {

      $transmgrid = mapsubtotmgrid ($atelhwsoid, $Awfif::memes-> {snnh} {rtran}, $subpid);
      $transmgrid = $transmgrid * $active;#caller should know if need to match a hidden or active counter
      };
    $linki = $linksi;#the head attribute
# all objects should have at least one descriptor - but ....
    if ($linki != 0) {# at least one descriptor for this object

      while (($linki != 0) && (!($structpresent))) {
        if ( (
          ((defined ($transmgrid)) && ($transmgrid == $Awfif::workspace-> {l} [$linki] [11]))
          or ((defined ($transmgrid)) && ($Awfif::workspace-> {l} [$linki] [11] < 0))
          or (!defined ($transmgrid)) )
        && ((defined ($typeconc)) && (defined ($tooconc) ))
        ){
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [3] == $typeconc)
          && ($Awfif::workspace-> {l} [$linki] [8] == $Awfif::memes-> {snnh}{iterator})
          && ($Awfif::workspace-> {l} [$linki] [2] == ($tooconc + $Awfif::memes-> {snnh} {wsi}))
          ){

            $structpresent = "T";
            $$arcounter = $linki;
            };#if
          }#if
        elsif ( (
          ((defined ($transmgrid)) && ($transmgrid == $Awfif::workspace-> {l} [$linki] [11]))
          or ((defined ($transmgrid)) && ($Awfif::workspace-> {l} [$linki] [11] < 0))
          or (!defined ($transmgrid)) )
        && ((defined ($typeconc)) && (!defined ($tooconc) ))
        ){
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [3] == $typeconc)
          && ($Awfif::workspace-> {l} [$linki] [8] == $Awfif::memes-> {snnh}{iterator})
          ){

            $structpresent = "T";
            $$arcounter = $linki;
            };#if
          }#if
        elsif ( (
          ((defined ($transmgrid)) && ($transmgrid == $Awfif::workspace-> {l} [$linki] [11]))
          or ((defined ($transmgrid)) && ($Awfif::workspace-> {l} [$linki] [11] < 0))
          or (!defined ($transmgrid)) )
        && (defined ($tooconc) )
        ) {
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [8] == $Awfif::memes-> {snnh}{iterator})
          && ($Awfif::workspace-> {l} [$linki] [2] == ($tooconc + $Awfif::memes-> {snnh} {wsi}))
          ){

            $structpresent = "T";
            $$arcounter = $linki;
            };#if
          }#if
        elsif (
        ((defined ($transmgrid)) && ($transmgrid == $Awfif::workspace-> {l} [$linki] [11]))
        or ((defined ($transmgrid)) && ($Awfif::workspace-> {l} [$linki] [11] < 0)) #there is an inactive shell that can be updated by rolein with the transmgrid
        or (!defined ($transmgrid))
        ) {
          if (($Awfif::workspace-> {l} [$linki] [4] == $structure)
          && ($Awfif::workspace-> {l} [$linki] [8] == $Awfif::memes-> {snnh}{iterator})
          ){

            $structpresent = "T";
            $$arcounter = $linki;
            };#if
          };#elsif
        $linki = $Awfif::workspace-> {l} [$linki] [0];
        };#while
      };# there are descriptors to check
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("findcounterx arcounter $$arcounter ret ($structpresent)\n");
      };
    return $structpresent
    }# findcounter
#
#
sub addwfcdef {
# setup the structures to support linked details of vbot wf deferred codelets
    my ($myli, $codeletdef, $slinkh) = @_;# must be the subpscdef head's index for this structure list or 0
    my ($nslinkh);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addwfcdef ");
      if ( (defined ($myli)) ){
        print ("myli $myli ");
        };#if
      print ("slink $slinkh ");
      };
    $nslinkh = addhli ($slinkh, \$Awfif::wfcdefl);

    if ($nslinkh == $Awfif::wfcdefl-> {f}) {&break();};
# setup the links data

    $Awfif::wfcdefl-> {l} [$nslinkh][2] = $codeletdef;

    if (($Awfif::wfcdefl-> {hash} {$codeletdef})
    && ($Awfif::wfcdefl-> {l} [$Awfif::wfcdefl-> {hash} {$codeletdef}] [6])
    ){#remove any stale wfcdefl item still hanging around

      $Awfif::memes-> {wfcdef} = freewfcdef ($codeletdef, $Awfif::wfcdefl-> {hash} {$codeletdef}, $Awfif::memes-> {wfcdef});
      }#if
    elsif (($Awfif::wfcdefl-> {hash} {$codeletdef})
    ){#inconsistant item still using codeletdef

      &break ();
      };#elsif
    if ( (defined ($codeletdef))
    && ($codeletdef > 0)
    ){

      $Awfif::wfcdefl-> {hash} {$codeletdef} = $nslinkh;
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addwfcdefx ret $nslinkh\n");
      };

    return $nslinkh
    }# addwfcdef
#
sub freewfcdef {
    my ($codelet, $delid, $head) = @_;
#
# checked for merged workspaces

# move the wfcdef item to the inactive list
    my ($plink, $found, $name);
    $plink = $head;
    $found = $delid;

    if ($found != 0){

      $name = $Awfif::wfchchainl-> {l} [$Awfif::wfcdefl-> {l} [$found] [7]] [3];
      &freewfchchain ($Awfif::wfcdefl-> {l} [$found] [7]);
      if ($found == $head){

        $plink = freehli ($found, \$Awfif::wfcdefl);
        }#if
      else {

        &freehli ($found, \$Awfif::wfcdefl);
        };#else
      $Awfif::wfcdefl-> {l} [$found] [2] = 0;#codeletid
      $Awfif::wfcdefl-> {l} [$found] [3] = ();#direction
      $Awfif::wfcdefl-> {l} [$found] [4] = ();#desstate
      $Awfif::wfcdefl-> {l} [$found] [5] = ();#desname
      $Awfif::wfcdefl-> {l} [$found] [6] = ();#activated
      $Awfif::wfcdefl-> {l} [$found] [7] = ();#hchain element
      if ((defined ($codelet)) && ($Awfif::wfcdefl-> {hash} {$codelet} == $found)){

        $Awfif::wfcdefl-> {hash} {$codelet} = ();#linkid
        };#if
      if ($Awfif::wfcdefl-> {hashb} {$Awfif::wfcdefl-> {l} [$found] [8]} == $found){

        $Awfif::wfcdefl-> {hashb} {$Awfif::wfcdefl-> {l} [$found] [8]} = ();
        };#if
      $Awfif::wfcdefl-> {l} [$found] [8] = ();#builder id
      };#if
    return $plink
    }#freewfcdef
#
#<!-- start tag vbt -->
#
sub setupdesc {
    my ($ltype, $to, $from, $dlinkh, $awso, $synccod) = @_;# must be the workspace head's index for this descriptor list or 0

# create an active descriptor
#
# checked for merged workspaces
    my ($ndlinkh);
# setupdescuf

    $Awfif::wsolfbs [$awso] [23 - $Awfif::memes-> {flagsoffset}] = 2;
    $Awfif::wsolfbs [$awso] [24 - $Awfif::memes-> {flagsoffset}] = 2;
    if (($Awfif::wsolfbs [$awso] [25 - $Awfif::memes-> {flagsoffset}]) != 3) {

      $Awfif::wsolfbs [$awso] [25 - $Awfif::memes-> {flagsoffset}] = 2;
      };
    $Awfif::wsolfbs [$awso] [27 - $Awfif::memes-> {flagsoffset}] = 2;
    $Awfif::wsolfbs [$awso] [28 - $Awfif::memes-> {flagsoffset}] = 2;
    $ndlinkh = addhli ($dlinkh, \$Awfif::workspace);
# setup the links data
    $Awfif::workspace-> {l} [$ndlinkh][2] = $to;
    $Awfif::workspace-> {l} [$ndlinkh][3] = $ltype;
    $Awfif::workspace-> {l} [$ndlinkh][4] = $from;
# setupdsyncu1
    &isetupsync ($ltype, $to, $from, $awso, $synccod);
# setupdsyncu2
# setupdsyncu3
# setupd34u2
# setupdsyncu4
## inverted in isetupsync
    return $ndlinkh
    }# setupdesc
#
sub isetupsync {
    my ($ltype, $to, $from, $awso, $synccod) = @_;# must be the workspace head's index for this descriptor list or 0

    if ((defined ($synccod))
    && ($synccod)
    && ((defined ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}])) && ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] > 0))
    ) {
# isetupdsyncu2

      my ($linki, $found);
      $found = 0;
      $linki = $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}];

      while (($found == 0) && ($linki != 0)) {
        if (($Awfif::syncl-> {l} [$linki] [2] == $to)
        && ($Awfif::syncl-> {l} [$linki] [3] == $ltype)
        && ($Awfif::syncl-> {l} [$linki] [4] == $from)
        ){

          $found = $linki;
          };#if
        $linki = $Awfif::syncl-> {l} [$linki] [0];
        };#while
# isetupdsyncu3
# Move codelet's from the sublist associated with the specific descriptor to the active list.
      if ($found != 0) {

        $linki = $Awfif::syncl-> {l} [$found] [5];# index of synccodl element
# isetupd34u2

        &ilwaiting ($linki, 't', \$Awfif::syncl-> {l} [$found] [5], \$Awfif::syncl-> {l} [$found] [6]);#
# isetupdsyncu4
## inverted in ilwaiting
        };#if
      };#if
    }# isetupsync
#
#<!-- end tag vbt -->
#
sub waitondesc {
    my ($myli, $awso, $desc2, $desc3, $desc4, $iprocname, $kwp, $kwpr, $sactset, $codeletdef, $actref) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($trace, $nlinki);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;
# process request for synchronization with a description event
# submitcodelet the caller, into a deferred codelet queue,
# waitondesciqu1

    &queinhordef ($myli, $iprocname, $kwp, $kwpr, \@$sactset, \$$codeletdef);

    if ((defined ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}])) && ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] > 0)) {
      my ($linki, $found);
      $found = '';
      $linki = $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}];
      while ((!$found) && ($linki != 0)) {
        if (($Awfif::syncl-> {l} [$linki] [2] == $desc2)
        && ($Awfif::syncl-> {l} [$linki] [3] == $desc3)
        && ($Awfif::syncl-> {l} [$linki] [4] == $desc4)
        ){
          $found = 't';
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

          $Awfif::syncl-> {l} [$linki] [5] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::syncl-> {l} [$linki] [5], \$Awfif::syncl-> {l} [$linki] [6]));
          if (($$codeletdef != $Awfif::memes-> {codeletdef}) && ($$codeletdef != 0)) {#the submitted codelet has been moved to its own queue

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2] = $$codeletdef;
            if (defined ($actref)){

              $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [3] = $actref;
              };#if
            }#if
          elsif (($$codeletdef == $Awfif::memes-> {codeletdef})) {#still have to move the codelet to its own queue

            if (!defined ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2])) {

              $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2] = 0;
              };#if
            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2] = ($$codeletdef = mdefhcodelettolist ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2]));
            if (defined ($actref)){

              $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [3] = $actref;
              };#if
            };#else
          };
        $linki = $Awfif::syncl-> {l} [$linki] [0];
        };#while
      if (!$found) {#new descriptor list to be setup

        $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] = addli (\$Awfif::syncl, \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}], \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosynclt}]);
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [2] = $desc2;
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [3] = $desc3;
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [4] = $desc4;
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = 0; #Each descriptor should have its own list of codelets with a unique head
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6] = 0; #Each descriptor should have its own list of codelets with a unique tail
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5], \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6]));
        if (($$codeletdef != $Awfif::memes-> {codeletdef}) && ($$codeletdef != 0)) {#the submitted codelet has been moved to its own queue

          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = $$codeletdef;
          if (defined ($actref)){

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
            };#if
          }#if
        elsif (($$codeletdef == $Awfif::memes-> {codeletdef})) {#still have to move the codelet to its own queue

          if (!defined ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2])) {

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = 0;
            };#if
          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = ($$codeletdef = mdefhcodelettolist ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2]));
          if (defined ($actref)){

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
            };#if
          };#else
        };#if
      }#if
    else {

      $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] = 0;
      $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosynclt}] = 0;
      $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] = addli (\$Awfif::syncl, \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}], \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosynclt}]);
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [2] = $desc2;
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [3] = $desc3;
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [4] = $desc4;
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = 0; #Each descriptor should have its own list of codelets with a unique head
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6] = 0; #Each descriptor should have its own list of codelets with a unique tail
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = ($nlinki = addli ( \$Awfif::synccodl, \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5], \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6]));
      if (!defined ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2])) {

        $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = 0;
        };#if
      if (($$codeletdef != $Awfif::memes-> {codeletdef}) && ($$codeletdef != 0)) {#the submitted codelet has been moved to its own queue

        $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = $$codeletdef;
        if (defined ($actref)){

          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
          };#if
        }#if
      elsif (($$codeletdef == $Awfif::memes-> {codeletdef})) {#still have to move the codelet to its own queue

        $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = ($$codeletdef = mdefhcodelettolist ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2]));
        if (defined ($actref)){

          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
          };#if
        };#else
      };#else
    if ( ( ($$codeletdef > 0)
    && ($Awfif::codelet-> {t} [$$codeletdef] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$$codeletdef] [2])) )
    ){

      break ();
      }#if

    $Awfif::memes-> {trace} = $trace;
    return ($nlinki)
    }# waitondesc
#
#<!-- end tag vbt -->
#
sub waitonstrancomp {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#
    my ($trace, $nlinki, $stran, $subp11i, $cdef);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;
# process request for synchronization with a sub transaction complete event
# submitcodelet the caller, into a deferred codelet queue,

    &queinhordef ($myli, undef(), $kwp, $kwpr, \@$sactset, \$cdef);
    if (($cdef != 0) && ($cdef == $Awfif::memes-> {codeletdef})) {#the submitted codelet has not been moved to its own queue yet

# find the sub transaction - its the tral entry referred in the subpl [11] set that has the requester referenced in the tral->{i} data structure
      $subp11i = findsubpicnm ($myli, $Awfif::codelet-> {l} [$myli] [36], $Awfif::codelet-> {l} [$myli] [2]);
      $stran = $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli][36]] [11] [$subp11i];
# waitonstrancomh
# and get the head entry at the required tral identifying a synchronization list.
# its in the 0 item of the $Awfif::tral-> {w} if its present

      if ( (defined ($Awfif::tral-> {w} [$stran] [0]))
      && ($Awfif::tral-> {w} [$stran] [0] > 0)
      ){#already got a sync head setup
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

        $Awfif::tral-> {w} [$stran] [0] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::tral-> {w} [$stran] [0], \$Awfif::tral-> {wt} [$stran] [0]));
        $Awfif::synccodl-> {l} [$nlinki] [2] = mdefhcodelettolist ($Awfif::synccodl-> {l} [$nlinki] [2]);
        }#if
      else {#setup a new sync head for the request

# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

        $Awfif::tral-> {w} [$stran] [0] = 0;
        $Awfif::tral-> {wt} [$stran] [0] = 0;
        $Awfif::tral-> {w} [$stran] [0] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::tral-> {w} [$stran] [0], \$Awfif::tral-> {wt} [$stran] [0]));
        $Awfif::synccodl-> {l} [$nlinki] [2] = mdefhcodelettolist (0);
        };#else
      };#if

    $Awfif::memes-> {trace} = $trace;
    return ($nlinki)
    }# waitonstrancomp
#
#<!-- end tag ds -->
#<!-- start tag vbt -->
#
sub queinhordef {
    my ($myli, $iprocname, $kwp, $kwpr, $sactset, $codeletdef) = @_;#
    my ($trace, $procname, $submiticodelet);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;
# process request for synchronization with a sub transaction complete event
# submitcodelet the caller, into a deferred codelet queue,

    $submiticodelet = '';
    $Awfif::clp = ();
    if ((defined ($iprocname)) ) {

      $submiticodelet = 't';
      }#if
    $procname = setupprocname ($myli, $iprocname);
    $$codeletdef = $Awfif::memes-> {codeletdef};
    if ($submiticodelet) {
# this codelet is going in the deferred queue. It is not active but won't age out until moved back to the active queue

      &loadclp ($myli, \$Awfif::clp, \@{$Awfif::inhibl-> {clpa}}, $Awfif::codelet-> {l} [$myli] [24]);
      $Awfif::clp-> {inhib}-> {ilinkp} = $Awfif::codelet-> {l} [$myli] [24];
      $Awfif::clp-> {urgency} = ($Awfif::clp-> {urgency} * $Awfif::memes-> {ilaunchm});
      $Awfif::clp-> {strategy} = $procname;
      &groupsinv1 ($myli, undef(), undef(), undef(), undef(),undef(), $procname, $kwp, $kwpr, $sactset, 't');
# when the codelet is made active it won't age out and will be raised in priority until it runs
      if ($$codeletdef != $Awfif::memes-> {codeletdef}) {

        if (!defined ($Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3])) {

          $Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3] = 0;
          };#if
        $Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3] = ($$codeletdef = mdefhcodelettolist ($Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3]));
        $Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [4] = $procname;
        }#if
      else {

        $$codeletdef = 0;
        };#else
      }#if
    else {

      $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
      $Awfif::clp-> {urgency} = $Awfif::codelet-> {l} [$myli][3];
      $Awfif::clp-> {strategy} = $procname;
      $Awfif::clp-> {action}-> {sponsor} = $Awfif::codelet-> {l} [$myli][17];
      $Awfif::clp-> {action}-> {signal} = $Awfif::codelet-> {l} [$myli][16];
      $Awfif::clp-> {action}-> {schema} = $Awfif::codelet-> {l} [$myli][18];
      $Awfif::clp-> {action}-> {ref} = $Awfif::codelet-> {l} [$myli][4];
      $Awfif::clp-> {action}-> {sws} = $Awfif::codelet-> {l} [$myli] [20];
      $Awfif::clp-> {action}-> {wss} = $Awfif::codelet-> {l} [$myli][21];
      $Awfif::clp-> {action}-> {wse} = $Awfif::codelet-> {l} [$myli][22];
      &groupsinv1 ($myli, undef(), undef(), undef(), undef(),undef(), $procname, $kwp, $kwpr, $sactset, 't');
      if ($$codeletdef != $Awfif::memes-> {codeletdef}) {

        $$codeletdef = $Awfif::memes-> {codeletdef};
        }#if
      else {

        $$codeletdef = 0;
        };#else
      };#else
    if ( ( ($$codeletdef > 0)
    && ($Awfif::codelet-> {t} [$$codeletdef] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$$codeletdef] [2])) )
    or ( ($Awfif::memes-> {codeletdef} > 0)
    && ($Awfif::codelet-> {t} [$Awfif::memes-> {codeletdef}] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletdef}] [2])) )
    ){

      break ();
      }#if

    $Awfif::memes-> {trace} = $trace;
    }# queinhordef
#
#<!-- end tag vbt -->
#<!-- start tag sia -->
#<!-- start tag ds -resweb -->
#
sub notwaitonelkd {
    my ($myli, $sponsor, $grkwp, $grkwpr, $sactset) = @_;# start index into synccodl list of codelets all waiting on this event
    my ($dontwait, $cwsbi, $atelhwso, $asponsor, $stwso, $astwso);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notwaitonelkd sponsor($sponsor) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $dontwait = 't';
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $atelhwso = awsoadr (trwsoadr ($sponsor,-1));
    $asponsor = awsoadr ($sponsor);
# Find the statement wso and obtain the statement's wso type
    $stwso = igetmynowner ($myli, $sponsor, 'bustatement', $grkwp, $grkwpr);
    $astwso = awsoadr ($stwso);

    my ($bcount, $cws, $bcwso, $abcwso, $sldesc, $reportdesc, $areportwso, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    $bcount = ifindb ($myli, $stwso, 'binderc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $grkwp, $grkwpr, \@$sactset);
    $bcwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
    $Awfif::memes-> {currentwsbi} = $cws;
    $abcwso = awsoadr ($bcwso);
# find the transcription factor binding
    if ($bcount == 1) {

      if ( ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
      && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {initiate})) != 0 )
      ){

        $Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$reportdesc] [3] - $Awfif::memes-> {snnh} {wsi});
        $areportwso = awsoadr (($Awfif::workspace-> {l} [$reportdesc] [2] - $Awfif::memes-> {snnh} {wsi}));
# if end list kw has not reached end of list then if not issued waitondesc do so
        if ((findtdesc ($Awfif::wsol-> {l} [$areportwso][2], $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {found}, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi})) == 0)
        && ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36] ] == 0)
        ){#wait

          my ($bcindex);
          &waitondesc ($myli, $areportwso, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi}), $Awfif::memes-> {snnh} {found}, $Awfif::memes-> {snnh} {model}, undef(), undef(), undef(), undef(), \$Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]]);
          $Awfif::codelet-> {l} [ $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]] ] [35] = $Awfif::codelet-> {l} [$myli] [35];
          $Awfif::codelet-> {l} [ $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]] ] [36] = $Awfif::codelet-> {l} [$myli] [36];
          $Awfif::codelet-> {l} [ $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]] ] [37] = $Awfif::codelet-> {l} [$myli] [37];
          $Awfif::subpl-> {q} [2] [0]++;#stops amplifier inhibition while positive
          $dontwait = '';
# notwaitbcu1
          $bcindex = matchbreakcodelet ($myli);
          if (($bcindex > 0) #handle break codelet
          && (matchbreakcodelet ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]]) == 0) #not already in list
          ){

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]];
            }#if
          elsif ($bcindex > 0){#just remove the myli reference from the break datastructure

            &remarrent ($bcindex, \@{$Awfif::memes-> {breakcodelet}});
            if ($Awfif::codelet-> {l} [$myli] [36] > 0){#remove subprogram reference

              &remarrent ($bcindex, \@{$Awfif::memes-> {breaksubp}});
              };#if
            };#elsif
          }#if
        elsif ((findtdesc ($Awfif::wsol-> {l} [$areportwso][2], $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {found}, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi})) == 0)
        && ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36] ] != 0)
        ){#wait

          $dontwait = '';
          my ($bcindex);
          $bcindex = matchbreakcodelet ($myli);
          if (($bcindex > 0) #handle break codelet
          && (matchbreakcodelet ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]]) == 0) #not already in list
          ){

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]];
            }#if
          elsif ($bcindex > 0){#just remove the myli reference from the break datastructure

            &remarrent ($bcindex, \@{$Awfif::memes-> {breakcodelet}});
            if ($Awfif::codelet-> {l} [$myli] [36] > 0){#remove subprogram reference

              &remarrent ($bcindex, \@{$Awfif::memes-> {breaksubp}});
              };#if
            };#elsif
          }#elsif
        elsif ((findtdesc ($Awfif::wsol-> {l} [$areportwso][2], $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {found}, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi})) != 0)
        && ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36] ] != 0)
        ){#wait

          $Awfif::subpl-> {q} [2] [$Awfif::codelet-> {l} [$myli] [36] ] = undef ();
          $Awfif::subpl-> {q} [2] [0]--;
          };#elsif
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notwaitonelkdx ret($dontwait) ");
      };
    return $dontwait;
    }# notwaitonelkd
#
#<!-- end tag ds -->
#<!-- end tag sia -->
#<!-- start tag vbt -->
#
sub ilwaiting {
    my ($ilinki, $set34, $head, $tail) = @_;# start index into synccodl list of codelets all waiting on this event
    my ($plinki,$linki);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ilwaiting ilinki($ilinki) ");
      };
    $linki = $ilinki;#modifiable local copy
    while ($linki != 0) {
# move the codelet to the active queue

      my ($linkp, $oh, $olp0, $olp1);
      $linkp = $Awfif::synccodl-> {l} [$linki][2];#the codelet id
# ilwaitactu1
      if (($Awfif::wfcdefl-> {hash} {$linkp} > 0)
      && (defined ($Awfif::synccodl-> {l} [$linki][3]))
      ){

        ${$Awfif::synccodl-> {l} [$linki][3]} = 't';
        };#if
      $oh = $Awfif::memes-> {codeleth};
      if ($oh != 0) {

        $Awfif::codelet-> {l} [$oh] [1] = $linkp;
        };#if
      $olp0 = $Awfif::codelet-> {l} [$linkp] [0];
      $olp1 = $Awfif::codelet-> {l} [$linkp] [1];
      $Awfif::codelet-> {l} [$linkp] [0] = $oh;
      $Awfif::codelet-> {l} [$linkp] [1] = 0;
      if ($Awfif::codelet-> {t} [$linkp] != $Awfif::memes-> {snnh} {active} ){

        $Awfif::codelet-> {t} [$linkp] = $Awfif::memes-> {snnh} {active};
        $Awfif::memes-> {acodelets} ++;
        if ($Awfif::memes-> {acodelets} > $Awfif::memes-> {tcodelets} ){ &break ();};
        };#if
      if ($set34) {

        $Awfif::codelet-> {l} [$linkp] [34] = 1;
        };
      $Awfif::memes-> {codeleth} = $linkp;
      if (($Awfif::memes-> {codeletdef} == $linkp)) {

        if ($olp0 != 0) {

          $Awfif::codelet-> {l} [$olp0] [1] = 0;
          };#if
        $Awfif::memes-> {codeletdef} = $olp0;
        }#if
      else {

        if ($olp0 != 0) {

          $Awfif::codelet-> {l} [$olp0] [1] = $olp1;
          };#if
        if ($olp1 != 0) {

          $Awfif::codelet-> {l} [$olp1] [0] = $olp0;
          };#if
        }# else
# report if new active head is circular

      if (($Awfif::codelet-> {l} [$linkp] [0] == $Awfif::codelet-> {l} [$linkp] [1]) && ($linkp != $Awfif::memes-> {codelett})) { &break ();};
# and delete the synccodl entry

      $plinki = $linki;
      $linki = $Awfif::synccodl-> {l} [$linki] [0];
      &freeli ($plinki, \$Awfif::synccodl, \$$head, \$$tail);
      $Awfif::synccodl-> {l} [$plinki] [2] = 0;#remove the codelet index
      $Awfif::synccodl-> {l} [$plinki] [3] = ();#remove the activated pointer if set
      };#while
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ilwaitingx ret($linki) ");
      };
    return $linki;
    }# ilwaiting
#
#<!-- end tag vbt -->
#
sub inccounter {
    my ($pltype, $pto, $from, $dlinkh, $awso, $synccod, $sltype, $spto, $transmgrid, $atelhwso, $active, $rcounteri) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($ltype, $to, $ndlinkh, $mcounteri, $counteri, $mp, $nmp, $subpid, $mask, $val);

    if (!defined ($pltype)) {

      $ltype = $Awfif::memes-> {snnh} {iterator};
      }# if
    else {

      $ltype = $pltype;
      };
    if (!defined ($pto)) {

      $to = ($Awfif::memes-> {snnh} {wsi} + 1);
      }# if
    else {

      $to = $pto;
      };
    if ((defined ($transmgrid)) && (defined ($atelhwso)) && (defined ($active))) {

      $subpid = maptmgrtosubpid ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid);
      };# if
    if ((!($mp = findcounter ($Awfif::wsol-> {l} [$awso][2], ($from+1), \$mcounteri, ($spto), $sltype)))# using the param form of to and type to leverage the define state
    && (!($nmp = findcounter ($Awfif::wsol-> {l} [$awso][2], ($from), \$counteri, ($spto), $sltype)))
    ){#no counter so create a new one

      $ndlinkh
        = setupdesc (
          $ltype,
          $to,
          $from,
          $dlinkh,
          $awso,
          $synccod);
      $Awfif::workspace-> {l} [$ndlinkh] [8] = $Awfif::memes-> {snnh} {iterator};
      $Awfif::workspace-> {l} [$ndlinkh] [9] = ($Awfif::memes-> {snnh} {wsi} + 1);
      if (defined ($transmgrid)) {

        $Awfif::workspace-> {l} [$ndlinkh] [11] = ($transmgrid * $active);
        &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$ndlinkh] [9]);
        };#if
      if (defined ($$rcounteri)){

        $$rcounteri = $ndlinkh;
        };#if
      }#if
    elsif (($mp) #if $mp is true it means was a masked item so update here if its false then there was a non-masked item handle in next clause
    ){#currently masked

      if ((!defined ($transmgrid)) or (!defined ($subpid))) {

        $Awfif::workspace->{l} [$mcounteri][4]--;
        }#if
      else {

        if (!defined ($Awfif::workspace-> {l} [$mcounteri] [11])) {

          $Awfif::workspace-> {l} [$mcounteri] [11] = ($transmgrid * $active);
          &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$mcounteri] [9]);
          }#if
        else {

          $mask = -1;
          $val = -1;
          &gettmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, \$mask, \$val);#gettmgrdesc has an odd interface true means the value in trans mgr exists and is unmasked.
          if ($mask >= 0) {
# found values so deploy them and then update them removing any mask

            $Awfif::workspace-> {l} [$mcounteri] [9] = $val;
            if ($mask == 0) {#inc the val since was not masked in trans storage

              $Awfif::workspace-> {l} [$mcounteri] [9]++;
              };#if
            &updtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$mcounteri] [9]);
            };#if
          };#else
        $Awfif::workspace->{l} [$mcounteri][4]--;
        };#else
# inccountsusu1
      &isetupsync ($ltype, $to, $from, $awso, $synccod);
      $ndlinkh = $dlinkh;
      if (defined ($$rcounteri)){

        $$rcounteri = $mcounteri;
        };#if
      }# elsif
    else {# found active descriptor increment counter

      if ((!defined ($transmgrid)) or (!defined ($subpid))) {#if this isnt backed up by tmass data then just increment

        $Awfif::workspace->{l} [$counteri][9]++;
        }#if
      else {#need to see if there is tmass data for this transaction manager id

        if ((!defined ($Awfif::workspace-> {l} [$counteri] [11])) # transaction binding never setup so do it now
        ){

          $Awfif::workspace-> {l} [$counteri] [11] = ($transmgrid * $active);
          &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$counteri] [9]);
          }#if
        else {#these are transaction managed but must ensure that this transaction manager record is setup

          $mask = -1;
          $val = -1;
          &gettmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, \$mask, \$val);
          if ($mask >= 0) {
# found values so deploy them and then update them removing any mask

            $Awfif::workspace-> {l} [$counteri] [9] = $val;
            &updtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$counteri] [9]);
            }#if
          else {#this manager transaction has not been setup so add it

            &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, 0);
            $Awfif::workspace-> {l} [$counteri] [11] = ($transmgrid * $active);
            $Awfif::workspace->{l} [$counteri][9] = ($Awfif::memes-> {snnh} {wsi} + 0);
            };#else
          $Awfif::workspace->{l} [$counteri][9]++;
          };#else
        };#else
# inccountsusu2
      &isetupsync ($ltype, $to, $from, $awso, $synccod);
      $ndlinkh = $dlinkh;
      if ((defined ($transmgrid)) && (defined ($subpid)) && ($Awfif::workspace->{l} [$counteri][11] != 0)) {

        &updtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, undef (), $Awfif::workspace->{l} [$counteri][9]);
        };#if
      if (defined ($$rcounteri)){

        $$rcounteri = $counteri;
        };#if
      };#else
    if ((!defined ($ndlinkh)) or ($ndlinkh == 0)) {&break()};
    if ((defined ($$rcounteri)) && ($$rcounteri == 0)) {&break()};
    return $ndlinkh
    }# inccounter
#
#
sub maskcounter {
    my ($from, $awso, $tooconc, $type) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($counteri);

    if ((findcounter ($Awfif::wsol-> {l} [$awso][2], ($from), \$counteri, $tooconc, $type))
    ){

      $Awfif::workspace->{l} [$counteri][4]++;
      $Awfif::workspace->{l} [$counteri][9] = ($Awfif::memes-> {snnh} {wsi} + 1);#get rid of the bias for unmasking
      };#if
    }# maskcounter
sub bondbuilder1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($bondpresent, $from, $to,
    $sponsor, $grkwp, $grkwpr, $signal, $schema, $swstype,#dummies for inverted proc get context
    $cdn, $cdnx);
#
# setup a bond if situation acceptable

    $bondpresent = "";
    &updatelog ($myli,'bb',1, $Awfif::codelet-> {l} [$myli][13]);
# first check whether the proposed bond hasn't been built in the mean time.
# - check the descriptor list at one end of the bond to see if their is a descriptor
# for a bond category of the required type and to the target
    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, 't', \$cdn, \$cdnx, 3)) {
    $bondpresent = findbond ($Awfif::wsol-> {l} [ awsoadr ($Awfif::codelet-> {l} [$myli] [4])] [2], $Awfif::codelet-> {l} [$myli][7], $Awfif::codelet-> {l} [$myli][6], $Awfif::memes-> {snnh} {bondcategory});
    &updatelog ($myli,'bb',2, $bondpresent);
#

    if (!($bondpresent)) {
      my ($afrom);
# If not,
# it will fight any incompatible structures. And
# if it wins, it will
# destroy all incompatible structures,
# build the new bond and
      &clrbuilder1 ($myli, \$from, \$to, $$kwp, $kwpr, \@$sactset);

      print ("bc from=$from, to=$to\n");
      &updatelog ($myli,'bb',3, $to);
      $afrom = awsoadr ($from);
      &setusalcwsocache ($afrom, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bubond}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdbond}]) ), undef());
      $Awfif::wsol-> {l} [$afrom][2]
      = setupdesc ( $Awfif::codelet-> {l} [$myli][6],
          ($Awfif::memes-> {snnh} {wsi} + $to),
          $Awfif::memes-> {snnh} {bondcategory},
          $Awfif::wsol-> {l} [$afrom][2],
          $afrom);
      $Awfif::memes-> {fatp} = $Awfif::memes-> {fatp} + $Awfif::memes-> {batp};
      &updatelog ($myli,'bb',7, $Awfif::wsol-> {l} [$afrom][2]);
# send activation to the involved Slipnet nodes

      &actnodes ( $Awfif::codelet-> {l} [$myli][6], $Awfif::memes-> {bondatype});
      &actnodes ( $Awfif::memes-> {snnh} {wsi}, $Awfif::memes-> {bondato});
      &invcaches (wsbasetype ($from));
      &invcaches (wsbasetype ($to));
      };#if no bond
      };# proceed wrap
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# bondbuilder1
#
#<!-- start tag ca -->
#
sub bondevaluator1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#codelet launch architecture requires the ignored parameters for its general interface
    my ($dobonding, $ni, $pi, $nidl, $sgdi, $sbind,
    $sponsor, $grkwp, $grkwpr, $signal, $schema, $swstype,#dummies for inverted proc get context
    $cdn, $cdnx);
# validate bonding of two salient objects from the workspace & adjust temperature
#
# from the strength of the bond decide if it should proceed
# strength assessment has two facets:
# depth of the concepts connected to the workspace structure
# how well proposed structure fits in with surroundings
# i.e. presence of similar bonds in the neighbourhood
#
# if the structures in the workspace look synergistic lower the temperature
#
#
# checked for merged workspaces



    &updatelog ($myli,'be',1, $Awfif::codelet-> {l} [$myli][13]);
    if (( $Awfif::codelet-> {l} [$myli][5] != 0) # nidl
    && (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, 't', \$cdn, \$cdnx, 3))
    && ( $Awfif::codelet-> {l} [$myli][6] != 0) # nsnn
    && ( $Awfif::codelet-> {l} [$myli][8] != 0) # pidl
    && ( $Awfif::codelet-> {l} [$myli][9] != 0)
# for adjacent bonds will need to use sbind check to allow second bond in other direction to proceed
    && (!fsgrpd ($myli, $Awfif::codelet-> {l} [$myli][4], \$sgdi, $Awfif::memes-> {snnh} {bondcategory}, $Awfif::codelet-> {l} [$myli][6], \$sbind))) {# worth evaluating launch
      &updatelog ($myli,'be',2, $Awfif::codelet-> {l} [$myli][13]);
      $ni = $Awfif::codelet-> {l} [$myli][4];
      $pi = $Awfif::codelet-> {l} [$myli][7];
      if (wsocmatch ($ni, $Awfif::codelet-> {l} [$myli][6], ($pi + $Awfif::memes->{snnh}{wsi}), \$nidl)) {#try bonding

        $dobonding = clrevaluator1 ($myli, $Awfif::memes-> {bondamp}, $Awfif::memes-> {bondrwd}, $$kwp, $kwpr, \@$sactset);
        &updatelog ($myli,'be',3, $dobonding);
        if ($dobonding > $Awfif::memes-> {bondbar}) {# build the bond

          &updatelog ($myli,'be',5, $pi);
          $Awfif::clp = ();
          $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
          $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {blaunchm});
          if (defined ($Awfif::codelet-> {l}[$myli][19])) {

            $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
            }#wsi set
          else {

            $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
            };
          $Awfif::clp-> {strategy} = "bondbuilder";
          $Awfif::clp-> {bond}-> {ni} = $Awfif::codelet-> {l} [$myli][4];
          $Awfif::clp-> {bond}-> {nidl} = $Awfif::codelet-> {l} [$myli][5];
          $Awfif::clp-> {bond}-> {pi} = $Awfif::codelet-> {l} [$myli][7];
          $Awfif::clp-> {bond}-> {pidl} = $Awfif::codelet-> {l} [$myli][8];
          $Awfif::clp-> {bond}-> {nsnn} = $Awfif::codelet-> {l} [$myli][6];
          $Awfif::clp-> {bond}-> {psnn} = $Awfif::codelet-> {l} [$myli][9];
          &cdsubmitcodelet ($myli, \$Awfif::clp);
          }# build the bond
        else {#punish failure

          &redcrit ($Awfif::codelet-> {l} [$myli][6]);
          };
        }# try bonding
      else {#do rework by calling in a relation

        &arework ($myli, $Awfif::codelet-> {l} [$myli][4], $Awfif::codelet-> {l} [$myli][11], 'be', $Awfif::codelet-> {l} [$myli][7], $Awfif::workspace-> {l} [$Awfif::codelet-> {l} [$myli][5]][3]);
        };#rework
      }; # evaluation
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# bondevaluator1
#
#<!-- end tag ca -->
#
sub bondscout1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#codelet launch architecture requires the ignored parameters for its general interface
    my ($ni, $nidl, $nsnn, $pi, $pidl, $psnn, $facet, $binding, $model, $cdn, $cdnx);
#
# updated for merged workspaces

    $cdn = clogstat (\$cdnx);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdn myli $myli ");
      &itcpoutput ($myli);
      };
# choose two salient objects from the workspace

    if (selwspair ($myli, \$ni, \$pi, $$kwp, $kwpr, \@$sactset, 'bubond',\$model)) {
      my ($ani);
      $ani = awsoadr ($ni);
# choose a binding facet that could be common to the two items
      $facet = selbondfacet ($$kwp, $kwpr, \@$sactset);
# Do both the ws objects have descriptions that can be bound by this facet
      $Awfif::wsol-> {l}[$ani][8] = setuplog ($myli, #indexing to codelet
                'bs', #method
                $ni, #workspace object
                $pi); #linked workspace object or 0
      $Awfif::codelet-> {l}[$myli][4] = $ni;# updatelog needs this setup
      $binding = usebondfacet ($ni, \$nidl, $pi, \$pidl, $facet);
      &updatelog ($myli,'bs',1, $binding);
      if ($binding) {

# if so see if there is a slipnet bond category link connecting the descriptions
        $binding = usebondcategory ($ni, \$nidl, $pi, \$pidl, \$nsnn, \$psnn);
# if there is a link propose a bond
        &updatelog ($myli,'bs',3, $binding);
        if ($binding) {

          &updatelog ($myli,'bs',4, $pi);
# & call in a bond evaluator with urgency proportional to snet obj distance
          $Awfif::clp = ();
          $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
          $Awfif::clp-> {urgency} = bondurgency ($nidl, $pidl, $nsnn, $psnn);
          if (defined ($Awfif::codelet-> {l}[$myli][19])) {
            $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
            }#wsi set
          else {
            $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
            };
          $Awfif::clp-> {strategy} = "bondevaluator";
          $Awfif::clp-> {bond}-> {ni} = $ni;
          $Awfif::clp-> {bond}-> {nidl} = $nidl;
          $Awfif::clp-> {bond}-> {pi} = $pi;
          $Awfif::clp-> {bond}-> {pidl} = $pidl;
          $Awfif::clp-> {bond}-> {nsnn} = $nsnn;
          $Awfif::clp-> {bond}-> {psnn} = $psnn;

# setup action for getcontext checks
          $Awfif::clp-> {action}-> {wss} = $ni;
          $Awfif::clp-> {action}-> {sws} = $Awfif::memes-> {currentwsbi};
          $Awfif::clp-> {action}-> {wsoname} = getwsoname ($ni);
          &cdsubmitcodelet ($myli, \$Awfif::clp);
          } #got binding
        else {# concept binding failed
          if ($psnn > 0) {
            &redcrit ($psnn);
            };
          };
        }# there is a potential binding
      else {
        &redcrit ($facet);
        };
      }# got a pair to work on
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# bondscout1
sub descbuilder1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#codelet launch architecture requires the ignored parameters for its general interface
    my ($linki, $descpresent, $ni, $ani, $snn, $snl2, $snl3, $snl4,
    $grkwp, $grkwpr, $sponsor, $signal, $schema, $swstype,#dummies for inverted proc get context
    $cdn, $cdnx);
#
# updated for merged workspaces

# have a concept descriptor that needs to be built. Does it have:
    $descpresent = "";
    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, 't', \$cdn, \$cdnx, 3)) {#proceed
    $ni = $Awfif::codelet-> {l} [$myli][4];
    $ani = awsoadr ($ni);
    $linki = $Awfif::wsol-> {l} [$ani] [2];#the head attribute
    if ($linki != 0) {# at least one descriptor for this object

      while ($linki != 0) {
        if (( $Awfif::workspace-> {l} [$linki] [3] == $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][3]) #descriptorproperty
        && ( $Awfif::workspace-> {l} [$linki] [2] == $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][2]) #snnode
        && ( $Awfif::workspace-> {l} [$linki] [4] == $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][4])){#desc
          $descpresent = "T";# reward for same bonds in proximity
          };#if
        $linki = $Awfif::workspace-> {l} [$linki] [0];
        };#while
      };# there are descriptors to check
    &updatelog ($myli,'db',1, $descpresent);
#

    if (!($descpresent)) {
# it will fight any incompatible structures. And
# if it wins, it will
# destroy all incompatible structures,
# build the new description and

      my ($pr);
      $pr = $Awfif::memes-> {currentwsbi};
      $snn = $Awfif::codelet-> {l} [$myli][12];
      $snl2 = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][2]};
      $snl3 = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][3]};
      $snl4 = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][4]};
      print ("dc ni=$pr:$ni snn=$snn snl= 4 $snl4 ,3 $snl3 ,2 $snl2\n");
      &updatelog ($myli,'db',3, $snn);
# if its the property we deploy its in 11 but am deploying 12 the snn
      &setusalcwsocache ($ani, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {budesc}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tddesc}])), undef());
      $Awfif::wsol-> {l} [$ani][2]
      = setupdesc ( $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][3],
          $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][2],
          $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][4],
          $Awfif::wsol-> {l} [$ani][2],
          $ani);
      &updatelog ($myli,'db',7, $Awfif::wsol-> {l} [$ani][2]);
# send activation to the involved Slipnet nodes

      &actnodes ( $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][2], $Awfif::memes-> {descato});
      &updatelog ($myli,'db',4, $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][2]);
      &actnodes ( $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][3], $Awfif::memes-> {descatype});
      &updatelog ($myli,'db',5, $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][3]);
      &invcaches (wsbasetype ($ni));
      };
      };#proceed wrap
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# descbuilder1
#
#<!-- start tag ca -->
#
sub arework {#inverted asignment of rework
    my ($myli, $ni, $property, $cid, $pi, $spconcept) = @_;
    my ($proceed);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("arework myli $myli ni $ni pi $pi property $property cid $cid ");
      &itcpoutput ($myli);
      };
    &updatelog ($myli, $cid, 10, 't');
    $Awfif::clp = ();
    $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
    if ($Awfif::codelet-> {l} [$myli][14] == 0) {#not reworked yet

      $Awfif::clp-> {rework} = $Awfif::memes->{mrework};
      $proceed = 't';
      }
    elsif ($Awfif::codelet-> {l} [$myli][14] == 1) {# stop rework

      $Awfif::clp-> {rework} = $Awfif::codelet-> {l} [$myli][14] - 1;
      $proceed = '';
      } # workspace scouting needs rework
    elsif ($Awfif::codelet-> {l} [$myli][14] > 1) {# can still rework

      $Awfif::clp-> {rework} = $Awfif::codelet-> {l} [$myli][14] - 1;
      $proceed = 't';
      }; # workspace scouting needs rework
    if ($proceed) {
      if ($cid eq 'de') {
# this cache entry is of no interest to the description scout for this wso

        &ignpsnconcl ($property, $Awfif::codelet-> {l} [$myli][12], $cid, $ni);
        $Awfif::clp-> {urgency} = ($Awfif::memes-> {tdbsurg});
        $Awfif::clp-> {strategy} = 'tdescscout';
        $Awfif::clp-> {descriptor}-> {ni} = $ni;
        $Awfif::clp-> {descriptor}-> {property} = $property;
        $Awfif::clp-> {bond} -> {category} = $Awfif::codelet-> {l} [$myli][15];
        &submitcodelet ($myli, \$Awfif::clp);
        &updatelog ($myli, $cid, 11, $Awfif::memes-> {codeleth});
        } # de
      elsif ($cid eq 're') {

        &ignpsnconcl ($property, $Awfif::codelet-> {l} [$myli][6], $cid, $ni);
        $Awfif::clp-> {urgency} = ($Awfif::memes-> {tdbsurg});
        $Awfif::clp-> {strategy} = 'tdescscout';
        $Awfif::clp-> {relation}-> {ni} = $ni;
        $Awfif::clp-> {relation}-> {pi} = $pi;
        $Awfif::clp-> {relation}-> {property} = $Awfif::codelet-> {l} [$myli][11];
        $Awfif::clp-> {relation} -> {category} = $Awfif::codelet-> {l} [$myli][15];
        $Awfif::clp-> {bond} -> {category} = $Awfif::codelet-> {l} [$myli][15];
        &submitcodelet ($myli, \$Awfif::clp);
        &updatelog ($myli, $cid, 11, $Awfif::memes-> {codeleth});
        } # re
      elsif ($cid eq 'ge') {

        $Awfif::clp-> {urgency} = ($Awfif::memes-> {tdbsurg});
        $Awfif::clp-> {strategy} = 'tbondscout';
        $Awfif::clp-> {relation}-> {ni} = $ni;
        $Awfif::clp-> {relation}-> {pi} = $pi;
        $Awfif::clp-> {bond} -> {category} = $spconcept;
        &submitcodelet ($myli, \$Awfif::clp);
        &updatelog ($myli, $cid, 11, $Awfif::memes-> {codeleth});
        &mlog ($myli, #indexing to codelet
          'tbs', #method
          $ni, #workspace object
          $pi); #linked workspace object or 0

        } # ge
      elsif (($cid eq 'be') or ($cid eq 'tbs')) {

        $Awfif::clp-> {urgency} = ($Awfif::memes-> {tdbsurg});
        $Awfif::clp-> {strategy} = 'tdescscout';
        $Awfif::clp-> {relation}-> {ni} = $ni;
        $Awfif::clp-> {relation}-> {pi} = $pi;
        $Awfif::clp-> {relation}-> {property} = $spconcept;
        $Awfif::clp-> {relation} -> {category} = $spconcept;
        $Awfif::clp-> {bond} -> {category} = $spconcept;
        &submitcodelet ($myli, \$Awfif::clp);
        &updatelog ($myli, $cid, 11, $Awfif::memes-> {codeleth});
        &mlog ($myli, #indexing to codelet
          'trs', #method
          $ni, #workspace object
          $pi); #linked workspace object or 0
        } # be
      else {#unknown
        };
      };#if proceed

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("areworkx\n");
      };
    }# arework
sub descevaluator1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($dodescription,
    $grkwp, $grkwpr, $sponsor, $signal, $schema, $swstype,#dummies for inverted proc get context
    $cdn, $cdnx);
#
# checked for merged workspaces

    &updatelog ($myli,'de',1, $Awfif::codelet-> {l} [$myli][13]);
# have a concept descriptor that needs to be built. Does it have:
# *
    if (($Awfif::codelet-> {l} [$myli][4] != 0) # ni
    && (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, 't', \$cdn, \$cdnx, 3))
    && ($Awfif::codelet-> {l} [$myli][12] != 0) # slipnet index
    && ($Awfif::codelet-> {l} [$myli][11] != 0)) {# too (node number)
      &updatelog ($myli,'de',2, $Awfif::codelet-> {l} [$myli][13]);

      if (clwsaevaluator1 ($myli, $$kwp, $kwpr, \@$sactset)) {
        my ($ni, $snn, $snl2, $snl3, $snl4);
        $ni = $Awfif::codelet-> {l} [$myli][4];
        $snn = $Awfif::codelet-> {l} [$myli][12];
        $snl2 = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][2]};
        $snl3 = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][3]};
        $snl4 = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [12]][4]};
        &updatelog ($myli,'de',3, $snn);
        $dodescription = clievaluator1 ($myli, $$kwp, $kwpr, \@$sactset);
        &updatelog ($myli,'de',4, $dodescription);
        if ($dodescription > $Awfif::memes-> {desbar}) {# build the description

          &updatelog ($myli,'de',5, $Awfif::codelet-> {l} [$myli][13]);
          $Awfif::clp = ();
          $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
          $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {blaunchm});
          if (defined ($Awfif::codelet-> {l}[$myli][19])) {
            $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
            }#wsi set
          else {
            $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
            };
          $Awfif::clp-> {strategy} = "descbuilder";
          $Awfif::clp-> {descriptor}-> {ni} = $Awfif::codelet-> {l} [$myli][4];
          $Awfif::clp-> {descriptor}-> {property} = $Awfif::codelet-> {l} [$myli][11];
          $Awfif::clp-> {descriptor}-> {snnode} = $Awfif::codelet-> {l} [$myli][12];
          &cdsubmitcodelet ($myli, \$Awfif::clp);
          }# build the relation
        else {#punnish failure
          &redcrit ($Awfif::codelet-> {l} [$myli][12]);
          };
        }# evaluator accepted scouts proposal
      else {
        &arework ($myli, $Awfif::codelet-> {l} [$myli][4], $Awfif::codelet-> {l} [$myli][11], 'de',);#no $pi
        }; # workspace scouting needs rework
      }; # evaluation
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# descevaluator1
#
#<!-- end tag ca -->
#
sub relbuilder1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($relpresent, $linki, $from, $afrom, $to, $ni, $snni, $pi,
    $grkwp, $grkwpr, $sponsor, $signal, $schema, $swstype,#dummies for inverted proc get context
    $cdn, $cdnx);
#
# updated for merged workspaces

    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, 't', \$cdn, \$cdnx, 3)) {#proceed
# have a conceptual relation that needs to be built.
# *

    $relpresent = "";
    &updatelog ($myli,'rb',1, $Awfif::codelet-> {l} [$myli][13]);
# first check whether the proposed relation hasn't been described in the mean time.
# - check the descriptor list at one end of the bond to see if there is a descriptor
# for a rel category of the required type and to the target
    &clrbuilder1 ($myli, \$from, \$to, $$kwp, $kwpr, \@$sactset);
    $afrom = awsoadr ($from);
    $linki = $Awfif::wsol-> {l} [$afrom][2];#the head attribute
# all objects should have at least one descriptor - but ....
    if ($linki != 0) {# at least one descriptor for this object

      while (($linki != 0) && (!($relpresent))) {
        if (( $Awfif::workspace-> {l} [$linki] [2] == ($Awfif::memes-> {snnh} {wsi}+$to))
        && ( $Awfif::workspace-> {l} [$linki] [3] == $Awfif::codelet-> {l} [$myli][6]) #relation type
        && ( $Awfif::workspace-> {l} [$linki] [4] == $Awfif::memes-> {snnh} {namedcategory})){
          $relpresent = "T";# reward for same bonds in proximity
          };#if
        $linki = $Awfif::workspace-> {l} [$linki] [0];
        };#while
      };# there are descriptors to check
#

    &updatelog ($myli,'rb',2, $relpresent);
    if (!($relpresent)) {
# If not,
# it will fight any incompatible structures. And
# if it wins, it will
# destroy all incompatible structures,
# build the new relation and

      my ($pr);
      $pr = $Awfif::memes-> {currentwsbi};
      print ("rc from=$pr:$from to=$to");
      $ni = $Awfif::codelet-> {l} [$myli][4];
      $pi = $Awfif::codelet-> {l} [$myli][7];
      $snni = $Awfif::codelet-> {l} [$myli][6];
      print (" ni=$ni pi=$pi snni=$snni\n");
      &updatelog ($myli,'rb',3, $pi);
      &setusalcwsocache ($afrom, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {budesc}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tddesc}]) ), undef());
      $Awfif::wsol-> {l} [$afrom][2]
      = setupdesc ( $Awfif::codelet-> {l} [$myli][6], #type
          ($Awfif::memes-> {snnh} {wsi} + $to), #to
          $Awfif::memes-> {snnh} {namedcategory}, #from
          $Awfif::wsol-> {l} [$afrom][2],
          $afrom);
      &updatelog ($myli,'rb',7, $Awfif::wsol-> {l} [$from][2]);
# send activation to the involved Slipnet nodes

      &actnodes ( $Awfif::codelet-> {l} [$myli][6], $Awfif::memes-> {relatype});
      &updatelog ($myli,'rb',4, $Awfif::codelet-> {l} [$myli][6]);
      &actnodes ( $Awfif::memes-> {snnh} {wsi}, $Awfif::memes-> {relato});
      &updatelog ($myli,'rb',5, $Awfif::memes-> {snnh} {wsi});
      &invcaches (wsbasetype ($ni));
      &invcaches (wsbasetype ($pi));
      };#if no bond
      };# proceeed wrap
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# relbuilder1
#
#<!-- start tag ca -->
#
sub relevaluator1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($dorelation,
    $grkwp, $grkwpr, $sponsor, $signal, $schema, $swstype,#dummies for inverted proc get context
    $cdn, $cdnx);
#
# checked for merged workspaces

    &updatelog ($myli,'re',1, $Awfif::codelet-> {l} [$myli][13]);
# have a relation descriptor that needs to be built. Does it have:
# *

    if (( $Awfif::codelet-> {l} [$myli][5] != 0) # nidl
    && (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, 't', \$cdn, \$cdnx, 3))
    && ( $Awfif::codelet-> {l} [$myli][6] != 0) # nsnn
    && ( $Awfif::codelet-> {l} [$myli][8] != 0) # pidl
    && ( $Awfif::codelet-> {l} [$myli][9] != 0)) {# worth evaluating launch
    &updatelog ($myli,'re',2, $Awfif::codelet-> {l} [$myli][13]);
      if (clwsaevaluator1 ($myli, $$kwp, $kwpr, \@$sactset)) {
        &updatelog ($myli,'re',3, $Awfif::codelet-> {l} [$myli][13]);
        $dorelation = clrevaluator1 ($myli, $Awfif::memes-> {relamp},
          $Awfif::memes-> {relrwd}, $$kwp, $kwpr, \@$sactset);
        &updatelog ($myli,'re',4, $dorelation);
        if ($dorelation > $Awfif::memes-> {relbar}) {# build the relation

          my ($ni, $pi, $snn, $snl2, $snl3, $snl4);
          $ni = $Awfif::codelet-> {l} [$myli][4];
          $pi = $Awfif::codelet-> {l} [$myli][7];
# probably needs to be 6 not 11 aaccording to rb

          $snn = $Awfif::codelet-> {l} [$myli][6];
          $snl2 = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [6]][2]};
          $snl3 = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [6]][3]};
          $snl4 = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [6]][4]};

          &updatelog ($myli,'re',5, $snn);

          $Awfif::clp = ();
          $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
          $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {blaunchm});
          if (defined ($Awfif::codelet-> {l}[$myli][19])) {
            $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
            }#wsi set
          else {
            $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
            };
          $Awfif::clp-> {strategy} = "relbuilder";
          $Awfif::clp-> {relation}-> {ni} = $Awfif::codelet-> {l} [$myli][4];
          $Awfif::clp-> {relation}-> {nidl} = $Awfif::codelet-> {l} [$myli][5];
          $Awfif::clp-> {relation}-> {pi} = $Awfif::codelet-> {l} [$myli][7];
          $Awfif::clp-> {relation}-> {pidl} = $Awfif::codelet-> {l} [$myli][8];
# downstream it is expected that the nsnn will be a concept not an index

          $Awfif::clp-> {relation}-> {nsnn} = $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli][6]][3];
          $Awfif::clp-> {relation}-> {psnn} = $Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli][9]][3];
          &cdsubmitcodelet ($myli, \$Awfif::clp);
          }# build the relation
        else {
          &redcrit ($Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli][6]][3]);
          };
        }#checks ok
      else {

          &arework ($myli, $Awfif::codelet-> {l} [$myli][4], $Awfif::codelet-> {l} [$myli][15], 're', $Awfif::codelet-> {l} [$myli][7]);
        };
      }; # evaluation
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# relevaluator1
#
#<!-- end tag ca -->
#<!-- start tag ca -->
#
sub descscout1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#codelet launch architecture requires the ignored parameters for its general interface
    my ($ni, $nidl, $nsnn, $pi, $pidl, $psnn, $facet, $binding, $tinstances,
      $al, $match, @matches, @matchns, @smatches,
      $found, $snnindex, $pvar, $snp, $mtoo, $model, $cdn, $cdnx);
# select a salient object from the workspace matching a concept from the slipnet
#
# updated for merged workspaces

    $cdn = clogstat (\$cdnx);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdn myli $myli ");
      &itcpoutput ($myli);
      };
    if (selsalwsitem ($myli, \$ni, \$tinstances, $$kwp, $kwpr, \@$sactset, 'budesc')) {

      $Awfif::codelet-> {l} [$myli][4] = $ni;
# See if there will be a direct partner included in the description

      $found = chdespi ($myli, \$ni, \$pi, $$kwp, $kwpr,\@$sactset, 'budesc',\$model);
      $Awfif::wsol-> {l}[ awsoadr ($ni)][8] = setuplog ($myli, #indexing to codelet
                'ds', #method
                $ni, #workspace object
                $pi); #linked workspace object or 0

      if ($found eq "T") {
        if ($pi == 0 ) {
# choose a descriptor concept that is salient

          $facet = seldescproperty ($$kwp, $kwpr, \@$sactset);
          &updatelog ($myli,'ds',1, $facet);

          if ($facet != 0) {
            $snp = $Awfif::memes-> {snnih} {$facet};
# Is a ws object able to support this concept

            $match = usefacet ($ni, \$nidl, $facet);
            &updatelog ($myli,'ds',2, $match);
            if ($match) {#have a concept

              $al = usedescproperty ($nidl, \@matches, \@matchns, $facet, 1);
              &updatelog ($myli,'ds',3, $al);
              if ($al > 0) {

                &dsort (\@matches, $al, \@smatches,'rsort');
                $found = salsnlnc ($matchns [$smatches [$al-1]], $myli, $ni, \$tinstances, \$snnindex, 'de', $$kwp, $kwpr, 'budescl');
                &updatelog ($myli,'ds',4, $found);
                if ($found) {
# the halo applied within salsnlc may have spread the snconcept. Selected one is in element [4] of snnindex

                  $snp = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$snnindex][4]};
                  $mtoo = $Awfif::memes-> {snnih} {$matchns [$smatches [$al-1]]};
                  $pvar = $Awfif::slipnet-> {l} [$snnindex][4];
                  $pvar = $Awfif::slipnet-> {l} [$snnindex][3];
                  $pvar = $Awfif::slipnet-> {l} [$snnindex][2];
                  }#found
                else {#poor use of resources

                  &redcrit ($matchns [$smatches [$al-1]]);
                  };
                }; # have concept to describe
              }#match
            else {#poor use of resources

              &redcrit($facet);
              };
            }# have a concept
          else {#poor use of resources

            &redcrit($facet);
            };
          if (($al > 0) && $found) {

            &updatelog ($myli,'ds',5, $snnindex);
            &descinv1 ($myli, $ni, $Awfif::slipnet-> {l} [$snnindex][4], $snnindex);
            };#if found & al
          }
        else {# relation

          &mlog ($myli, #indexing to codelet
            'rs', #method
            $ni, #workspace object
            $pi); #linked workspace object or 0
          $facet = selfacet ($Awfif::memes-> {snnh} {relfacet}, $$kwp, $kwpr, \@$sactset);
          &updatelog ($myli,'rs',1, $facet);
          $binding = uselinkfacet ($ni, \$nidl, $pi, \$pidl, $facet);
          &updatelog ($myli,'rs',2, $binding);
          if ($binding) {

            $match = uselinkcategory ($myli, $ni, $nidl, $pidl, \$nsnn, \$psnn, $Awfif::memes-> {snnh} {namescategory}, 're', $$kwp, $kwpr);
            &updatelog ($myli,'rs',3, $match);
            if ($match) {

              &updatelog ($myli,'rs',5, $pi);
              &relinv1 ($myli, $ni, $nidl, $nsnn, $pi, $pidl, $psnn);
              };
            }# successful binding
          else {

            &redcrit($facet);
            };
          };#else relation
        }# found an ni
      else {

        &updatelog ($myli,'ds',7,'f');
        };
      };#if have a salient workspace item

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# descscout1
#
sub tdescscout1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#codelet launch architecture requires the ignored parameters for its general interface
    my ($ni, $nidl, $nsnn, $pi, $pidl, $psnn, $facet, $binding, $tinstances,
      $snconcept, $match,
      $found, $snnindex, $pvar, $snp, $model, $cdn, $cdnx);
#
# updated for merged workspaces

    $cdn = clogstat (\$cdnx);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdn myli $myli ");
      &itcpoutput ($myli);
      };
# handle rework

    if ($Awfif::codelet-> {l} [$myli][14] != 0) {#rework so use previous parameters
      my ($retries, $succeeded);
      $retries = $Awfif::codelet-> {l} [$myli][14];
      &reuselog ($myli);
      if ($Awfif::codelet-> {l} [$myli][7] == 0) {#descriptor

        $ni = $Awfif::codelet-> {l} [$myli][4];
        $pi = 0;
        $snconcept = $Awfif::codelet-> {l} [$myli][10];
        $found = salsnlnc ($snconcept, $myli, $ni, \$tinstances, \$snnindex, 'de', $$kwp, $kwpr, 'tddescl');
        &updatelog ($myli,'tds',4, $found);
        if ($found) { #halo probably spread the sponsoring concept so get from snnindex

          $snp = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$snnindex][4]};
          $pvar = $Awfif::slipnet-> {l} [$snnindex][4];
          $pvar = $Awfif::slipnet-> {l} [$snnindex][3];
          $pvar = $Awfif::slipnet-> {l} [$snnindex][2];
          $snp = $Awfif::memes-> {snnih} {$snconcept};
          &updatelog ($myli,'tds',5, $snnindex);
          &descinv1 ($myli, $ni, $Awfif::slipnet-> {l} [$snnindex][4], $snnindex);
          };#found

        }
      else {

        $ni = $Awfif::codelet-> {l} [$myli][4];
        $pi = $Awfif::codelet-> {l} [$myli][7];
        $snconcept = $Awfif::codelet-> {l} [$myli][10];
        $succeeded = '';
        while (($retries > 0) && (!$succeeded)) {
          $retries--;
          $facet = selfacet ($Awfif::memes-> {snnh} {relfacet}, $$kwp, $kwpr, \@$sactset);
          &updatelog ($myli,'trs',1, $facet);
          $binding = uselinkfacet ($ni, \$nidl, $pi, \$pidl, $facet);
          &updatelog ($myli,'trs',3, $binding);
          if ($binding) {
            $match = userlinkcategory ($myli, $ni, $nidl, $pidl, \$nsnn, \$psnn, $snconcept, $Awfif::memes-> {snnh} {namescategory}, 're', $$kwp, $kwpr);
            &updatelog ($myli,'trs',4, $match);
            if ($match) {
              $succeeded = 't';
              &updatelog ($myli,'trs',5, $pi);
              &relinv1 ($myli, $ni, $nidl, $nsnn, $pi, $pidl, $psnn);
              };
            }
          else {#issue with facet
            &redcrit($facet);
            };
          };#while not succeeded and retries
        }; #relation
      }# rework
    else {#first time activity
# select a salient object from the workspace matching a concept from the slipnet
    if (selsalwsitem ($myli, \$ni, \$tinstances, $$kwp, $kwpr, \@$sactset, 'tddesc')) {

      $Awfif::wsol-> {l}[ awsoadr ($ni)][8] =setuplog ($myli, #indexing to codelet
                'tds', #method
                $ni, #workspace object
                0); #linked workspace object or 0

      $Awfif::codelet-> {l} [$myli][4] = $ni;
# See if there will be a direct partner included in the description
      $found = chdespi ($myli, \$ni, \$pi, $$kwp, $kwpr,\@$sactset, 'tddesc', $model);
      $Awfif::workspace->{l}[$Awfif::wsol-> {l}[ awsoadr ($ni)][8]][5]=$pi; #naughty!
      if ($found) {
        if ($pi == 0 ) {
# choose a descriptor concept that is salient

          $snconcept = $Awfif::codelet-> {l} [$myli][10];
          &updatelog ($myli,'tds',1, $snconcept);
          if ($snconcept != 0) {

            $snp = $Awfif::memes-> {snnih} {$snconcept};
            };#got concept to describe
          $facet = seldescproperty ($$kwp, $kwpr, \@$sactset);
          &updatelog ($myli,'tds',2, $facet);
          if ($facet != 0) {

            $snp = $Awfif::memes-> {snnih} {$facet};
# Is a ws object able to support this concept

            $match = usefacet ($ni, \$nidl, $facet);
            &updatelog ($myli,'tds',3, $match);
            if ($match) {

              &updatelog ($myli,'tds',3, $snp);
              }
            else {
              &redcrit ($facet);
              };
            if ($match) {#have a concept

              $found = salsnlnc ($snconcept, $myli, $ni, \$tinstances, \$snnindex, 'de', $$kwp, $kwpr, 'tddescl');
              &updatelog ($myli,'tds',4, $found);
              if ($found) { #halo probably spread the sponsoring concept so get from snnindex

                $snp = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$snnindex][4]};
                $pvar = $Awfif::slipnet-> {l} [$snnindex][4];
                $pvar = $Awfif::slipnet-> {l} [$snnindex][3];
                $pvar = $Awfif::slipnet-> {l} [$snnindex][2];
                $snp = $Awfif::memes-> {snnih} {$snconcept};
                &updatelog ($myli,'tds',5, $snnindex);
# setup action for getcontext checks
                $Awfif::clp-> {action}-> {wss} = $ni;
                $Awfif::clp-> {action}-> {sws} = $Awfif::memes-> {currentwsbi};
                $Awfif::clp-> {action}-> {wsoname} = getwsoname ($ni);
                &descinv1 ($myli, $ni, $Awfif::slipnet-> {l} [$snnindex][4], $snnindex);
                };#found
              };#match
            };# have a concept
          }
        else {# relation

          &mlog ($myli, #indexing to codelet
            'trs', #method
            $ni, #workspace object
            $pi); #linked workspace object or 0
          $facet = selfacet ($Awfif::memes-> {snnh} {relfacet}, $$kwp, $kwpr, \@$sactset);
          &updatelog ($myli,'trs',1, $facet);
          $snconcept = $Awfif::codelet-> {l} [$myli][10];
          $snp = $Awfif::memes-> {snnih} {$snconcept};
          &updatelog ($myli,'trs',2, $snconcept);
          $snp = $Awfif::memes-> {snnih} {$facet};
          &updatelog ($myli,'trs',1, $snp);
          $binding = uselinkfacet ($ni, \$nidl, $pi, \$pidl, $facet);
          &updatelog ($myli,'trs',3, $binding);
          if ($binding) {
# get the category given the $snconcept

            &updatelog ($myli,'trs',3, $snp);
            $match = userlinkcategory ($myli, $ni, $nidl, $pidl, \$nsnn, \$psnn, $snconcept, $Awfif::memes-> {snnh} {namescategory}, 're', $$kwp, $kwpr);
            &updatelog ($myli,'trs',4, $match);
            if ($match) {

              &updatelog ($myli,'trs',5, $pi);
              &relinv1 ($myli, $ni, $nidl, $nsnn, $pi, $pidl, $psnn);
              };
            }
          else {#poor facet
            &redcrit ($facet);
            };
          };#else relation
        }# found an ni
      else {

        &updatelog ($myli,'tds',7,'f');
        };
      };#if have a salient workspace item
      };# not rework

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# tdescscout1
#
#<!-- end tag ca -->
#<!-- start tag scc -->
#<!-- start tag uts -->
#
sub groupscout1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($ni, $nidl, $nsnn, $pi, $pidl, $psnn, $binding, $model, $bcindex,
    $grkwp, $grkwpr, $cdn, $cdnx);
#
# checked for merged workspaces

    $cdn = clogstat (\$cdnx);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdn myli $myli ");
      &itcpoutput ($myli);
      };
# bugsbmyu1
    if (($bcindex = matchbreakcodelet ($myli)) > 0) {

      $Awfif::memes-> {breakmyli} = $Awfif::memes-> {breakcodelet} [$bcindex];
      $Awfif::memes-> {bmbcindex} = $bcindex;
      };#if
# groups must use the full workspace

    $grkwp = $Awfif::wsbl->{wsoh}[$Awfif::memes->{currentwsbi}];
    $grkwpr = $Awfif::wsbl->{wsft}[$Awfif::memes->{currentwsbi}];
# choose two salient objects from the workspace

    if (selwspair ($myli, \$ni, \$pi, $grkwp, $grkwpr, \@$sactset, 'bugroup',\$model)) {
      $binding = usegroupcategory ($myli, \$ni, \$nidl, $pi, \$pidl, \$nsnn, \$psnn, $model);
# if there is a link propose a bond
      &updatelog ($myli,'gs',3, $binding);
      if ($binding) {

        &updatelog ($myli,'gs',4, $ni);
        &updatelog ($myli,'gs',5, $pi);
        &updatelog ($myli,'gs',6, $nidl);
        &updatelog ($myli,'gs',7, $model);
# & call in a group evaluator with urgency proportional to snet obj distance
        &groupinv1 ($myli, $ni, $pi, $nidl, $model, $grkwp, $grkwpr, \@$sactset);
        };#got grouping
      }# got a pair to work on
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# groupscout1
#
sub tgroupscout1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($ni, $nidl, $nsnn, $pi, $pidl, $psnn, $binding, $model, $bcindex, $c36,
    $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdat, $tgsbst, $tgsest, @cpids, $cpcount, $omeric, $loopc,
    $grkwp, $grkwpr, $cdn, $cdnx);
#
# checked for merged workspaces

    $cdn = clogstat (\$cdnx);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdn myli $myli ");
      &itcpoutput ($myli);
      };
    if ($Awfif::memes-> {trace} == $Awfif::memes-> {tracehrtime}) {
      use Time::HiRes 'time';
      ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdat) = localtime(time);
      };
# tgsbmyu1
    if (($bcindex = matchbreakcodelet ($myli)) > 0) {

      $Awfif::memes-> {breakmyli} = $Awfif::memes-> {breakcodelet} [$bcindex];
      $Awfif::memes-> {bmbcindex} = $bcindex;
      };#if
# groups must use the full workspace

    $grkwp = $Awfif::wsbl->{wsoh}[$Awfif::memes->{currentwsbi}];
    $grkwpr = $Awfif::wsbl->{wsft}[$Awfif::memes->{currentwsbi}];
# handle rework

    if ($Awfif::codelet-> {l} [$myli][14] != 0) {#rework so use previous parameters
      &reuselog ($myli);
      $ni = $Awfif::codelet-> {l} [$myli][4];
      $pi = $Awfif::codelet-> {l} [$myli][7];
      $model = $Awfif::codelet-> {l} [$myli][16];
      $tgsbst = time ();
      if (chtdespi ( $myli, \$ni, \$pi, \$nidl, $grkwp, $grkwpr, \@$sactset, $model)) {# launch evaluator

        &groupinv1 ($myli, $ni, $pi, $Awfif::codelet-> {l} [$myli][5], $model, $grkwp, $grkwpr, \@$sactset);
        };
      $tgsest = time ();
      $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {tgsrsum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {tgsrsum}] + $tgsest - $tgsbst;
      }#rework
    else { #new request

      $loopc = 0;
      $cpcount = icpcount ($Awfif::codelet-> {l} [$myli][2], $Awfif::memes-> {currentwsbi}, $Awfif::memes-> {codeleth}, \@cpids);
      $cpcount = addfeedback ($myli, $Awfif::codelet-> {l} [$myli] [2], $cpcount);
      if ($cpcount > $Awfif::memes-> {cpcountth}) {
        $omeric = 2;#request repeat calls to selsalwsitem
        }#if
      else {
        $cpcount = $Awfif::memes-> {cpcountth};
        $omeric = 0;#just standard processing
        };#else
      while (($cpcount-- >= $Awfif::memes-> {cpcountth}) && ($loopc++ < $Awfif::memes-> {maxtdgloop})) {
      $tgsbst = time ();
      if (selwspair ($myli, \$ni, \$pi, $grkwp, $grkwpr, \@$sactset, 'tdgroup',\$model, \$omeric)) {
# if so see if there is a slipnet group category link connecting the descriptions

        $tgsest = time ();
        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {tgsbsum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {tgsbsum}] + $tgsest - $tgsbst;
        $binding = usegroupcategory ($myli, \$ni, \$nidl, $pi, \$pidl, \$nsnn, \$psnn, $model);
# if there is a link propose a bond
        &updatelog ($myli,'gs',3, $binding);
        if ($binding) {

          &updatelog ($myli,'gs',4, $ni);
          &updatelog ($myli,'gs',5, $pi);
          &updatelog ($myli,'gs',6, $nidl);
          if ((!defined ($nidl) ) or ($nidl <= 0) ){

            break ();
            };#if
          if (matchbreaksalwsolc ($ni) > 0) {

            &break();
            };#if
          &updatelog ($myli,'gs',7, $model);
# & call in a group evaluator with urgency proportional to snet obj distance
          $c36 = $Awfif::codelet-> {l} [$myli] [36];
          if (
          $Awfif::wsol-> {l}[awsoadr ($ni)][ $Awfif::memes-> {wsosubpid}]#*** submacrok ***#
          >0 ) {

            $Awfif::codelet-> {l} [$myli] [36] = $Awfif::wsol-> {l}[awsoadr ($ni)][ $Awfif::memes-> {wsosubpid}];#*** submacrok ***#
            };#if

          &groupinv1 ($myli, $ni, $pi, $nidl, $model, $grkwp, $grkwpr, \@$sactset, 't');
          $Awfif::codelet-> {l} [$myli] [36] = $c36;
          };#got grouping
        }# got a pair to work on
      else {

        $tgsest = time ();
        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {tgscsum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {tgscsum}] + $tgsest - $tgsbst;
        };

      if (($cpcount >= $Awfif::memes-> {cpcountth})
      ){#delete a tgroupscout1

        if ($cpids [$cpcount] [0] != $myli) {

          &freecodelet ($cpids [$cpcount] [0], 1);
          };#if
        if ((!reachnormlth ($myli, 'tdgroup', $Awfif::memes-> {tgnth}))
        or ( ($Awfif::memes-> {acodelets}) <= $Awfif::memes-> {mincodelets})
        ){

          $cpcount = 0;
          }#if
        else {#clean up the changes to $Awfif::codelet
          $Awfif::codelet-> {l} [$myli] [35] = 0;
          $Awfif::codelet-> {l} [$myli] [36] = 0;
          $Awfif::codelet-> {l} [$myli] [37] = 0;

          };#else
        }#if
      };#while repeat
      };# new request

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# tgroupscout1
#
#<!-- end tag uts -->
#<!-- start tag ca -->
#
sub groupevaluator1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($ni, $ani, $nidl, $sgdi, $pi, $model, $sponsor, $acceptable, $rework, $sbind, $gtype,
    $signal, $schema, $swstype,#dummies for inverted proc get context
    $grkwp, $grkwpr, $cdn, $cdnx);
#
# updated for merged workspaces

# groups must use the full workspace

    if (
    ($Awfif::codelet-> {l}[$myli][4] != $Awfif::codelet-> {l}[$myli][7])
    && ($Awfif::codelet-> {l}[$myli][4] != 0)
    && ($Awfif::codelet-> {l}[$myli][7] != 0)
    && (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, 't', \$cdn, \$cdnx, 3))
    ) {#proceed

      &updatelog ($myli,'ge',1, $Awfif::codelet-> {l} [$myli][13]);
      $acceptable = '';
      $rework = '';
      $ni = $Awfif::codelet-> {l}[$myli][4];
      $ani = awsoadr ($ni);
      $nidl = $Awfif::codelet-> {l}[$myli][5];# bond or group nidl index
      $pi = $Awfif::codelet-> {l}[$myli][7];
      $model = $Awfif::codelet-> {l}[$myli][16];
      $sponsor = $Awfif::codelet-> {l}[$myli][17];

      my($wsoindisle, $wsoindisue, $hle, $hue,);
      &updatelog ($myli,'ge',2, $Awfif::codelet-> {l} [$myli][13]);
# match model to ws situation
# if its the sponsor

      if ($model == $Awfif::memes->{groupsponsor}) {#bond in this wso to pi
        $gtype = bndsgroup ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]);
        if ((fsgrpd ($myli, $ni, \$sgdi, $Awfif::memes-> {snnh} {bondcategory}, $Awfif::workspace-> {l} [$nidl][3], \$sbind))
        && ($nidl == $sgdi)
        && ($pi == ($Awfif::workspace-> {l} [$nidl][2] - $Awfif::memes-> {snnh}{wsi}))
        && (!fsgrpd ($myli, $ni, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, bndsgroup ($Awfif::workspace-> {l} [$nidl][3]), \$sbind))) {
          $acceptable = 't';
          }# bond is setup to pi
        }# model is gsponsor
# otherwise see if it is worth promoting a bond
# groupeiemu1
      elsif (($model == $Awfif::memes-> {snnh} {indequiv})
      && (!gcompleted($ni, $Awfif::codelet-> {l} [$myli] [37]) )
      ){#preformed telomere

        $acceptable = 't';
        }# model is indequiv
      elsif ($model > 0) {#member ni should be at a group edge aiming to bring in pi

        my ($atelhwso, $transmgrid);
        $gtype = $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3];
        &fsgrpd ($myli, $sponsor, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $Awfif::workspace-> {l} [$nidl][3], \$sbind );# has the sponsor moved?
        if ($sponsor != ($Awfif::workspace-> {l}[$sgdi][2] - $Awfif::memes-> {snnh}{wsi})) {#migrate the sponsor
          $sponsor = ($Awfif::workspace-> {l}[$sgdi][2] - $Awfif::memes-> {snnh}{wsi});
          $Awfif::codelet-> {l}[$myli][17] = $sponsor;
          };
        $atelhwso = awsoadr ( trwsoadr($sponsor,-1));
# groupegcu1

        if ( (fsgrpd ($myli, $ni, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $Awfif::workspace-> {l} [$nidl][3], \$sbind))
        && (findbond ($Awfif::wsol-> {l} [$ani] [2], $sponsor, $gtype, $Awfif::memes-> {snnh} {groupcategory}))# check it really is the sponsor
        && (!gcompleted($sponsor, $transmgrid))
        && ($nidl == $sgdi) ) {

          if (( (!(fsgrpd ($myli, $ni, \$sgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond($Awfif::workspace-> {l} [$nidl][3]), \$sbind)))
          && (wontgroup ($myli, $ni, $Awfif::workspace-> {l} [$nidl][3], \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) )
          && (($hle)or($hue))


          or (
          ($rework = 't') #leave the red = we want rework to try to create bond if we fail
          && ((fsgrpd ($myli, $ni, \$sgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond($Awfif::workspace-> {l} [$nidl][3]), \$sbind)))
          && ((($sbind == 0) && ($Awfif::workspace-> {l} [$sgdi][2] == ($pi + $Awfif::memes-> {snnh}{wsi}))) or (($sbind != 0) && ($Awfif::workspace-> {l} [$sbind][2] == ($pi + $Awfif::memes-> {snnh}{wsi}))))
          && (!($rework = '')) #leave the red = we dont to create bond if we fail now
          && ((!wontgroup ($myli, $pi, $Awfif::workspace-> {l} [$nidl][3], \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hue) && !($hle)))
          && ((!fsgrpd ($myli, $pi, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $Awfif::workspace-> {l} [$nidl][3], \$sbind)) or ($Awfif::workspace-> {l} [$sbind][2] != ($pi + $Awfif::memes-> {snnh}{wsi})))) ) {

            $acceptable = 't';
            }# bond is setup to pi
          }
        }#model is member
      elsif ($model < 0) {#adding ni to a group

        my ($atelhwso, $transmgrid);
        $gtype = $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3];
        &fsgrpd ($myli, $sponsor, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $Awfif::workspace-> {l} [$nidl][3], \$sbind );# has the sponsor moved?
        if ($sponsor != ($Awfif::workspace-> {l}[$sgdi][2] - $Awfif::memes-> {snnh}{wsi})) {#migrate the sponsor

          $sponsor = ($Awfif::workspace-> {l}[$sgdi][2] - $Awfif::memes-> {snnh}{wsi});
          $Awfif::codelet-> {l}[$myli][17] = $sponsor;
          };
        $atelhwso = awsoadr ( trwsoadr($sponsor,-1));
# groupegcu2

        if ((!gcompleted($sponsor, $transmgrid))) {

          if (( (!(fsgrpd ($myli, $ni, \$sgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond($Awfif::workspace-> {l} [$nidl][3]), \$sbind)))
          && (wontgroup ($myli, $pi, $Awfif::workspace-> {l} [$nidl][3], \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) )
          && (($hle)or($hue))

          or ( (!(fsgrpd ($myli, $ni, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $Awfif::workspace-> {l} [$nidl][3], \$sbind)))
          && ($rework = 't') #leave the red = we want rework to try to create bond if we fail
          && (fsgrpd ($myli, $ni, \$sgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond($Awfif::workspace-> {l} [$nidl][3]), \$sbind))
          && (($Awfif::workspace-> {l} [$sgdi][2] == ($pi + $Awfif::memes-> {snnh}{wsi})) or (($sbind != 0) && ($Awfif::workspace-> {l} [$sbind][2] == ($pi + $Awfif::memes-> {snnh}{wsi}))))
          && ((fsgrpd ($myli, $pi, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $Awfif::workspace-> {l} [$nidl][3], \$sbind)))
          && ((!wontgroup ($myli, $ni, $Awfif::workspace-> {l} [$nidl][3], \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hue) && !($hle)))

          && (!($rework = '')) #leave the red = we dont to create bond if we fail now
          )) {

            $acceptable = 't';
            }# bond is setup to pi
          }
        }#add
      if ($acceptable) {# call in a groupbuilder
        my ($pr);
        $pr = $Awfif::memes-> {currentwsbi};

        &updatelog ($myli,'ge',5, $pi);
        $Awfif::clp = ();
        if ((defined ($myli)) && ((!defined ($Awfif::codelet-> {l} [$myli][13])) or ($Awfif::codelet-> {l} [$myli][13] == 0)) && (($Awfif::wsol-> {l}[awsoadr ($ni)][8] != 0)
        && ($Awfif::wsol-> {l}[awsoadr ($ni)][ $Awfif::memes-> {wsologucount}] != 0))) {&break()};#*** submacrok ***#
        $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
        $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {blaunchm});
        if (defined ($Awfif::codelet-> {l}[$myli][19])) {
          $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
          }#wsi set
        else {
          $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
          };
        $Awfif::clp-> {strategy} = "groupbuilder";
        $Awfif::clp-> {bond}-> {ni} = $Awfif::codelet-> {l} [$myli][4];
        $Awfif::clp-> {bond}-> {nidl} = $Awfif::codelet-> {l} [$myli][5];
        $Awfif::clp-> {bond}-> {pi} = $Awfif::codelet-> {l} [$myli][7];
        $Awfif::clp-> {group}-> {model} = $Awfif::codelet-> {l} [$myli][16];
        $Awfif::clp-> {group}-> {sponsor} = $Awfif::codelet-> {l} [$myli][17];
        &groupsinv1 ($myli, undef(), undef(), undef(), undef(), undef(), 'groupbuilder', $$kwp, $kwpr, \@$sactset);
        }#acceptable
      elsif ($rework) {# lets refine this group scout

        &actnodes (wsbasetype($ni), $Awfif::memes-> {groupafrom},($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bubond}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
        &actnodes (wsbasetype($pi), $Awfif::memes-> {groupafrom},($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bubond}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
        &arework ($myli, $Awfif::codelet-> {l} [$myli][4], $Awfif::codelet-> {l} [$myli][11], 'ge', $Awfif::codelet-> {l} [$myli][7], grpsbond($Awfif::workspace-> {l} [$nidl][3]));
        };#rework
      }# worth proceeding
    else {

      if (($Awfif::codelet-> {l}[$myli][4] != 0)
      && ($Awfif::codelet-> {l}[$myli][7] != 0)
      && ($Awfif::codelet-> {l}[$myli][30] != 0)
      ){

        print ("bad request ni($Awfif::codelet-> {l}[$myli][4]), pi($Awfif::codelet-> {l}[$myli][7]), jhlabeloi($Awfif::codelet-> {l}[$myli][30])\n");
        };#if
      };# else proceed wrap

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ($myli);
    }# groupevaluator1
#
#<!-- end tag ca -->
#<!-- start tag inh -->
#<!-- start tag uts -->
#<!-- start tag sia -->
#<!-- start tag gc -->
#
sub groupbuilder1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#codelet launch architecture requires the ignored parameters for its general interface
    my ($grouppresent, $from, $to, $target, $sponsor, $gtype, $model, $as, $ae,
      $wsoindisle, $wsoindisue, $hle, $hue, $dontactivate, $dontdeploy, $iedesc, $jhlsi, $transmgrid, $bcindex, $patelhwso,
      $signal, $schema, $swstype,#dummies for inverted proc get context
      $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdat, $gbiest, $gbieet, $gbost, $gboet,
      $grkwp, $grkwpr, $cdn, $cdnx);
#
# create a group if the situation allows - and action appropriate schematic phenomena

    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, 't', \$cdn, \$cdnx, 3)) {#proceed
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      if (greaterwso ($Awfif::codelet-> {l}[$myli][7], $Awfif::codelet-> {l}[$myli][4])) {
        &itwsoutput ( trwsoadr ($Awfif::codelet-> {l}[$myli][7], 1), $Awfif::codelet-> {l}[$myli][4]);
        }
      else {
        &itwsoutput ( trwsoadr ($Awfif::codelet-> {l}[$myli][4], 1), $Awfif::codelet-> {l}[$myli][7]);
        };
      };
    if ($Awfif::memes-> {trace} == $Awfif::memes-> {tracehrtime}) {
      use Time::HiRes 'time';
      ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdat) = localtime(time);
      };
    if (($model == $Awfif::memes-> {snnh} {indequiv})
    && (gcompleted ($from, $Awfif::codelet-> {l} [$myli] [37]))
    ) { # no point to do anything
      }
    else {
# groupbuilderwgcu1
# use the wontgroup cache

    $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{stop};
    if ( (defined ($Awfif::memes-> {grpbsp21break}))
    && ($Awfif::memes-> {grpbsp21break} == $Awfif::codelet-> {l} [$myli] [21])
    ){

      &break();
      };#if
    $hue = '';
    $grouppresent = "";
    $dontactivate = '';
    $dontdeploy = '';
    &csetuplog ($myli, 'gb', $Awfif::codelet-> {l} [$myli][4], $Awfif::codelet-> {l} [$myli][7]);
    &updatelog ($myli,'gb',1, $Awfif::codelet-> {l} [$myli][13]);
# it will fight any incompatible structures. And
# if it wins, it will
# destroy all incompatible structures,
# build the new group descriptor and

    $from = $Awfif::codelet-> {l} [$myli][4];
    $to = $Awfif::codelet-> {l} [$myli][7];
    $model = $Awfif::codelet-> {l} [$myli][16];
# update codelets sponsor info
    if ($model == $Awfif::memes->{groupsponsor}) { # this should be got from the slipnet

      $gtype = bndsgroup ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]);
      }# group sponsor
    elsif (($model == $Awfif::memes-> {snnh} {indequiv})
    && (!gcompleted ($from, $Awfif::codelet-> {l} [$myli] [37]))
    ) { # this should be got from the slipnet

      $gtype = bndsgroup ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]);
      }# ie telomere
    else {

      my ($sgdi, $sbind);
      $gtype = $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3];
      &fsgrpd ($myli, $sponsor, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind );# has the sponsor moved?
      if ($sponsor != ($Awfif::workspace-> {l}[$sgdi][2] - $Awfif::memes-> {snnh}{wsi})) {#migrate the sponsor
        $sponsor = ($Awfif::workspace-> {l}[$sgdi][2] - $Awfif::memes-> {snnh}{wsi});
        $Awfif::codelet-> {l}[$myli][17] = $sponsor;
        };
      };
# groupbuilderiecu1
# see if can use indequiv cache

    if ( ( ($iedesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr ($sponsor)] [2], $Awfif::memes-> {snnh} {indequiv})) != 0 )
    && ( ($jhlsi = ($Awfif::workspace-> {l} [$iedesc] [2] - $Awfif::memes-> {snnh} {wsi})) != 0 )
    && ($Awfif::jhls-> {l} [$jhlsi] [15][1])
    ){
# groupbuildersgju3
      my ($miedesc);
      $miedesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr (trwsoadr ($sponsor, -1))] [2], $Awfif::memes-> {snnh} {mindequiv});
# groupbuildertrau3
# check for transid

      $gbiest = time ();
      $Awfif::memes-> {gbiec}++;# groupbuilder ie entry counter
      my ($i, $sigcount, $a17, $ai, $transid, $atelhwso, $subpid, $ltransmgrid);
      my (@lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);

      if ($Awfif::codelet-> {l} [$myli] [35] > 0) {

        $transid = $Awfif::codelet-> {l} [$myli] [35];
        };#if
# groupbuildertramgru1
# see if get a transid and subpid from the transmgr

      if ($Awfif::codelet-> {l} [$myli] [37] > 0) {

        $transmgrid = $Awfif::codelet-> {l} [$myli] [37];
        };#if
      if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

        $subpid = $Awfif::codelet-> {l} [$myli] [36];
        };#if
      $atelhwso = awsoadr ( trwsoadr($sponsor,-1));
      if ((defined($atelhwso)) && (($bcindex = matchbreakthawso ($atelhwso, $subpid)) > 0)
      ){

        &break ();
        };#if
# initiate group complete action
      $Awfif::memes-> {fatp}++;
# send activation to all the groups descriptor's Slipnet nodes

      $as = $Awfif::jhls-> {l}[$jhlsi][16][0];
      $ae = $Awfif::jhls-> {l}[$jhlsi][16][1];
      $i = $as;
      while (($i != trwsoadr ($ae, 1)) && ( ($ai = awsoadr ($i)) != 0)) {
        &actobj ($i, ($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]), ampdesc ($myli, $sponsor));
        &setusalcwsocache ($ai, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}]| $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}])), undef());
        $i = trwsoadr ($i, 1);
        };#activate group's new object descriptors
      $hle = '';
      $hue = '';
# mark group as complete
# groupcgsicu1

      $a17 = awsoadr ($Awfif::codelet-> {l}[$myli][17]);#group sponsor
      $patelhwso = awsoadr (trwsoadr ($Awfif::codelet-> {l}[$myli][17],-1));
      if ((defined ($transmgrid)) && ($transmgrid != 0) && (defined ($subpid)) && ($subpid > 0)) {

        $ltransmgrid = $transmgrid;#should pass in undef unless the transmgr is associated with a subprogram
        };#if
      $Awfif::wsol-> {l} [$a17][2]
        = inccounter ( $gtype,
          ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($as, 1)), #must point to start
          $Awfif::memes-> {snnh} {groupstart},
          $Awfif::wsol-> {l} [$a17][2],
          $a17,
          undef (),
          undef (),
          undef (),
          $ltransmgrid,
          $patelhwso,
          -1);#indicate if setting a transaction managed counter
# groupcgeicu1

      $Awfif::wsol-> {l} [$a17][2]
        = inccounter ( $gtype,
          ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($ae, -1)), #must point to end
          $Awfif::memes-> {snnh} {groupend},
          $Awfif::wsol-> {l} [$a17][2],
          $a17,
          undef (),
          undef (),
          undef (),
          $ltransmgrid,
          $patelhwso,
          -1);#indicate if setting a transaction managed counter
# group completion invalidates group salience caches

      $i = trwsoadr ($as, 1);
      while (($i != $ae) && ( awsoadr ($i) != 0)) {
        &wsclinv (wsbasetype ($i), $Awfif::memes-> {currentwsbi}, ($Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {delta}]));
        &itwscachecor ('tdgroup', wsbasetype ($i), 'seq', 'groupbuilder1');
        $i = trwsoadr ($i, 1);
        };

      &setcache ('bugroup', 0, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}, (1 + $Awfif::memes-> {backoffactive} {'tdgroup'})) ;
# group completion increases energy
      $Awfif::memes-> {fatp} = $Awfif::memes-> {fatp} + $Awfif::memes-> {gatp};
# dname is activated in case it can now be deployed in the group
      &actnodes ($Awfif::memes-> {snnh} {dname}, $Awfif::memes-> {groupatype}, ($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
# apply the linking function of group completion
# groupbnsu1
      if (defined ($ltransmgrid)) {#indicate this is a subprogram

        $Awfif::wsol-> {l}[awsoadr ($sponsor)][ $Awfif::memes-> {wsosubpid}] = $subpid;#*** submacrok ***#
        }#if
      &gclab ($myli, $as, $ae, '', $sponsor);
      $sigcount = usebice ($Awfif::jhls-> {l} [$jhlsi] [16][2], \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
# if the groups labels result in a match with a signal then raise the signal
#

      if ($sigcount > 0) {
        my ($i2);
        for ($i = 0; $i < $sigcount; $i++) {
          if ($lomatchs[$i]) {#there is a link launch the action scout
# unless this is an operon
            if (($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{operon}) && ($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{stbinding}) && ($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{subpstbinding})) {
              my ($asponsor, $counteri);
# groupbuildersubpu3

              if ($Awfif::memes-> {gcnfcsuse}) {&itcsuse ();};
              $Awfif::clp = ();
              $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
              $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {evlaunchm});
# see if can reflect the amplification in the urgency

              if ( ((defined ($Awfif::memes-> {gburgampbreak})) )
              && ($Awfif::memes-> {gburgampbreak})
              && (ampdesc ($myli, $sponsor) > 1)
              ){

                &break();
                };#if
              $Awfif::clp-> {urgency} = ($Awfif::clp-> {urgency} * ampdesc ($myli, $sponsor));
              if ($Awfif::codelet-> {l}[$myli][19] != 0) {
                $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
                }#wsi set
              else {
                $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
                };
# groupbuildertfu1
# apply cascadesponsorship

              $Awfif::clp-> {action}-> {tfree} = cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{getcassponsor});
              $Awfif::clp-> {strategy} = "tgoalscout";
# groupbuilderdsu2
# apply delayselect

              if ( (findcounter ($Awfif::wsol-> {l} [$a17][2], $Awfif::memes-> {snnh} {delayselect}, \$counteri))
              && ($Awfif::workspace-> {l} [$counteri] [9] > ($Awfif::memes-> {snnh} {wsi} + 0))
              ){

                $Awfif::clp-> {delayselect} = ($Awfif::workspace-> {l} [$counteri] [9] - $Awfif::memes-> {snnh} {wsi}) * $Awfif::memes-> {waitamp};
                &resetcounter ($Awfif::memes-> {snnh}{delayselect}, $a17);
                &maskcounter ($Awfif::memes-> {snnh}{delayselect}, $a17);
                };#if
              $Awfif::clp-> {action}-> {sponsor} = $sponsor;
              $Awfif::clp-> {action}-> {signal} = findsignal ($loconcs[$i]);
              $Awfif::clp-> {action}-> {schema} = $loconcs[$i];
              $Awfif::clp-> {action}-> {sws} = $Awfif::memes->{currentwsbi};
              $Awfif::clp-> {action}-> {wss} = $lostrts[$i];
              $Awfif::clp-> {action}-> {wsoname} = getwsoname ($lostrts[$i]);
              $Awfif::clp-> {action}-> {wse} = $loends[$i];
              $Awfif::clp-> {action}-> {jhlabeli} = $lola[$i];
              $Awfif::clp-> {action}-> {jhlabeloi} = gettjhlsoi (($asponsor = awsoadr($sponsor)), $Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcjhlsi}]);#*** submacrok ***#
# groupbuildersgju1
              if ($miedesc > 0){

                my ($sgjhlsi);
                $sgjhlsi = ($Awfif::workspace-> {l} [$miedesc][2] - $Awfif::memes-> {snnh} {wsi});
                $Awfif::clp-> {action}-> {sgjhlsi} = $sgjhlsi;
                };#if
# groupbuildertrau4
              if (defined ($transid)) {

                $Awfif::clp-> {action}-> {transid} = $transid;
                };#if
# groupbuildersubpu4
              if (defined ($subpid)) {

                $Awfif::clp-> {action}-> {subpi} = $subpid;
                $Awfif::clp-> {urgency} *= $Awfif::memes-> {submult};
                };#if
              if (defined ($transmgrid)) {

                $Awfif::clp-> {action}-> {transmgrid} = $transmgrid;
                };#if
              &icdsubmitcodelet ($myli, \$Awfif::clp, $Awfif::jhls-> {l} [$lola[$i]] [10], $grkwp, $grkwpr, \@$sactset);
              if (($bcindex = matchbreakthawso (awsoadr( trwsoadr($sponsor, -1)), $subpid)) > 0) {

                &remarrent ($bcindex, \@{$Awfif::memes-> {breakthwso}});
                &remarrent ($bcindex, \@{$Awfif::memes-> {breakthsubp}});
                $Awfif::memes-> {breakcodelet} [ ++$Awfif::memes-> {breakcodelet} [0]] = $Awfif::memes-> {submitted};
                $Awfif::memes-> {breaksubp} [ ++$Awfif::memes-> {breaksubp} [0]] = $subpid;
                };#if
              &trackcodelet ($myli, $Awfif::memes-> {codeletdef}, $Awfif::memes-> {snnh} {group}, undef(), awsoadr( $sponsor), $Awfif::codelet-> {l} [$myli] [36]);
              &actnodes ( $Awfif::jhls-> {l} [$lola[$i2]][6], $Awfif::memes-> {openatype},($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
              &invcaches ($Awfif::jhls-> {l} [$lola[$i2]][6], $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'tdgroup'}]);
              }; #if its not an operon
            };#launch the action scout
          };#for
        };
# groupcompletemau2

      $gbieet = time ();
      $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {gbiesum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {gbiesum}] + $gbieet - $gbiest;
      }# use indequiv cache
    else {#proceed with groupbuilder
# groupbtimeu2

    $gbost = time ();
    $Awfif::memes-> {gboc}++;# groupbuilder other entry counter
# allocate target
    if (($Awfif::codelet-> {l} [$myli][16] == $Awfif::memes->{groupsponsor})
    or ($Awfif::codelet-> {l} [$myli][16] == $Awfif::memes-> {snnh} {indequiv})
    or ($Awfif::codelet-> {l} [$myli][16] < 0)
# this fix works for successor but probably not for pred or adj
# have to work out what really happens
    ) {#gs and add update ni

      $target = $from;
      }
    else {# member updates pi

      $target = $to;
      };
# also target the activation
    $as = $target;
    $ae = $target;
# first check whether the proposed group hasn't been built in the mean time.
# - check the descriptor list at ni to see if their is a descriptor
# for a group category of the required type and to the target
# may look odd but all group descriptors have the group sponsor in [2] which traces as pi in findbond
#

    $grouppresent = findbond ($Awfif::wsol-> {l} [ awsoadr ($target)] [2], $sponsor, $gtype, $Awfif::memes-> {snnh} {groupcategory});
    &updatelog ($myli,'gb',2, $grouppresent);
#
# groupbgcu1

    my ($astelhwso, $rtransmgrid, $stransmgrid, $ssubpid, $susetrans);

    if ($Awfif::codelet-> {l} [$myli] [37] > 0) {

      $rtransmgrid = $Awfif::codelet-> {l} [$myli] [37];
      };#if
    if ( ($Awfif::wsol-> {l} [($astelhwso = awsoadr ( trwsoadr($target,-1)))] [2] != 0)
    && ( (findtdesc ($Awfif::wsol-> {l} [ ($astelhwso)] [2], $Awfif::memes-> {snnh} {telomere})) != 0 )
    && ( (findtdesc ($Awfif::wsol-> {l} [ ($astelhwso)] [2], $Awfif::memes-> {snnh} {mindequiv})) != 0 )
    ){

      $susetrans = 0;
      $ssubpid = $Awfif::codelet-> {l} [$myli] [36];
      $stransmgrid = gettmgr ($myli, $astelhwso, $Awfif::memes-> {snnh} {stran}, \$susetrans, \$ssubpid);
      };#if
    if ((!($grouppresent)
      && (!gcompleted ($target, $stransmgrid)) #at this point still guessing where the atelhwso might be
      && (
        (!(wontgroup ($myli, $target, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset))
        or ((!($hue)) && (!$hle) && ($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [wsbasetype ($target)] != 0))
      ))
      )
    or ((!gcompleted ($sponsor, $rtransmgrid))
      && (!gcompleted ($target, $stransmgrid)))
    ) {

      my ($sgdi, $dgdi, $sbind, $i, $pr);
# If not,
      $pr = $Awfif::memes-> {currentwsbi};
      print ("gc from=$pr:$from, to=$to, ptarget=$target ");
      &updatelog ($myli,'gb',3, $target);
# if will be deploying into an adjoining group then change that groups descriptors to this sponsor
      if ((($target == $to)
      && (fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
      && (fsgrpd ($myli, $from, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind )))

      or (($target == $from)
      && (fsgrpd ($myli, trwsoadr ($target,-1), \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
      && (fsgrpd ($myli, $target, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
      && (fsgrpd ($myli, trwsoadr ($target,-1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind )))
        ) {# convert the sponsors to match this one

        &updatelog ($myli,'gb',4, $target);
        if (greatergwso ($target, $from)) {#look ascending
          $as = $target;
          do {

            $ae = $target;
            $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
            $target = trwsoadr ($target,1);
            }

          while ((fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
          && (fsgrpd ($myli, trwsoadr ($target,-1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
          &&(!(wontgroup ($myli, $target, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hue))));

          if ($hue) {
            $dontdeploy = 't';
# groupbuilderwgcu2
            if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
              $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
              };
            };
          if (((fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) && ($hue))
          && (fsgrpd ($myli, trwsoadr ($target,-1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))){

            $ae = $target;
            $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
            $target = trwsoadr ($target,1);
            }
          elsif ((!fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) #want to add a group so make sure target pointing correctly when -- aplied

            && (fsgrpd ($myli, trwsoadr ($target,-1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))) {
            $target = trwsoadr ($target,1);
            }
          elsif ((!fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) #this should have been stopped in the ge but .... lets ensure we don't deploy

            && (!fsgrpd ($myli, trwsoadr ($target,-1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))) {
            $dontdeploy = 't';
# groupbuilderwgcu3
            if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
              $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
              };
            };

          $target = trwsoadr ($target,-1);
          }
        else {# potentially both ways
          $ae = $target;
          $as = trwsoadr ($target,-1);

          if (
            (fsgrpd ($myli, trwsoadr ($target,1), \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
          && (wontgroup ($myli, trwsoadr ($target,1), $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset))
          && ($hle)
            ) {

            $dontdeploy = 't';
# groupbuilderwgcu4
            if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
              $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
              };
            }
          elsif (
            !fsgrpd ($myli, $target, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind )
            ) {# target does not have a bond

            $dontdeploy = 't';
# groupbuilderwgcu5
            if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
              $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
              };
            }
          elsif (
            (fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) #if a group has appeared then don't want another one
            ) {# ni has been filled in so try and find a new target at the edge of the group
            do {

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $as = trwsoadr ($as,-1);
              }
            while ( (fsgrpd ($myli, $as, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
            && (fsgrpd ($myli, $as, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
            && (!(wontgroup ($myli, $as, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hle))) );

            if (((fsgrpd ($myli, $as, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) && ($hle))
            && (fsgrpd ($myli, $as, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))) {

              $as = trwsoadr ($as,-1);
              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              };

            $as = trwsoadr ($as, 1);
            $ae = trwsoadr ($target, 1);
            $target = $as;
            if ( (
              (fsgrpd ($myli, trwsoadr ($target, 1), \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
            && (wontgroup ($myli, trwsoadr ($target, 1), $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset))
            && ($hle)
            )
            or (
              (fsgrpd ($myli, $target, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) #if a group has appeared then don't want another one
              )
              ) {
              $dontdeploy = 't';
# groupbuilderwgcu6
              if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
                $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
                };
              };
            fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind );
            do {

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $ae = trwsoadr ($ae, 1);
              }
            while ((fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
            && (fsgrpd ($myli, trwsoadr ($ae, -1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
            &&(!(wontgroup ($myli, $ae, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hue))));

            if (((fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) && ($hue))
            && (fsgrpd ($myli, trwsoadr ($ae, -1), \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))){

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $ae++;
              };

            $ae = trwsoadr ($ae, -1);
            print ("5.4.3 target=$target\n");
            }
          else {
            do {

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $as--;
              }
            while ( (fsgrpd ($myli, $as, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
            && (fsgrpd ($myli, $as, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
            && (!(wontgroup ($myli, $as, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hle))) );

            if (((fsgrpd ($myli, $as, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) && ($hle))
            && (fsgrpd ($myli, $as, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))) {

              $as = trwsoadr ($as,-1);
              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              };

            $as = trwsoadr ($as, 1);
            $ae = trwsoadr ($target, 1);
            fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind );
            do {

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $ae++;
              }
            while ((fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
            && (fsgrpd ($myli, $ae-1, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))
            &&(!(wontgroup ($myli, $ae, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hue))));

            if (((fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind )) && ($hue))
            && (fsgrpd ($myli, $ae-1, \$dgdi, $Awfif::memes-> {snnh} {bondcategory}, grpsbond ($Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][5]][3]), \$sbind ))){

              $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
              $ae = trwsoadr ($ae, 1);
              };

            $ae = trwsoadr ($ae, -1);
            print ("8.4.3 target=$target\n");
            };
          };#ok to deploy upwards
        }#target is from
      elsif (($target == $to) && (wontgroup ($myli, $from, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)&& ($wsoindisue) && ($hue))) {#do no deployment but later check if reached both ends

        print ("no target\n");
        $dontactivate = 't';
        $dontdeploy = 't';
        if (($Awfif::wontgroupc-> {caller} == $Awfif::memes-> {snnh}{stop}) or ($Awfif::wontgroupc-> {caller} == 0)) {
          $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
          };
        &actnodes ($Awfif::memes->{snnh}{groupd}, $Awfif::memes-> {ntact},($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
        if (($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snna} {groupu} < $Awfif::memes-> {actth}) && ($Awfif::memes->{snw} [$Awfif::memes-> {currentwsbi}]-> {snna}{groupd} > $Awfif::memes-> {actth})) {
          &setinhib ($Awfif::memes-> {snnh} {groupd}, 0);#limit flip-flop
          $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnafm} {groupu} = $Awfif::memes-> {fatigue};
          &setinhib ($Awfif::memes-> {snnh} {groupu}, $Awfif::memes-> {fatigue});#limit flip-flop
          };
        }
      elsif (($target == $from) && (wontgroup ($myli, $to, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)&& ($wsoindisle) && ($hle))) {#do no deployment but later check if reached both ends

        $dontactivate = 't';
        &actnodes ($Awfif::memes->{snnh}{groupu}, $Awfif::memes-> {ntact},($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
        $dontdeploy = 't';
        $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
        if (($Awfif::memes->{snw} [$Awfif::memes-> {currentwsbi}]-> {snna}{groupd} < $Awfif::memes-> {actth}) && ($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snna} {groupu} > $Awfif::memes-> {actth})) {
          &setinhib ($Awfif::memes-> {snnh} {groupu}, 0);#limit flip-flop
          $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnafm} {groupd} = $Awfif::memes-> {fatigue};
          &setinhib ($Awfif::memes-> {snnh} {groupd}, $Awfif::memes-> {fatigue});#limit flip-flop
          };
        print ("no target\n");
        }
      elsif (($target == $from)
        && (fsgrpd ($myli, $from, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
        ) {#do no deployment but later check if reached both ends

        $dontactivate = 't';
        $dontdeploy = 't';
        print ("no target\n");
        $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh}{start};
        }

      if (!($dontdeploy)) {
        my ($atarget);
        $atarget = awsoadr ($target);
        print ("9 target=$target\n");
        &setusalcwsocache ($atarget, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}])), undef());
        $Awfif::wsol-> {l} [ $atarget][2]
        = setupdesc ( $gtype,
            ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]), #must point to sponsor
            $Awfif::memes-> {snnh} {groupcategory},
            $Awfif::wsol-> {l} [$atarget][2],
            $atarget);
        &updatelog ($myli,'gb',7, $Awfif::wsol-> {l} [$atarget][2]);
        };

      &invcaches (wsbasetype ($target), ($Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'tdgroup'}] | $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'delta'}] ));
      &invcaches (wsbasetype ($from), ($Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'tdgroup'}] | $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'delta'}] ));
      &invcaches (wsbasetype ($to), ($Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'tdgroup'}] | $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'delta'}] ));
      if (!($dontactivate)) {
        $Awfif::memes-> {fatp}++;
# send activation to all the groups descriptor's Slipnet nodes

        $i = $as;
        while (($i != trwsoadr ($ae, 1)) && ( awsoadr ($i) != 0)) {
          &actobj ($i, ($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]), (ampdesc ($myli, $sponsor)));
          $i = trwsoadr ($i, 1);
          };#activate group's new object descriptors
        };

      $hle = '';
      $hue = '';
      $as = $Awfif::codelet-> {l}[$myli][17];
      $ae = $Awfif::codelet-> {l}[$myli][17];
      while ( (fsgrpd ($myli, $as, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
      && (!(wontgroup ($myli, $as, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hle))) ) {

        $as = trwsoadr ($as, -1);
        };
      if ($hle) {#as is expected to be beyond the group by 1
        $as = trwsoadr ($as, -1);
        }

      while ((fsgrpd ($myli, $ae, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind ))
      &&(!(wontgroup ($myli, $ae, $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset)) or (!($hue)))) {
        $ae = trwsoadr ($ae, 1);
        };
      if ($hue) {#ae is expected to be beyond the group by 1
        $ae = trwsoadr ($ae, 1);
        }
# align all the sponsors

      $i = trwsoadr ($as, 1);
      while (($i != $ae) && ($i != 0 ) && ( awsoadr ($i) != 0)) {

        &fsgrpd ($myli, $i, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $gtype, \$sbind );
        $Awfif::workspace->{l}[$sgdi][2] = ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l}[$myli][17]);
        $i = trwsoadr ($i, 1);
        }
# if the group is now complete - i.e.its ends can't extend any further
# groupcomplete

      if ((wontgroup ($myli, trwsoadr ($as, 1), $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset) && ($wsoindisle) && ($hle))
      && (wontgroup ($myli, trwsoadr ($ae, -1), $gtype, \$wsoindisle, \$wsoindisue, \$hle, \$hue, $grkwp, $grkwpr, \@$sactset) && ($wsoindisue) && ($hue))) {
# initiate group complete action
        my ($i, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $a17, $use, $ai);
# see if to use delta or not
        if (findtdesc ($Awfif::wsol-> {l} [ awsoadr ($as) ][2], $Awfif::memes-> {snnh} {telomere}) != 0){#telomere so delta use

          $use = 1;
          }#if
        else {

          $use = 0;
          };
# mark group as complete

        $a17 = awsoadr ($Awfif::codelet-> {l}[$myli][17]);
        $patelhwso = awsoadr (trwsoadr ($Awfif::codelet-> {l}[$myli][17], -1));
        $Awfif::wsol-> {l} [$a17][2]
          = inccounter ( $gtype,
            ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($as, 1)), #must point to start
            $Awfif::memes-> {snnh} {groupstart},
            $Awfif::wsol-> {l} [$a17][2],
            $a17);

        $Awfif::wsol-> {l} [$a17][2]
          = inccounter ( $gtype,
            ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($ae, -1)), #must point to end
            $Awfif::memes-> {snnh} {groupend},
            $Awfif::wsol-> {l} [$a17][2],
            $a17);
# group completion invalidates group salience caches

        $i = trwsoadr ($as, 1);
        while (($i != $ae) && (($ai = awsoadr ($i)) != 0)) {
# gbwscup
          &setusalcwsocache ($ai, undef(), (($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}])), undef());
          &wsclinv (wsbasetype ($i), $Awfif::memes-> {currentwsbi},( $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'delta'}] ));
          &itwscachecor ('tdgroup', wsbasetype ($i), 'seq', 'groupbuilder1');
          $i = trwsoadr ($i, 1);
          };

        &setcache ('bugroup', 0, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}, $use + $Awfif::memes-> {backoffactive} {'tdgroup'}) ;
# group completion increases energy
        $Awfif::memes-> {fatp} = $Awfif::memes-> {fatp} + $Awfif::memes-> {gatp};
# dname is activated in case it can now be deployed in the group
        &actnodes ($Awfif::memes-> {snnh} {dname}, $Awfif::memes-> {groupatype}, ($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
# apply the linking function of group completion
        $sigcount = labinv1 ($myli, $as, $ae, '', $sponsor, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, 'notoporstbinding');
# if the groups labels result in a match with a signal then raise the signal
#

        if ($sigcount > 0) {
          my ($i2, $atti, $counteri);
          for ($i = 0; $i < $sigcount; $i++) {
            if ($lomatchs[$i]) {#there is a link launch the action scout
# unless this is an operon
              if (($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{operon}) && ($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{stbinding}) && ($Awfif::jhls-> {l} [$lola[$i]][4] != $Awfif::memes-> {snnh}{subpstbinding})) {
                my ($asponsor, $transid, $subpid, $teldesc);
# if this is the first group complete
                if ($Awfif::wsol-> {l}[($asponsor = awsoadr ($sponsor))][ $Awfif::memes-> {wsogcspjhlsi}] == 0) {#*** submacrok ***##this is a new group complete
                  my ($newjhlsi, $atelhwso);
# initialise the ws specific slipnet items

                  ©sn1 ($Awfif::memes-> {currentwsbi}, $Awfif::memes->{snnih}{$Awfif::jhls-> {l} [$lola[$i]] [6]});
# add a jhlabel for this workspace group
# groupbuilderiecu5

                  $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}] {snnl} [$Awfif::memes-> {snnh}{operon}] = newnlink ($Awfif::memes-> {snnh} {attrib}, ($newjhlsi = addjhlst ($Awfif::memes-> {snnh} {groupcategory}, $Awfif::memes-> {snnh} {operon}, 1, $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}] {snnl}[$Awfif::memes-> {snnh}{operon}], $Awfif::jhls-> {l} [$lola[$i]] [6], $Awfif::memes-> {currentwsbi}, $lostrts[$i], $loends[$i], $Awfif::jhls-> {l} [$lola[$i]] [15] [0])), $Awfif::memes-> {snnh}{operon}, $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$Awfif::memes-> {snnh}{operon}]);
# groupbuilderiecu6
# if this schemata has indequiv true check the telomeric head wso (logically sponsor - 1) for a mindeqiv descriptor
# if find one update that jhls with newly created jhls id

                  if (($Awfif::jhls-> {l} [$lola[$i]][15] [0])
                  && ($Awfif::wsol-> {l} [($atelhwso = awsoadr ( trwsoadr($sponsor,-1)))] [2] != 0)
                  && ( ($teldesc = findtdesc ($Awfif::wsol-> {l} [ ($atelhwso)] [2], $Awfif::memes-> {snnh} {mindequiv})) != 0 )
                  ){
                    $Awfif::jhls-> {l} [($Awfif::workspace-> {l} [$teldesc][2] - $Awfif::memes-> {snnh} {wsi})][15][2] = $newjhlsi;
# groupbuildertrau1
# if this schemata has indequiv true check the telomeric head wso (logically sponsor - 1) for a transid descriptor
# if find one remember to deploy a transid

                    if ($Awfif::codelet-> {l} [$myli] [35] > 0) {

                      $transid = $Awfif::codelet-> {l} [$myli] [35];
                      };#if
                    }; #if
# groupbuildertramgru2
# see if get a transid and subpid from the transmgr
                  if (defined ($atelhwso)) {


                    if ($Awfif::codelet-> {l} [$myli] [37] > 0) {

                      $transmgrid = $Awfif::codelet-> {l} [$myli] [37];
                      };#if
                    if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

                      $subpid = $Awfif::codelet-> {l} [$myli] [36];
                      };#if
                    if ((defined($atelhwso)) && (($bcindex = matchbreakthawso ($atelhwso, $subpid)) > 0)
                    ){

                      &break ();
                      };#if
# groupbnsu2
                    if ((defined ($subpid)) && ($subpid > 0) ) {

                      $Awfif::wsol-> {l}[awsoadr ($sponsor)][ $Awfif::memes-> {wsosubpid}] = $subpid;#*** submacrok ***# cache a subpid for this subprogram schemata
                      };#if
# groupcgsicu2
                    if ((defined ($transmgrid)) && ($transmgrid != 0) && (defined ($subpid)) && ($subpid > 0)) {

                      $Awfif::wsol-> {l} [$a17][2]
                        = inccounter ( $gtype,
                        ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($as, 1)), #must point to start
                        $Awfif::memes-> {snnh} {groupstart},
                        $Awfif::wsol-> {l} [$a17][2],
                        $a17,
                        undef (),
                        undef (),
                        undef (),
                        $transmgrid,
                        $patelhwso,
                        -1); #indicate if setting a transaction managed counter
# groupcgeicu2

                      $Awfif::wsol-> {l} [$a17][2]
                        = inccounter ( $gtype,
                        ($Awfif::memes-> {snnh} {wsi} + trwsoadr ($ae, -1)), #must point to end
                        $Awfif::memes-> {snnh} {groupend},
                        $Awfif::wsol-> {l} [$a17][2],
                        $a17,
                        undef (),
                        undef (),
                        undef (),
                        $transmgrid,
                        $patelhwso,
                        -1);#indicate if setting a transaction managed counter
                      };#if
                    };#if
# groupbuildersubpu1

# groupbuilderiecu3
# groupbuilderiecu2
                  if (writeiecok ($sponsor)
                  ){
# groupbuilderiecu4

                    $Awfif::jhls-> {l} [$newjhlsi][16][2] = addbice ($Awfif::memes-> {currentwsbi} , $as, $ae, $sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
                    $Awfif::jhls-> {l} [$newjhlsi][15][1] = 't';
                    $Awfif::jhls-> {l} [$newjhlsi][16][0] = $as;
                    $Awfif::jhls-> {l} [$newjhlsi][16][1] = $ae;
# if the new jhls is indeqiv then write a descriptor in the sponsor

                    $Awfif::wsol-> {l} [$asponsor][2]
                    = setupdesc ( $Awfif::memes-> {snnh} {zero},
                      ($newjhlsi + $Awfif::memes-> {snnh} {wsi}),
                      $Awfif::memes-> {snnh} {indequiv},
                      $Awfif::wsol-> {l} [$asponsor] [2],
                      $asponsor);
                    };#if
# $lola[$i] is the index of the jhls when $lomatchs[$i] is true so can copy over its attributes
                  $atti = $Awfif::jhls-> {l} [$lola[$i]] [5];
                  $atti = $Awfif::attribs-> {l} [$atti][1];#move past the start attribute
                  while (($Awfif::attribs-> {l} [$atti][2]) != $Awfif::memes-> {snnh}{attribe}) {
                    &addjhlattrib ($Awfif::memes-> {snnh}{operon}, $Awfif::attribs-> {l} [$atti][3], $Awfif::attribs-> {l} [$atti][4]);
                    $atti = $Awfif::attribs-> {l} [$atti][1];#next
                    };

                  &addjhlattribs ($Awfif::memes-> {snnh}{operon});

                  $Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcspjhlsi}] = $Awfif::slipnet-> {l} [$Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}] {snnl} [$Awfif::memes-> {snnh}{operon}]] [2];#*** submacrok ***#
                  $Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcjhlsi}] = $Awfif::slipnet-> {l} [$Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}] {snnl} [$Awfif::memes-> {snnh}{operon}]] [2];#*** submacrok ***#
# now add the sponsor info to the jhls
                  $Awfif::jhls-> {l} [$Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcjhlsi}]] [14][0] = $Awfif::memes-> {currentwsbi};#*** submacrok ***#
                  $Awfif::jhls-> {l} [$Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcjhlsi}]] [14][1] = $sponsor;#*** submacrok ***#
# and initialise the codelet count in the jhls
                  $Awfif::jhls-> {l} [$Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsogcjhlsi}]] [14][2] = 0;#*** submacrok ***#
# and initialise the codelet count in the jhls
                  };#first time associating operon
# groupcompleteclp

                &itcsuse ();
                $Awfif::clp = ();
                if ((defined ($myli)) && ((!defined ($Awfif::codelet-> {l} [$myli] [13])) or ($Awfif::codelet-> {l} [$myli] [13] == 0)) && (( $Awfif::wsol-> {l} [awsoadr ($sponsor)] [8] != 0)
                or ($Awfif::wsol-> {l}[awsoadr ($sponsor)][ $Awfif::memes-> {wsologucount}] != 0))) {&break()};#*** submacrok ***#
                $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
                $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {evlaunchm});
# see if can reflect the amplification in the urgency
                if ( ((defined ($Awfif::memes-> {gburgampbreak})) && (defined ($teldesc)))
                && ($Awfif::memes-> {gburgampbreak})
                && ($teldesc > 0)
                && (ampdesc ($myli, $sponsor) > 1)
                ){

                  &break();
                  };#if

                $Awfif::clp-> {urgency} = ($Awfif::clp-> {urgency} * ampdesc ($myli, $sponsor));
                if ($Awfif::codelet-> {l}[$myli][19] != 0) {
                  $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
                  }#wsi set
                else {
                  $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
                  };
# groupbuildertfu2
# apply cascadesponsorship

                $Awfif::clp-> {action}-> {tfree} = cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{getcassponsor});
                $Awfif::clp-> {strategy} = "tgoalscout";
# groupbuilderdsu1
# apply delayselect

                if ( (findcounter ($Awfif::wsol-> {l} [$a17][2], $Awfif::memes-> {snnh} {delayselect}, \$counteri))
                && ($Awfif::workspace-> {l} [$counteri] [9] > ($Awfif::memes-> {snnh} {wsi} + 0))
                ){

                  $Awfif::clp-> {delayselect} = ($Awfif::workspace-> {l} [$counteri] [9] - $Awfif::memes-> {snnh} {wsi}) * $Awfif::memes-> {waitamp};
                  &resetcounter ($Awfif::memes-> {snnh}{delayselect}, $a17);
                  &maskcounter ($Awfif::memes-> {snnh}{delayselect}, $a17);
                  };#if
                $Awfif::clp-> {action}-> {sponsor} = $sponsor;
                $Awfif::clp-> {action}-> {signal} = findsignal ($loconcs[$i]);
                $Awfif::clp-> {action}-> {schema} = $loconcs[$i];
                $Awfif::clp-> {action}-> {sws} = $Awfif::memes->{currentwsbi};
                $Awfif::clp-> {action}-> {wss} = $lostrts[$i];
                $Awfif::clp-> {action}-> {wsoname} = getwsoname ($lostrts[$i]);
                $Awfif::clp-> {action}-> {wse} = $loends[$i];
                $Awfif::clp-> {action}-> {jhlabeli} = $lola[$i];
# gbwstup
                $Awfif::clp-> {action}-> {jhlabeloi} = gettjhlsoi ($asponsor, $Awfif::wsol-> {l}[$asponsor][$asponsor]);#*** submacrok ***#
# groupbuildertrau2
                if (defined ($transid)) {

                  $Awfif::clp-> {action}-> {transid} = $transid;
                  };#if
# groupbuildersubpu2
                if (defined ($subpid)) {

                  $Awfif::clp-> {action}-> {subpi} = $subpid;
                  $Awfif::clp-> {urgency} *= $Awfif::memes-> {submult};
                  };#if
                if (defined ($transmgrid)) {

                  $Awfif::clp-> {action}-> {transmgrid} = $transmgrid;
                  };#if
# groupbuildersgju2
                if ($teldesc > 0){

                  my ($sgjhlsi);
                  $sgjhlsi = ($Awfif::workspace-> {l} [$teldesc][2] - $Awfif::memes-> {snnh} {wsi});
                  $Awfif::clp-> {action}-> {sgjhlsi} = $sgjhlsi;
                  };#if
                &icdsubmitcodelet ($myli, \$Awfif::clp, $Awfif::jhls-> {l} [$lola[$i]] [10], $grkwp, $grkwpr, \@$sactset);
                if (($bcindex = matchbreakthawso (awsoadr( trwsoadr($sponsor, -1)), $subpid)) > 0) {

                  &remarrent ($bcindex, \@{$Awfif::memes-> {breakthwso}});
                  &remarrent ($bcindex, \@{$Awfif::memes-> {breakthsubp}});
                  $Awfif::memes-> {breakcodelet} [ ++$Awfif::memes-> {breakcodelet} [0]] = $Awfif::memes-> {submitted};
                  if ($subpid > 0) {
                    $Awfif::memes-> {breaksubp} [ ++$Awfif::memes-> {breaksubp} [0]] = $subpid;
                    };#if
                  };#if
                &trackcodelet ($myli, $Awfif::memes-> {codeletdef}, $Awfif::memes-> {snnh} {group}, undef(), awsoadr( $sponsor), $Awfif::codelet-> {l} [$myli] [36]);
                &actnodes ( $Awfif::jhls-> {l} [$lola[$i2]][6], $Awfif::memes-> {openatype},($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] | $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]));
                &invcaches ($Awfif::jhls-> {l} [$lola[$i2]][6], $Awfif::memes-> {strbool} [$Awfif::memes-> {streh} {'tdgroup'}]);
                }; #if its not an operon
              };#launch the action scout
            };#for
          };

# groupcompletemau1

        };#group complete
      };#if no group
      $gboet = time ();
      $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {gbosum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {gbosum}] + $gboet - $gbost;
      };#else indequiv cache
      };#proceed wrap
# groupbuilderwgcu7
# drop the wontgroup cache

    $Awfif::wontgroupc-> {caller} = $Awfif::memes-> {snnh} {stop};
    };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ($myli);#should do role out of descriptors
    }# groupbuilder1
#
#<!-- end tag gc -->
#<!-- end tag sia -->
#<!-- end tag uts -->
#<!-- end tag scc -->
#<!-- end tag inh -->
#<!-- start tag ca -->
#
sub tbondscout1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
    my ($ni, $nidl, $pi, $pidl, $nsnn, $psnn, $binding, $model,
    $sponsor, $grkwp, $grkwpr, $signal, $schema, $swstype,#dummies for inverted proc get context
    $cdn, $cdnx);
#
# updated for merged workspaces

# handle rework

    if ($Awfif::codelet-> {l} [$myli][14] != 0) {#rework so use previous parameters

      if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, 't', \$cdn, \$cdnx, 3)) {
      $ni = $Awfif::codelet-> {l} [$myli][4];
      $pi = $Awfif::codelet-> {l} [$myli][7];
      if ((($Awfif::codelet-> {l} [$myli][13] == 0) or (!defined($Awfif::codelet-> {l} [$myli][13]))) && ($Awfif::wsol-> {l} [awsoadr ($ni)][8] != 0) ) {
        $Awfif::codelet-> {l} [$myli][13] = $Awfif::wsol-> {l} [awsoadr ($ni)][8];
        };
      &reuselog ($myli);
      $binding = userdesc ($ni, \$nidl, $pi, \$pidl, $Awfif::codelet-> {l} [$myli][10], \$Awfif::memes-> {snnh} {bondfacet});
      &updatelog ($myli, 'tbs', 1, $binding);#did concept match facet and linked to ni & pi descriptors
      if ($binding) {

        &updatelog ($myli,'tbs', 2, $nidl);
        &updatelog ($myli,'tbs', 3, $pidl);
        $binding = userbondcategory ($ni, \$nidl, $pi, \$pidl, \$nsnn, \$psnn, $Awfif::codelet-> {l} [$myli][10]);
        };
# if there is a link propose a bond
      &updatelog ($myli,'tbs', 4, $binding);
      if ($binding) {
        &updatelog ($myli,'tbs', 5, $pi);

# & call in a bond evaluator with urgency proportional to snet obj distance
        $Awfif::clp = ();
        if ((defined ($myli)) && ((!defined ($Awfif::codelet-> {l} [$myli][13])) or ($Awfif::codelet-> {l} [$myli][13] == 0)) && (($Awfif::wsol-> {l}[awsoadr ($ni)][8] != 0)
        or ($Awfif::wsol-> {l}[awsoadr ($ni)][ $Awfif::memes-> {wsologucount}] != 0))) {&break()};#*** submacrok ***#
        $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
        if (defined ($Awfif::codelet-> {l}[$myli][19])) {
          $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
          }#wsi set
        else {
          $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
          };
        $Awfif::clp-> {urgency} = bondurgency ($nidl, $pidl, $Awfif::codelet-> {l} [$myli][10], $Awfif::codelet-> {l} [$myli][10]);
        $Awfif::clp-> {strategy} = "bondevaluator";
        $Awfif::clp-> {bond}-> {ni} = $ni;
        $Awfif::clp-> {bond}-> {nidl} = $nidl;
        $Awfif::clp-> {bond}-> {pi} = $pi;
        $Awfif::clp-> {bond}-> {pidl} = $pidl;
        $Awfif::clp-> {bond}-> {nsnn} = $Awfif::codelet-> {l} [$myli][10];
        $Awfif::clp-> {bond}-> {psnn} = $Awfif::codelet-> {l} [$myli][10];

        &cdsubmitcodelet ($myli, \$Awfif::clp);
        }#got binding
      else {#binding missing so sponsor creation of one

        &arework ($myli, $Awfif::codelet-> {l} [$myli][4], $Awfif::codelet-> {l} [$myli][10], 'tbs', $Awfif::codelet-> {l} [$myli][7], $Awfif::codelet-> {l} [$myli][10]);
        };
        };#proceed wrap
      }# rework
    else {#main line
# Top-down bond scouts are given a
# predefined bond-related concept from the Slipnet (e.g. a certain bond-category,
# like successor), and the first object is chosen as a probabilistic function of
# its unhappiness and the number of occurrences of that bond (i.e. successor) in its
# surroundings (its string).
#

    if (selwspair ($myli, \$ni, \$pi, $$kwp, $kwpr, \@$sactset, 'tdbond', \$model)) {
      $Awfif::wsol-> {l}[ awsoadr ($ni)][8] = setuplog ($myli, #indexing to codelet
                'tbs', #method
                $ni, #workspace object
                $pi); #linked workspace object or 0
      $Awfif::codelet-> {l}[$myli][4] = $ni;# updatelog needs this setup
# now want to see if pi can be bonded to ni by the sponsoring concept
# a simplified usebondcategory

      $binding = userdesc ($ni, \$nidl, $pi, \$pidl, $Awfif::codelet-> {l} [$myli][10], \$Awfif::memes-> {snnh} {bondfacet});
      &updatelog ($myli,'tbs', 1, $binding);#did concept match facet and link to ni & pi descriptors
      if ($binding) {

        &updatelog ($myli,'tbs', 2, $nidl);
        &updatelog ($myli,'tbs', 3, $pidl);
        $binding = userbondcategory ($ni, \$nidl, $pi, \$pidl, \$nsnn, \$psnn, $Awfif::codelet-> {l} [$myli][10]);
        };
# if there is a link propose a bond

      &updatelog ($myli,'tbs', 4, $binding);
      if ($binding) {
        &updatelog ($myli,'tbs', 5, $pi);
# & call in a bond evaluator with urgency proportional to snet obj distance
        $Awfif::clp = ();
        if ((defined ($myli)) && ((!defined ($Awfif::codelet-> {l} [$myli][13])) or ($Awfif::codelet-> {l} [$myli][13] == 0)) && (($Awfif::wsol-> {l}[awsoadr ($ni)][8] != 0)
        or ($Awfif::wsol-> {l}[awsoadr ($ni)][ $Awfif::memes-> {wsologucount}] != 0))) {&break()};#*** submacrok ***#
        $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
        $Awfif::clp-> {urgency} = bondurgency ($nidl, $pidl, $Awfif::codelet-> {l} [$myli][10], $Awfif::codelet-> {l} [$myli][10]);
        if (defined ($Awfif::codelet-> {l}[$myli][19])) {
          $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
          }#wsi set
        else {
          $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
          };
        $Awfif::clp-> {strategy} = "bondevaluator";
        $Awfif::clp-> {bond}-> {ni} = $ni;
        $Awfif::clp-> {bond}-> {nidl} = $nidl;
        $Awfif::clp-> {bond}-> {pi} = $pi;
        $Awfif::clp-> {bond}-> {pidl} = $pidl;
        $Awfif::clp-> {bond}-> {nsnn} = $Awfif::codelet-> {l} [$myli][10];
        $Awfif::clp-> {bond}-> {psnn} = $Awfif::codelet-> {l} [$myli][10];
# setup action for getcontext checks
        $Awfif::clp-> {action}-> {wss} = $ni;
        $Awfif::clp-> {action}-> {sws} = $Awfif::memes-> {currentwsbi};
        $Awfif::clp-> {action}-> {wsoname} = getwsoname ($ni);

        &cdsubmitcodelet ($myli, \$Awfif::clp);
        }
      else {
# reduce the criticality of the sponsor
        &redcrit ($Awfif::codelet-> {l} [$myli] [10]);
        };#got binding
      }# were two items to work on
    };# main line

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# tbondscout1
#
#<!-- end tag ca -->
#
Market Centric Workshops
The Physics - Politics, Economics & Evolutionary Psychology
Politics, Economics & Evolutionary Psychology

Business Physics
Nature and nurture drive the business eco-system
Human nature
Emerging structure and dynamic forces of adaptation


integrating quality appropriate for each market
 
This page looks at schematic structures and their uses.  It discusses a number of examples:
  • Schematic ideas are recombined in creativity. 
  • Similarly designers take ideas and rules about materials and components and combine them. 
  • Schematic Recipes help to standardize operations. 
  • Modular components are combined into strategies for use in business plans and business models. 

As a working example it presents part of the contents and schematic details from the Adaptive Web Framework (AWF)'s operational plan. 

Finally it includes a section presenting our formal representation of schematic goals. 
Each goal has a series of associated complex adaptive system (CAS) strategy strings. 
These goals plus strings are detailed for various chess and business examples. 
Strategy
| Design |
This page uses an example to illustrate how:
  • A business can gain focus from targeting key customers,
  • Business planning activities performed by the whole organization can build awareness, empowerment and coherence. 
  • A program approach can ensure strategic alignment. 
Program Management
| Home

Profiles | Papers | Glossary | E-mail us