Introduction

This is the sixth session of the course of Expert System, that will be presented to you weekly. Now, we’re gonna develop a little test to explain two themes:

  1. The way that the tree is structured and,
  2. How to change a project from a executable to a static library.

Testing the TreeBuilder

Showing the first point, we’re gonna develop simple statements in the  main function to test the implementation. First at all, we should add the headers.

#include <iostream>
#include "propnode.h"
#include "proptreebuilder.h"

And create a PROPTreeBuilder object.

PROPTreeBuilder tb;

Now we’re just creating new nodes using our specific functions

tb.atom("A");
tb.atom("B");

Debugging these two statements, both shows a relation between the Tree structure container and the Symbol container: A node has a connection with two other nodes that serve as its operands. In the case of these nodes (that are atoms) the first value is the same that its index in the symbol container. The second value is -1, due a Atom only have relation with itself.

Now,we’re gonna go further and create a bigger tree structure.

cout<<"Indexes: "<<tb.If(tb.And(tb.atom("A"),tb.atom("B")),tb.Not(tb.atom("C")))<<'\n';

As a illustration, the next figure shows how this statement is gonna constructs a tree.

 

C is connected with the Negation operations, then A and B are nodes for the Conjunction operation, and finally, The negation and Conjunction operations are nodes for the implication.

This statement build the tree from the right to the left, in this sequence: C->Not->A->B->Conj->Imp.

How to convert Qt executable to Qt static library

As a additional learning lesson before finish this video. We’re gonna show you the way that we can change between app and library in Qt IDE.

So we open the .pro file, and comment these lines

TEMPLATE = app
CONFIG -= app_bundle
CONFIG += console c++11

and insert these:

#TEMPLATE = lib
#CONFIG += staticlib
#CONFIG += c++11
#unix {
#    target.path = /usr/lib
#    INSTALLS += target
#}

Doing this, we demand to qmake, (that is the Qt files manipulator), to treat our project as library. So when we try to execute it, we’re gonna have a message where is saying that there’s no executable. This is our decision due that we’re gonna have a Qt Visual Interface and the PROPCompiler will be a library.

 

So that’s it for this video, I hope you enjoy it and I remind you to leave a comment if you have any question . Thank you.

Notice the Expert System Architecture was created by : Pedro Arturo Cornejo Torres.

Leave a Reply

Your email address will not be published.