Let K = (,,,) be a knowledge domain as Rela-Ops model, and a problem P = (O, E, F)⟶G as kind 2 in Definition 3. This algorithm will solve problem P through these steps as follows:
Input: The problem P = (O, E, F) ⟶ G
Output: The solution to problem P.
The method for designing this algorithm uses forward chaining reasoning. It combines heuristics rules in the reasoning process. Objects also attend this process as active agents for solving problems on themselves by Algorithm 1. This process is done when it gets the goal.
Step 0: Initialize variables
flag:= true;
KnownFacts:= E ∪ F;
count:= 0; # the number of new objects which are generated
Sol:= []; # solution of problem
Step 1. Collect objects in hypothesis and goal part.
Classify kind of facts in E and F.
Step 2. Check G.
If G is achieved then
Go to step 5.
Step 3: Determine the closure of each object in O by using Algo. 4.1 and facts in E and F.
Step 4: Use equations in E to generate the new facts as relation form.
Use the relations in F to generate new equations.
Update KnownFacts.
Step 5: Select a rule in to produce new facts or new objects by using heuristic rules.
while (flag! = false) and not(G is determined) do
Search r in which can be applied to KnownFacts
5.1. Case: r is a deductive rule
if (r has form: )then
KnownFacts:= KnownFacts ∪ ;
s:= [r, h(r), ];
Sol:= [op(Sol), s];
continue;
end if;
5.2. Case: r is a rule for generating a new object
if count ≤ card(O) then #only generate at most number of objects in hypothesis
if (r generates a new object o) and not(o ∈ KnownFacts)
then
count:= count + 1;
KnownFacts:= KnownFacts ∪ ;s: = [r, h(r), ];
Sol:= [op(Sol), s];
Go to Step 3 with new object o;
end if;
end if; #5.2
5.3. Case: r is an equivalent rule
if (r has form: f(r), )then
KnownFacts:= KnownFacts ∪ ;
s: = [r, h(r), ];
Sol: = [op(Sol), s];
continue;
end if; #5.3
5.4. Case: r is an equation rule
if (r has form: )then
r can generate a set of new facts A
KnownFacts:= KnownFacts ∪ A;
s:= [r, KnownFacts, A];
Sol:= [op(Sol), s];
if (r generates a new object o) and not(o ∈ KnownFacts) then