-->

maandag 27 november 2017

Logica en grafen

In een vorige entry gesproken over het feit dat binnen Ai vaak gaat om binnen uit alle mogelijke combinaties van symbolen, een specifiek combinatie te vinden die we dan het antwoord noemen.

Tevens aangegeven dat alle mogelijke combinaties van symbolen vaak wordt beperkt door het geven van regesl waaraan de combinaties moeten voldoen of door een opsoming van combinaties waaruit te kiezen valt.

In principe specificeert een graaf welke combinates van symbolen voor kunnen komen. Een graaf beperkt dus het aantal mogelijke combinaties. Vaak is de graaf zo groot dat we niet in een keer alles kunnen overzien en moeten we met een deel van de infomratie uit de graaf werken.

Er zijn twee manieren om informatie uit de graaf te halen:
1. door het doorlopen van de graaf (wordt vaak gedaan bij programmeer cusrsssen)
2. Door te redeneren over de graaf. Dit wordt vaak in de eerste orde logica gedaan.

zaterdag 4 november 2017

Mooie toepassing AI (kinderen leren robot schrijven)

Ich glaube, dass diese ist Unterrichtkundisch und pädagogisch verantwortungsvoll. Warum? Unterrichtkundisch, denn man lernt am meistens wann man etwas erklären müsst. Pädagogisch verantwortungsvoll denn Kinder jetzt nicht mehr warten dürfen auf die Erwachsene und der Roboter so programmiert kann werden, dass er so reagiert dass das Kind am besten / schnellsten lernt. Zum Beispiel: Kinder mit Versagensangst brauchen andere Rückkoppelung Kinder mit ADHD. Ein Roboter kann diese Rückkoppelung sehr konsequent durchfuhren. Ohne böse oder frustriert zu werden. Dozenten (Ich war auch ein) müssen wirklich gut nachdenken wann und welche direkte Interaktion unsere Kinder brauchen und wann wir am besten IT einsetzen können.

Hardware, software en functionaliteit



Hardware
Een intelligent systeem is net als ieder ander artefact gemaakt van verschillende materialen. De beschrijving van dit systeem in termen van natuurkundige en scheikundige eigenschappen zoals vorm, gewicht, geleidend of niet, doorzichtig of niet, reagerend op licht of niet, noem ik het hardware model van het systeem. Let er hierbij op dat je dus geen enkele uitspraak doet over het doel en het gebruik van het systeem.


Stel je hebt bovenstaande telefoon. Hoe ziet dan de hardware beschrijving eruit? Als hulpmiddel doe je net of je een alien bent van Mars, je bent net geland op aarde je vindt bovenstaande item op het midden van de weg. Hoe zou jij dan deze telefoon beschrijven?


Je zou opmerken dat een klein rechthoeking ding was dat grotendeels een zwarte kleur heeft.
  1. Eén zijde bestaat uit hele kleinte puntjes de verschillende kleuren licht uitstralen
    Deze zijde reageert ook op aanraking. De puntjes veranderen soms van kleur en soms begint het ding te trillen en creëert geluidsgolven.
  2. Je merkt ook op dat er een element is die reageert op luchtdrukwijzigingen en er is een element die kleine veranderingen in de luchtdruk kan genereren.
  3. Je merkt ook op dat er elementen aan boord zijn die reageren op verstorigne in het electrisch veld en die ook reageren op verstoringen in het electrisch veld.
  4. Deze verstoringen vinden plaats in verschiilende frequenties. Bijvoorbeebeeld5,8GHz of 1800 MHz.

Het gebruik
Het doel van ontwerpers is om dit soort apparatuur bruikbaar te maken voor mensen

For example: We might come up with the idea to talk in the mic, the air vibrations are transferred throught the machine and converted in electromagemtic disturbances. We make second one which translate the electromagetic disturbances in to airwaves (through the speakers)

Even a better idea is to make use of the side that response to touch, we might us it to enter an unique code, translate that into disturbances into the magnetic field so that only items that know this number respond to the disturbance (aka  phone number!)

Of course as a software designer we spent a lot of time behind our IDE, but this is only a partial view on the system. The hardware (the physical view) is as equally important, because in the end it is the behavior of the hardware of the systems that helps. Even a monitor is hardware, the symbols on your screen are nothing more than glowing lights (there small and there are a lot of them)

Symbolen
Als ik de apps op mijn telefoon bekijk, zijn er zeker veertien apparaten die daardoor overbodig zijn geworden. Ik gebruik mijn mobiel nu als
- telefoon
- brievenbus
- krant
- wekker
- stopwatch
- kookwekker
- kladblokje
- fotocamera


