Eric Pietrocupo
Canada Montreal Quebec

I made a bit of R&D lately about fuzzy logic to realise that it's not exactly what I tought it was. I had an idea to use fuzzy logic in a different way but I cannot find anything similar probably because I don't have the right name. This prevent me from doing additional R&D on the subject and Fuzzy logic documentation does not talk about it.
The idea is relatively simple, in traditional boolean logic, each line can take the value 1 or 0 (true or false).They can be input into logic gates like AND and OR that generates a new output of 1 or 0. Here is an example of boolean logic citcuit:
Variables A B C D will take value 1 or 0, which will be inserted into the circuit to generate J and K in the end which will take value 1 or 0.

Now what I am looking for is to design a virtual circuit where the lines can take any float value BETWEEN 1 and 0. Allowing to have partial truth with a value like 0,7. Various logic gates could be used to generate new output (similar to probabilities computation) like for example:
A AND B = A x B A OR B = A + ((1  A)B) MIN AB = Lowest value MAX AB = Highest value NOT A = ( 1  A )
Now it's related to fuzzy logic because it use a degree of truth between 0 and 1, but the application is quite different. Considering it's not really a complex concept, I am sure somebody came up with something like that before me.
So if any of you know how it is called, or where I can find more information about it, let me know.

John Breckenridge
United States Richmond Rhode Island

I think that would be an analog logic circuit.

Josh Jennings
United States San Diego CA

What you are talking about here is called probabilistic logic.
This is conceptually different than fuzzy logic. Fuzzy logic is not about probabilites (values from 01) it's about defining logic based on overlapping sets of data as explained in more detail on this site.

Geeky McGeekface
United States Manassas Virginia
It's time for baseball, people! Pitchers and catchers report soon and the national pastime is with us again!

I'm not too sure about that, but I do have a fuzzy dibs!

Eric Pietrocupo
Canada Montreal Quebec

Quote: What you are talking about here is called probabilistic logic.
Hmm! that does seem interesting. I should search more about it.
The "problem" with fuzzy logic is that it convert an analog value into a crisp value. Like for example, converting a temperature as keywords "Cold", "Warm" or "Hot".
But I don't really need this. But I inderstand that if you want to make inference rules like:
IF temperature HOT THEN start Air conditionner
Then converting as crisp value is essential.

The kind of application I am looking for is for artificial intelligence. For example, how to determine which of the ennemy unit is the most threathning. I could use various data that I pass into the circuit that gives me in the end the threath level of the unit as a [0, 1] value, then I can sort the units and take the most threathning.



It sounds like you're concerned less with fuzzy logic (degrees of truth) and moreso with threat conditions. Shouldn't you be identifying your threat conditions and using those as determining factors of which is more important to target? I guess you could use fuzzy logic as the value of your threat condition, but that could possibly create a less threatening target be determined as more threatening if not implemented properly.

Richard Linnell
United States Bedford NH
I really need a new badge, avatar, and overtext. GM me with any ideas....
This is the seahorse valley

I guess I'm a little unclear as to what the difference is between what you are trying to discern as some sort of "logic" and simple mathematical algorithm? Essentially you are trying to rank all known threats, and choose the highest. This is just a matter of assigning values to the various abilities that a unit has  and while you may think of it more clearly in terms of "If I am outside the target's range, it is not a threat" you can also calculate that by subtracting the distance from the range to create a negative value that is multiplied by the various other factors. In essence, you'll end up calculating a large string of probabilities to determine which threat is the greatest. In words I might use something like:
Determining who to target with an attack is a calculation based off how likely a unit is to hit me, how much damage they will do when if they hit me, what other effects will happen if they hit me, and the chance that I will be able to neutralize that target.

kSwingrÜber
United States Ridgefield Washington

I always reduce to Boolean...
Let T = food item found in back of fridge Let E = edible
E = ( T != fuzzy )
Simple. Elegant. Applicable to real life.

Robert Wesley
Nepal Aberdeen Washington

titanticore wrote: It sounds like you're concerned less with fuzzy logic (degrees of truth) and moreso with threat conditions. Shouldn't you be identifying your threat conditions and using those as determining factors of which is more important to target? I guess you could use fuzzy logic as the value of your threat condition, but that could possibly create a less threatening target be determined as more threatening if not implemented properly. NO 'questions' about it; further "dibs"!

Billy McBoatface
United States Lexington Massachusetts
KGS is the #1 web site for playing go over the internet. Visit now!
Yes, I really am that awesome.

Sounds like you want a neural net. They take analog input, process it, give you analog output.

Eric Pietrocupo
Canada Montreal Quebec

