Blackboard Design Pattern - Layout Automation

   
    Let's look at the participants in the Backboard pattern. In my case, for Building a software system for WebElements' image recognition. Input is screenshot recorded as image and output is accessible WebElement.  Blackboard is used to describe the situation where a group of human experts sits in front of a real blackboard and work together to solve a problem. So, partial solutions are "posted" to the blackboard for further processing.  UML looks like this:

             Blackboard ---------- operates on --- Knowledge Source 
             ^                                                            |
              |                                                             |
              |                                                    activates
              |                                                             |
              ---------monitor and schedule----------- Control

    Our Blackboard is the central data store for solution space and control data (we called that vocabulary) . Blackboard provides an interface that enables all knowledge sources to read from and write to it. We use the term hypothesis or blackboard entry for solutions that are constructed during the problem solving process . Hypotheses has a level of abstraction (how far we are from the input), estimated degree of truth, and/or time interval covered as attributes.


    Main responsibilities of the Knowledge sources actors are to evaluate its own applicability, to computes a result and to update Blackboard. Collaborator is the Blackboard object. Knowledge sources are separate, independent subsystems that solve specific aspects of the overall problem. Sometimes they are called "World Knowledge". Together, knowledge sources model the overall problem domain . A solution can only be built by integrating the results of several knowledge sources. They do not communicate directly - they read and write to the blackboard. So, they have to understand the vocabulary of the blackboard. Each knowledge source is responsible for knowing the conditions under which it can contribute to a solution, so it often splits into condition-part and an action-part:
        - Condition-part (inspects) looks at the blackboard for current state and if there is anything can be done
        - Action-part (updates) takes the necessary action to the current blackboard contents

    Our first Knowledge source is the DOM handler:
    Next one is the Image handler:
   Last source is the Resource manager object:
    We need some supporting Models as well, like WebDriverFactory:
    Also WebPageElement that will hold both DOM and Layout properties:
    The Control actor  is a central control component evaluates the current state of processing and coordinates the specialized programs. This data-directed control regime is referred to as opportunistic problem solving. It allows experimenting different algorithms possible and  allows experimentally-derived heuristics to control processing.  During the problem-solving process, the system works with partial solutions that are combined, changed or rejected. Each of these solutions represents a partial problem and a certain stage of its solution. The set of all possible solutions is called solution space and is organized into levels of abstraction:
        - Lowest level is the internal representation of the input and
        - Highest level is the potential solutions
Main responsibility is to Monitor the Blackboard and to schedule knowledge source activations.  Collaborators are Blackboard and Knowledge Sources .
    The jewel in the crown is the WebPage object - our Blackboard. Responsibility is to manage central data. In this pattern, several specialized subsystems assemble their knowledge to build a possibly partial or approximate solution . The idea is to use a collection of independent programs that work cooperatively on a common data structure.

    Finally we can assemble the test:
  

No comments:

Post a Comment