- routekaart (herinner je dat gevouw nog?)
- zaklamp
- rekenmachine

- walki-talki
- televisie
- cassetterecorder


Dit vertelt mij twee dingen, namelijk dat een smartphone een heel flexibel in te zetten apparaatje is, maar ook dat er blijkbaar tussen al die verschillende toepassingen een overlap bestaat.  De overlap tussen al die applicatie is dat zijn symbolen ingevoerd, bewerkt en dan weer gepresenteerd worden (vaak in de vorm van beeld maar ook in de vorm van geluid)

Een symbool is een natuurkundige eigenschap of een reeks eigenschappen van materiaal waarbij men impliciet en soms expliciet afspreken dat deze eigenschappen naar iets anders verwijzen.

voorbeeld:

fysieke eigenschappen
- rechthoekig
- gedeeltelijk bedekt met materiaal dat alle lichtfrequenties refelcteert
- de rest is bedekt met een materiaal dal alleen de lichtfrequenties tussen 450–495 nm (blauw) reflecteert


Symboliek:
U betreedt een snelweg. 





Modelleren zoekruimte (Object Orientatie)

The OO - Paradigm 
 The object-oriented paradigm emphasizes modularity and re-usability. The goal of an object-oriented approach is to satisfy the "open closed principle".
A module is open if it supports extension. If the module provides standardized ways to add new behaviours or describe new states.In the object-oriented paradigm this is often accomplished by creating a new subclass of an existing class. A module is closed if it has a well defined stable interface that all other modules must use and that limits the interaction and potential errors that can be introduced into one module by changes in another. In the object-oriented paradigm this is accomplished by defining methods that invoke services on objects. Methods can be either public or private, i.e., certain behaviours that are unique to the object are not exposed to other objects. This reduces a source of many common errors in computer programming.

Object-oriented modelling typically divides into two aspects of work: the modelling of dynamic behaviours like business processes and use cases, and the modelling of static structures like classes and components. OOA and OOD are the two distinct abstract levels (i.e. the analysis level and the design level) during OOM. The Unified Modelling Language (UML) and SysML are the two popular international standard languages used for object-oriented modelling.

Personal note: So for me Object Oriented is a way to look at the world. This view on the word is particularly handy when you want to construct or work with man made systems that have a lot of components working interdependently and where the requirements are likely to change in the foreseeable future. So good for Information systems development,but for designein an constructing houses other paradigms are more helpful.

Personal note 2: There is  often confusion about what to model. In fact we often need two models. A model of how we look at reality (like A person is a client and when he steps into the train he is a passenger ) The we also need to model the system which maintains data about the real world. sometimes real world modelling is done with different paradigms (f.e. Entity - Relation Ship Modelling) than systems modeling.

Peronal Note: from a philosofical point of view there is no structure, since everything changes over time. So in order to decide what is structural an what is behavioural in our system, we need a purpose of the system, a time frame and a judgement about what might change and what remains. This is the world of Analysing and Design.

Visualizing objects and their interdependence (UML)
To visualize how the the components interact The Unified Modelling Language was developed.
UML 2 has many types of diagrams which are divided into two categories.[3] Some types represent structural information, and the rest represent general types of behaviour, including a few that represent different aspects of interactions. These diagrams can be categorized hierarchically as shown in the following class diagram:


  1. Structure diagrams emphasize the things that must be present in the system being modelled.
  2. Behaviour diagrams emphasize what must happen in the system being modelled.
copy from:http://people.cs.pitt.edu/~chang/156/19oodb.html

OBJECT-ORIENTED DATABASE (OODB)