Neural net is another option. What I am suggesting above could be a simplified version of a neural net since not all connections are present. I am going to make additional reading on the subject soon.
My goal could be to use it for various purpose than just threat. Another example in a game with an hex map with cities that can be attacked: Which city should the AI target?
I have identified a series of factors that could influence the "weight" of a city.
 Distance from the path traced from a capital to the opponent's capital. ( Make sure to ignore cities very far away from the objectives.  Resource given by cities are more likely to be targeted first  Ratio for number of friendly and enemy units in range of the city  Superiority in specific field like Air, AntiAir, etc  Presence of capturing enemy/friendly units.
No each of these informations will be passed into a function that will convert the data into a [0,1] interval similarly to fuzzy logic.
When I got all my values, I could of course give a preponderation to each variable and sum them up. Like for example:
Distance: 20% Resource: 30% Nb Units: 20% Superiority: 15% Capturing units: 15%
That could possibly work and is similar to neural networks but with only 1 level of neurons.
As a circuit explained above, I could probably do the same. So I have to determine if there are really advantages to use a circuit (as it is more complex to implement)
So far, the resulting value could either be used for sorting, or for making a random % roll against the value.

Pieter
Netherlands Maastricht
Good intentions are no substitute for a good education.
I take my fun very seriously.

Ian Millington's book "Artificial Intelligence for Games" has a chapter on this, including example code.

Eric Pietrocupo
Canada Montreal Quebec

This book is in my Amazon wish list. I tried to borrow it from another library, but there is relly few libraries in canada that has this book. I managed to find an electronic access to one of my library. I'll take a look and see if it's worth it's price.
Meanwhile I read a book with a similar title from another publisher that pointed me out on the various AI methods which now I try to learn more about it.
I started to read about neural networks. Each neuron works a bit differently as it summ up the variables then pass the result into a function and if the output is above a threshold value, it output 1 else it output 0. The weight of the connection is actually determined at the input, but the connections are made of 1 and zero.
From what I understand, neural network needs to be trained using training set to get the designed output. It is somewhat more convenient than making a circuit yourself which could create more undesired behavior. But on the other hand, you probably need multiple data set to train your network corectly. So both system are prone to undesired behavior.
Oh! well, if nobody else tried what I could call "floating point logic", I'll give it a try and experiment it by myself.

George Kinney
United States Bellefontaine Ohio

larienna wrote: As a circuit explained above, I could probably do the same. So I have to determine if there are really advantages to use a circuit (as it is more complex to implement)
IMHO, you are indeed over complicating it.
You are wanting to classify (or rank) a group of targets by their potential threat. The term you are looking for is 'a metric'. In any computer classification scheme, you need to pick a metric to classify, rank, sort, etc. by. It can be something very simple, like the name of the object, or it can be synthesized from many different values. In any case, the trick is defining a metric that produces the output class/sort/etc that you need.
If you can work it out on paper, then you don't need something fancy like a neural net, you just need a function that takes those inputs and spits out your result value which you then use to classify and such.
The complexity comes later, in the decision tree you use to manipulate those metrics into the outputs you need.
Where neural nets would come in handy is if there isn't a clearly defined metric to use. But the price (as you've recognized) is in complexity, computation time, and error rates in outputs.

wayne mathias
United States Niceville Florida

You would shift each circuit into being a counter (thus multivalued beyond binary) and combine the outputs of the circuits with the final output being matched vs a tipping point.

Eric Pietrocupo
Canada Montreal Quebec

Quote: You are wanting to classify (or rank) a group of targets by their potential threat.
Maybe for the ranking process, it could be easier not to use a circuit, but there could be other situations where such circuit could be useful.
Still, So far, I have being doing some thoughts for a turn based strategy hex war game, I also analysed how I play DAi Senryaku, and it seems that to determine targets, commands units, and define objectives. It's only a matter of assigning the weight and/or sorting information.
For example, I realized, that when I command my units. If chose them:
 Using the unit that has the least enemy unit to target.  Then target the enemy unit that can be the least targeted. and/or chose the unit with the highest weight. ( the nb of targeting unit can be put inside the weight)
Else if you take a game like civilization, what building should I put inside the city? All buildings could be weighted according to various factor related to the local city or the global strategy the AI set himself. But in the end, you sort the buildings and take the highest one.
I'll give it a try to convert data as [0,1] values and then add a sum of weight and sort according to this weight. I'll check the results and see if some improvements are required.

Eric Pietrocupo
Canada Montreal Quebec

I am going to make some test for a new unit selection algorithm. The idea is simple:
Each player will have a list of units with various properties like Air/ground/sea units, AntiAir/ground/sea, scouting ability, capturing ability, melee/range attack, etc.
Then, the AI will try to analyze which unit is the most important unit to build according to the army composition of both sides. It would not require me to have any map or combat stats, just 2 list of units with properties.


