Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new methods #50

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class ProblemDecomposer {
public List<Subproblem> decomposeProblem(Problem problem) {

List<Subproblem> subproblems = new ArrayList<>();

// Logic to decompose the problem into subproblems
// Assume the problem has a list of elements, and we want to decompose it into individual
// subproblems for each element
List<Element> elements = problem.getElements();

for (Element element : elements) {
Subproblem subproblem = new Subproblem(element);
subproblems.add(subproblem);
}

return subproblems;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
public class SocraticCoT {
private ProblemDecomposer problemDecomposer;
private SubproblemSolver subproblemSolver;

public SocraticCoT() {
problemDecomposer = new ProblemDecomposer();
subproblemSolver = new SubproblemSolver();
}

public Solution solveProblem(Problem problem) {
List<Subproblem> subproblems = problemDecomposer.decomposeProblem(problem);
Solution finalSolution = new Solution();

for (Subproblem subproblem : subproblems) {
Solution subproblemSolution = subproblemSolver.solveSubproblem(subproblem);
// Logic to integrate subproblem solutions into the final solution
finalSolution.merge(subproblemSolution);
}

return finalSolution;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
public class SubproblemSolver {
public Solution solveSubproblem(Subproblem subproblem) {

Solution subproblemSolution = new Solution();

// Logic to solve the subproblem and update the subproblem solution
// Assume the subproblem contains a single element, and we want to perform some operation on it
Element element = subproblem.getElement();
OperationResult result = performOperation(element);
subproblemSolution.addResult(result);

return subproblemSolution;
}

private OperationResult performOperation(Element element) {
// Logic to perform the operation on the element and return the result

OperationResult result = new OperationResult();
// Perform the operation and update the result

return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);

SocraticCoT socraticCoT = new SocraticCoT();
Problem problem = new Problem();

Solution solution = socraticCoT.solveProblem(problem);

// Process and use the final solution as needed
solution.display();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,27 @@ public String getActionContent() {
return actionContent;
}

// Getter and Setter for scratchpadList
public void setScratchpadList(List<String> scratchpadList) {
this.scratchpadList = scratchpadList;
}

public List<String> getScratchpadList() {
return scratchpadList;
}

// Method to remove an entry
public void removeEntry(int index) {
if (index >= 0 && index < scratchpadList.size()) {
scratchpadList.remove(index);
}
}

// Method to add a new entry
public void addEntry(String entry) {
scratchpadList.add(entry);
}

// Method to replace the content of an action by the given index with a new string called
// wikiContentForAction
public void observationReplacer(String newString) {
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ git checkout newbranch # Go to the new branch that still has the desired comm

- Sandeep Srinivasa ([@sandys](https://twitter.com/sandeepssrin))
- Rohan Guha ([@pizzaboi21](https://github.com/pizzaboi21))
- Md Shahil ([@Shahil093](https://github.com/Shahil093))

We love contributors! Feel free to contribute to this project but please read the [CLA](https://github.com/wootzapp/.github/blob/main/CLA.md) first!

Expand Down