Click here for audio-text lecture and feed it to the speech agent
  • Object-Oriented Language Features:
    abstract data types
    inheritance
    object identity


  • Object-Oriented Database Features:
    persistence
    support of transactions
    simple querying of bulk data
    concurrent access
    resilience
    security

    WHY OBJECT-ORIENTED DATABASE?

  • Industry Trends:
    Integration and Sharing

  • Seamless integration of operating systems, databases, languages, spreadsheets, word processors, AI expert system shells.

  • Sharing of data, information, software components, products, computing environments.

  • Referential sharing:
    Multiple applications, products, or objects share common sub-objects.

    (Hypermedia links are then used to navigate from one object to another)

    Object-oriented databases allows referential sharing through the support of object identity and inheritance.

    Fundamentals of Object-Oriented Approach

    The object-oriented paradigm is illustrated below:

    Objects and Identity

    The following figure shows object with state and behavior. The state is represented by the values of the object's attributes, and the behavior is defined by the methods acting on the state of the object. There is a unique object identifier OID to identify the object.

    Complex Objects

    Complex objects are built by applying constructors to simpler objects including: sets, lists and tuples. An example is illustrated below:

    Encapsulation

    Encapsulation is derived from the notion of Abstract Data Type (ADT). It is motivated by the need to make a clear distinction between the specification and the implementation of an operation. It reinforces modularity and provides a form of logical data independence.

    Class

    A class object is an object which acts as a template. It specifies:
    A structure that is the set of attributes of the instances
    A set of operations
    A set of methods which implement the operations
    Instantiation means generating objects, Ex. 'new' operation in C++
    Persistence of objects: Two approaches
    An implicit characteristic of all objects
    An orthogonal characteristic - insert the object into a persistent collection of objects

    Inheritance

    A mechanism of reusability, the most powerful concept of OO programming

    Association

    Association is a link between entities in an application In OODB, associations are represented by means of references between objects
    a representation of a binary association
    a representation of a ternary association
    reverse reference






    ADVANTAGES OF OODB

  • An integrated repository of information that is shared by multiple users, multiple products, multiple applications on multiple platforms.

  • It also solves the following problems:

    1. The semantic gap: The real world and the Conceptual model is very similar.

    2. Impedance mismatch: Programming languages and database systems must be interfaced to solve application problems. But the language style, data structures, of a programming language (such as C) and the DBMS (such as Oracle) are different. The OODB supports general purpose programming in the OODB framework.

    3. New application requirements: Especially in OA, CAD, CAM, CASE, object-orientation is the most natural and most convenient.

    COMPLEX OBJECT DATA MODELS

    Complex object data model is non-1NF data model. It allows the following extensions:

    1. Sets of atomic values
    2. Tuple-valued attributes
    3. Sets of tuples (nested relations)
    4. General set and tuple constructors
    5. Object identity

    Formal definition:

    1. Every atomic value in A is an object.
    2. If a1, ..., an are attribute names in N, and O1, ..., On are objects, then T = [a1:O1, ..., an:On] is also an object, and T.ai retrieves the value Oi.
    3. If O1, ..., On are objects, then S = {O1, ..., On} is an abject.

    Example: {[Name:John, Age: 30],
    [Name:Mary, Friends:{Mark, Vicki}]}

    An object is defined by a triple (OID, type constructor, state) where OID is the unique object identifier, type constructor is its type (such as atom, tuple, set, list, array, bag, etc.) and state is its actual value.

    Example:
    (i1, atom, 'John')
    (i2, atom, 30)
    (i3, atom, 'Mary')
    (i4, atom, 'Mark')
    (i5, atom 'Vicki')
    (i6, tuple, [Name:i1, Age:i3])
    (i7, set, {i4, i5})
    (i8, tuple, [Name:i3, Friends:i7])
    (i9, set, {i6, i8})



    Semantic Data Models

    The following figure shows different types of nodes in GSM.





    The different types of links (relationships) in GSM are shown below.





    A semantic model for the sales office automation example is shown below.





    An entity-relationship model for the sales office automation example is shown below.


    OBJECT-ORIENTED DATABASES

    OODB = Object Orientation + Database Capabilities

    FEATURES TO BE CONSIDERED:

    persistence
    support of transactions
    simple querying of bulk data
    concurrency control
    resilience and recovery
    security
    versioning
    integrity
    performance issues

    DATA MODELS TO BE CONSIDERED:

    Complex object model
    Semantic data model such as Extended ER (EER) model, OPM model

    NOT ALL OODB SUPPORTS SAME OBJECT-ORIENTATION, SAME DATA MODEL AND SAME SET OF FEATURES

    RESEARCH PROTOTYPES



  • ORION: Lisp-based system, built at MCC 1987. Handles schema evolution and complex object locking.

  • IRIS: Built at HP 1987. Functional data model, version control, object-SQL.

  • Galileo: Built at Univ Pisa 1985. Strong typed language, complex objects.

  • PROBE: CCA 1986.

  • POSTGRES: Univ. California, Berkeley 1990. Extended relational database supporting objects.

    COMMERCIAL OODB

  • O2: O2 Technology. Language O2C to define classes, methods and types. Supports multiple inheritance. C++ compatible. Supports an extended SQL language O2SQL which can refer to complex objects.

  • G-Base: Graphael 1987. Lisp-based system, supports ADT, multiple inheritance of classes.

  • CORBA: Standards for distributed objects.

  • GemStone: Servio Logic 1987, Beaverton, Oregon. Earliest OODB supporting object identity, inheritance, encapsulation. Language OPAL is based upon Smalltalk.

  • Ontos: Ontologic, 1988, Berlington, Mass. C++ based system, offers C++ clients library. Ontos has a predecessor called Vbase. Ontos model supports encapsulation, inheritance, ability to construct complex objects.

  • Object Store: Object Design Inc. C++ based sustem. A good feature is that it supports the creation of indexes.

  • Statics: Symbolics 1988. Supports entity types, set valued attributes, and inheritance of entity types and methods.

    COMMERCIAL OODB (continued)

  • SIM: Semantic Information Manager, UNISYS 1987. Supports semantic data model. Core system of the InfoExec Environment of UNISYS. Uses the Semantic Data Model of Hammer and McLeod 1981. User can define entity types that can inherit from one another. Attributes of entities are like functions from one entity to another.

  • Relational DB Extensions: Many relational systems support OODB extensions.

    1. User-defined functions (dBase).

    2. User-defined ADTs (POSTGRES)

    3. Very-long multimedia fields (BLOB or Binary Large Object). (DB2 from IBM, SQL from SYBASE, Informix, Interbase)

    ALTERNATIVE OODB STRATEGIES

    1. Develop novel database data model or data language (SIM)

    2. Extend an existing database language with object-oriented capabilities. (IRIS, O2 and VBASE/ONTOS extended SQL)

    3. Extend existing object-oriented programming language with database capabilities (GemStone OPAL extended SmallTalk)

    4. Extendable object-oriented DBMS library (ONTOS)

    OODB QUERY LANGUAGE

    ONTOS (from Ontologic), O2 (from O2 Technology) and IRIS (from HP) all offer object-oriented extension of SQL.

    IRIS has Object SQL. Each entity type specifies one or more properties. Properties are functions that apply to the instances of the type. Entity types have extensions and can inherit from one another.

    Example: The type PERSON can be created by:
    Create Type Person (
      Name  char(20),
      Age  integer
      Address address)
    
    where address is another type. In IRIS, Name, Age and Address are called properties (functions) and apply to instances of type Person.

    OODB QUERY LANGUAGE (continued)

    Object SQL Query: retrieve the name and state of all people who are older than 21:
    Select Name(p), State(Address(p)
    for each Person p
    where Age(p) > 21
    
    (Here we assume address has another property called "state")

    The user can compose the function application:

    P5(P4(...P1(P))...)

    in the select statement.

    EXAMPLE:
    Employee is a subtype of Person
    SalesPerson is a subtype of Employee
    Addresses have street names
    Salespeople have sales managers
    sales managers have secretaries
    secretaries are employees




    Retrieve the street name of the address of the secretary of the manager of each salesperson whose salary is more than 50,000:
    Select
     StreetName(Address(Secretary(Manager(0))))
     for each SalesPerson p
     where Salary(p) > $50,000
    

    WHY EXTENDING SQL?

  • SQL is the most popular relational query language

  • SQL is also the only relational language that has a standard.

  • SQL is being promoted by many companies as the interface language for database engines and database servers. New applications developed in SQL extensions can easily call these servers for remote access.
  • Modelleren van de zoekruimte

    Bij het ontwerpen van een zoekalgoritme van belang eerst goed te kijken welk alfabet  en grammaticas je gebruikt. Die bepalen namelijk je zoekruimte en of en hoe efficiënt je een oplossing kunt vinden.

    Veel voorkomende zoekruimte zijn:
    1. De zoekruimte is een lijststructuur (presedence contraints, knoop_ids volgens alfebat + 'volgt_op'  en een grammaticaregel die tussen knopen volgt_op plaatst.)
    2. De zoek ruimte is een boomstructuur (grammaticatica is uitgebreider)
    3. De zoek ruimte is een graafstructuur
    4. De zoekruimte is een tabellenstructuur.  (grammatica betreft integriteisregels)
    5. De zoekruimte betreft natuurlijke getallen met een grammatica in de vorm van rekenkundige regels als grammaticale constraints. CSP
    6. De zoekruimte betreft uitspraken en logische operatoren als grammatica (logica)


    Op onderstaande website worden enekele beroemde algoritmes getoond in een zoekruimte in de vorm van een boom

    http://www.stefanbruins.nl/portfolio/projects/search-algorithm-visualizations-project/visualizations/intro.htm

    De zoekalgoritmen zijn:
    1. Breath First Search
    2. Depth First Search
    3. Iterative Deepening
    4. Hill-climbing
    5. Beam serch
    6. A algoritme
    7. A* Algoritme
    8. Minimax 

    http://www.algomation.com/player?algorithm=545ec29d01f03a02007b101d