Skip to content

Commit 31cf0b6

Browse files
committed
Add Hill climbing search and AND-OR search in aima core
1 parent 4e96fab commit 31cf0b6

File tree

24 files changed

+882
-145
lines changed

24 files changed

+882
-145
lines changed

Aima-core/AndOrSearch/.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Aima-core/AndOrSearch/.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Aima-core/AndOrSearch/.idea/workspace.xml

Lines changed: 290 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Aima-core/AndOrSearch/AndOrSearch.iml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="inheritedJdk" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
<orderEntry type="module-library">
11+
<library>
12+
<CLASSES>
13+
<root url="jar://$USER_HOME$/aima-java/out/artifacts/aima_core_jar/aima-core.jar!/" />
14+
</CLASSES>
15+
<JAVADOC />
16+
<SOURCES />
17+
</library>
18+
</orderEntry>
19+
</component>
20+
</module>
Binary file not shown.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import aima.core.agent.Action;
2+
import aima.core.environment.vacuum.*;
3+
import aima.core.search.agent.NondeterministicSearchAgent;
4+
import aima.core.search.nondeterministic.AndOrSearch;
5+
import aima.core.search.nondeterministic.NondeterministicProblem;
6+
import static aima.core.environment.vacuum.VacuumEnvironment.*;
7+
8+
public class ProblemSolvingAgent {
9+
public static void main(String[] args){
10+
NondeterministicSearchAgent<VacuumEnvironmentState, Action> agent = new NondeterministicSearchAgent<>(percept -> (VacuumEnvironmentState) percept);
11+
12+
NondeterministicVacuumEnvironment world = new NondeterministicVacuumEnvironment(LocationState.Dirty, LocationState.Dirty);
13+
world.addAgent(agent, LOCATION_A);
14+
15+
NondeterministicProblem<VacuumEnvironmentState, Action> problem = new NondeterministicProblem<>(
16+
(VacuumEnvironmentState) world.getCurrentState(),
17+
VacuumWorldFunctions::getActions,
18+
VacuumWorldFunctions.createResultsFunction(agent),
19+
VacuumWorldFunctions::testGoal,
20+
(s, a, sPrimed) -> 1.0);
21+
22+
AndOrSearch andOrSearch = new AndOrSearch();
23+
24+
agent.makePlan(problem);
25+
System.out.println(agent.getPlan());
26+
27+
System.out.println(andOrSearch.search(problem));
28+
}
29+
}

0 commit comments

Comments
 (0)