gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Painter Fuzzy Node in github


From: Johan Ceuppens
Subject: Re: Painter Fuzzy Node in github
Date: Wed, 17 Dec 2014 21:05:58 +0100

Hello GC,

2014-12-17 18:04 GMT+01:00 Gregory Casamento <address@hidden>:

>
> Don't worry, I'll do that off-list :-)
>

I would prefer that you do it on-list if possible.   Becoming a
contributor is something the maintainers will have to come to a
consensus about.  At this point I concur with David.  You need to more
fully explain what it is you're trying to accomplish.



I don't see too much what the problem is again about my contribution hypothetically as it is just a simple AI for the quartzcore rendering system. I'll try to explain again in this mail :

The only thing my AI in the gnustep-fuzzy library will do is update the renderer from quartzcore with a smarter algorithm.
As Ivan said a tree is less cumbersome as it can be made after the CoreAnimation, CoreGraphics and other window rendered items. This is why it doesn't belong in Opal but needs to be put in the X11 core of GS. You reason your way around rendered item updating which is rendering an sich.

My code is a prolog decision tree maker which will have rules as "not update X", "update Y" and logical combinations of them. It'll be a simple true-false clause tree, again less cumbersome. The tree will get searched for an update rule according to variable data. In gnustep-fuzzy you can choose between atoms, numbers, variables and compound terminology for building a decision tree. Compounds is where I put the main functionality i.e. logical clauses such as "not X", "X and Y", "X or Y" and "X xor Y". For now only the "not X" clause works in this way : you search for a node greedily if it's not present you make it if it's present you split it for a not clause. There are nodes and connection data structures. Each connection has one node which it is connected to, each node has an NSMutableArray of connections in it.
No nodes get made except for a split in a "not X" clause of the searched for "X" clause in the tree. So no duplication should occur but for now occurs as nodes don't get made yeti. This is where the number inference comes in. You check your numbers when walking through the tree for update mechanisms. This might be cumbersome but if the thing is you build a tree with a factory as in the gang of four book, by creation algorithms of full decision trees and using this interface for now :
<code>
@interface OpalFuzzyDTreeFactory
{
        OpalFuzzyInference *_inference;
}
- (id) makeDTree;
- (id) makeADT:(OpalFuzzyPredicate*)p with:(Class)adt;
- (id) makeAtom:(OpalFuzzyPredicate*)p;
- (id) makeVar:(OpalFuzzyPredicate*)p;
- (id) makeNumber:(OpalFuzzyPredicate*)p;
- (id) makeCompound:(OpalFuzzyPredicate*)p;
//_inference wrapper
- (id)createInferenceManipulator;
@end
</code>
The inference engine is inside the factory with a wrapper (adapter.) The makeX things cache the predicate in a an OpalFuzyDB which is a Dictionary. The same makeX function also compiles the X into the current decision tree which is part of the inference engine wrapper. For example :

<code>
//this gets called by makeCompound: (see above code)
-(void)addCompound:(InferenceCompound*)a with:(OpalFuzzyPredicate*)p
{
        [_compounds setObject:p forKey:a];
        [_tree compileCompoundToTree:a];
}
</code>

Here is an example of making an updat tree :
The visitor pattern is a bit botcherous but I'll correct it later on :
<code>
- (id)makeUpdateDTree
{
        //alloc inference engine
        OpalFuzzyInference *inf = [OpalFuzzyInference new];
        //alloc decision tree
        OpalFuzzyDTree *dtree = [OpalFuzzyDTree new];

        //visit for futher construction of inf and dtree
        OpalFuzzyConstructVisitor *visi = [OpalFuzzyConstructVisitor new];
        inf = [inf accept:visi];
        dtree = [dtree accept:visi];

        //set the tree to the inside of inf
        OpalFuzzySetVisitor *visiset = [OpalFuzzySetVisitor new];
        inf = [inf accept:visiset];
        dtree = [dtree accept:visiset];

        //make predicates which is an NSString derived class
        OpalFuzzyPredicate *pred = [[OpalFuzzyPredicate alloc] init];
        //initialize it with a string which in this case is multi-worded
        [pred initWithString:@"not update full window";

        //so it becomes a compound, which gets parsed and
        //adds comp to _compound DB in _inference ([fact createInferenceManipulator])
        //and compiles the compound into the tree as said above
        InferenceCompound *comp = [fact makeCompound:pred];
}
</code>

I still need to look at QuartzCore though but I will, I promise, thoroughly.
There is still the fuzzy logic set code but I'll leave that out for now as the Matrix class is cumbersome i.e. NP-Hard for a connectionist system.

Then again, I also need a name for GSFuzzy so the __OpalFuzzy__ name disappears in the files. If someone would like to invent a name GS and fuzzy logic AI-wise it'd be helpful. It would be gnustep-name of course.
 
HTH a lot more for you non-troglodytes :-)
`Enry

reply via email to

[Prev in Thread] Current Thread [Next in Thread]