Thursday, April 13, 2017

We have been discussing Inventory with techniques for organization. We discussed storage options with separation of static and dynamic. But we also give some consideration to size. When the inventory is in a flat list, it becomes enormous to manage. Software engineers have a simple and efficient technique to manage the assets. It involves partitioning to divide the assets into manageable chunks but it doesn’t stop at that.  Instead of directly managing the assets, a separate table of consolidators is maintained. Assets in the inventory are managed with the help of consolidators. For example, a region-based consolidator may facilitate the servicing of resources specific to that region. If there were different geographic regions, there would be different consolidators. The inventory points to an entry for a resource but only the consolidator takes actions on the resource. 
Since the consolidator is assigned to a specific set of resources based on a specific criteria, it usually bears a name that suggests this criteria. For example, it could have a name that reflects the region to which the resources belong. Consolidators also have an address to which requests can be directed so that corresponding actions can be taken on the resources. When new resources have to be added and the existing regions become saturated, then a new region is carved and the new resources are added to it. This helps expand the inventory in different regions or dimensions depending on the criteria for the consolidators. Consolidators can also be hosts and while they may be similar in nature to the resources, they are special resources because they host other resources as tenants. In this case the hosts and resources become separate entities. Generally hosting may be nested only upto one level. This makes the resource different from the host otherwise hosts are not distinguishable from the resources. In the latter case, there would be a host attribute in the resource table itself and there would not be any need for consolidators. If the actions are performed with the help of consolidators, then the states on the resource may need to be updated after the actions are taken.  Hosts need not be of the same kind and may span virtualization platforms, flavors, releases and other varieties but they all behave as consolidators for their resources
Consolidators serve to partition the resources and to consolidate actions against a set of resources
#codingexercise
We were looking at an exercise involving count of all numbers formed by subsequences in  the digits representing a number. We stated that this is in fact represented by  binomial coefficients. Let's take an example and see the pattern:
a0, a1, a2
can be combined as a0 + a1 + a2  + a0a1 + a1a2 + a0a2 + (a0a1a2 ) resulting in 3C1 + 3C2 + 3C3 = 7 subsequences
Since we know the individual count of increasing length subsequences, we can now easily count different kinds of subsequences. We said that the enumeration of the subsequences corresponding to each binomial coefficient k can be done by selecting the combinations with length corresponding to the binomial coefficient.
With the enumeration as follows:
Void  Combine(ref List<int> digits, ref List<int> b, int start, int level, ref List<List<int>> combinations)  
{  
for (int I =start; I < digits.length; I++)  
{   
  if (b.contains(digits[i])== false){  
    b[level] = digits[i];  
    combinations.Add(b);
 if (I < digits.length)  
   Combine(ref digits, ref b, m, i+1, level+1, ref combinations);  
 b[level] = '/0';  
}
}
}  
we now observe an interesting repetition, each subsequence of a unit length occurs after the sum of all binomial coefficients of the length of origination string starting from that character. For example
xyz is enumerated as 
x yz is enumerated as 
x  xy  xyz   = 3C1 + 3C2 + 3C3
    xz
y yz           = 2C1 + 2C2
z                = 1C1

No comments:

Post a Comment