User's Guide‎ > ‎Advanced Users‎ > ‎

CLSolverTutor in batch-mode

    Oracle Overview: What is an Oracle ?
 
Oracle as the name suggests is a source of information which is assumed to be correct in the context being talked about. If you would  apply it to astrology, it would tell you about prophetic opinion, predictions or precognition of the future. In a similar context, an Oracle in the domain of SimStudent means that it knows what the correct step should be. If you are applying SimStudent to a mathematical domain it would tell you about the next correct transformation, step or type-in. Alternatively if you are applying SimStudent to say an article usage domain, it would tell you the correct application of 'a', 'an' or 'the' in the sentence. 

    CLSolverTutor Oracle

Since you are running SimStudent in batch-mode, you will also want to log the correct step alongside the step that was originally   performed. With the current distribution of SimStudent the oracle is a part of the SimStudent framework and can be used for logging purposes. The CLSolverTutor Oracle uses the Carnegie Learning Inc. jar files to predict the next correct step and to tell if the step that has been performed is correct or not.
 
     Using CLSolverTutor Oracle
ln this you would learn how to apply Oracle to your custom designed interface. As an example, if you are using the current version of SimStudent the interface has 3 tables with 6 rows and 1 column. The first two tables are used by the students to type-in the equation and the third table is used to type-in the transformations which is used to solve the equation.
 
        Since you are going to communicate with the CLSolverTutor Oracle, you have to make sure that the commands that you send to the oracle are in the language which it can understand. The CLSolverTutor Oracle does now know about the interface you are working with. Since your interface is composed of DorminWidgets which are part of the CTAT framework you will have to write some methods which can convert the CTAT components to a format which is understandable by the CLSolverTutor Oracle.
 
To do so you are going to write a Java class which would help you in converting the CTAT components to a format which is understandable by the CLSolverTutor Oracle and vice-versa. Also you would be checking if the CTAT component which needs to be converted is a valid component or not.
 
The SimStudent framework defines an "abstract class" called as SAIConverter which provided the prototypes for the methods you need to implement. The abstract methods in SAIConverter class are defined in the following way:
 
public abstract SAI convertCtatSaiToClSai(String selection, String action, String input);
public abstract boolean validSelection(String selection, int numPrevSteps);
public abstract String convertClResponseToCtatSai(BR_Controller brController, ProblemNode currentNode, String clAction);
 
Now you would be writing a class which implements those methods. Call this class AlgebraV6AdhocSAIConverter.java.
 
/************************************************************************************************************/
*********************************** AlgebraV6AdhocSAIConverter.java  *******************************/
/************************************************************************************************************/
package SimStAlgebraV6;
 
import edu.cmu.old_pact.dormin.trace;
import edu.cmu.pact.miss.Sai;
import edu.cmu.pact.miss.SAIConverter;
import edu.cmu.pact.miss.Rule;
import edu.cmu.pact.miss.InquiryClAlgebraTutor;
import edu.cmu.pact.BehaviorRecorder.Controller.BR_Controller;
import edu.cmu.pact.BehaviorRecorder.ProblemModel.Graph.ProblemNode;
import cl.utilities.TestableTutor.SAI;
 
public class AlgebraV6AdhocSAIConverter extends SAIConverter {
 
 /* Interface specific implementation for specifying the selection, action and input */
 public SAI convertCtatSaiToClSai(String selection, String action, String input) {
   
     String clSelection = null;
     String clAction = null;
     String clInput = null;
     SAI sai = null;
   
      String table = selection.substring(DORMIN_STEM.length(), DORMIN_STEM.length()+1);
      int tableVal = Integer.parseInt(table);
      if(tableVal == 3){
           String[] tokens = input.split(" ");
           clAction = tokens[0];
           clInput = (tokens.length == 2 ? tokens[1] : "" );
           sai = new SAI("", clAction, clInput);
           return sai;
      }
      else {
          clAction = (tableVal == 1 ? "left" : "right");
          clInput = input; 
           sai = new SAI("", clAction, clInput);
           return sai;
      }
 }
  
 public boolean validSelection(String selection, int numPrevSteps)  {
         
         boolean validSelection = true;
         int cIndex = selection.indexOf('C');
         int rIndex = selection.indexOf('R');
         if(cIndex < 0 || rIndex < 0)
                return false;
         String table = selection.substring(DORMIN_STEM.length(), DORMIN_STEM.length()+1);
         if ((numPrevSteps != 0 && "3".equals(table)) || (numPrevSteps == 0 && !"3".equals(table))) {
                 validSelection = false;
         }
        
        return validSelection;
 }
 
 @SuppressWarnings("unchecked")
 public String convertClResponseToCtatSai(BR_Controller brController,  ProblemNode currentNode, String clAction) {
  
         String selection = "dorminTable1_";
          ProblemNode startNode = brController.getProblemModel().getStartNode();
          Vector /* ProblemEdge */path = InquiryClAlgebraTutor.findPathDepthFirst(startNode, currentNode);
          int stepDepth = (path == null) ? 0 : path.size();
          if ((stepDepth % 3) == 0)  {
               selection += "C" + 3 + "R" + (stepDepth / 3 + 1);
          }
          else {
               int column = "left".equals(clAction) ? 1 : 2;
               selection += "C" + column + "R" + (stepDepth / 3 + 2);
          }
   
         if(selection.length() > DORMIN_STEM.length()) {
              char table = selection.charAt(DORMIN_STEM.length());
              int colIndex = selection.indexOf('C')+1;
              char col = selection.charAt(colIndex);
              int rowIndex = selection.indexOf('R')+1;
              char row = selection.charAt(rowIndex);
              selection = DORMIN_STEM+col+"_C"+table+"R"+row;
         }
 
      return selection;
 }
    
 public static final String DORMIN_STEM = "dorminTable";
} // end of class
 
 Now you have to compile this .java file. Open the compileTutor.sh file and add the class that you just created for compilation along with other classes.
 
Once you have defined the custom SAIConverter class for your interface and compiled it, you have to tell the SimStudent framework that it should use this class for doing the conversion from CTAT to CL and vice-versa. To do so you have to add the name of the class that you just designed above and pass it as an argument to launch the CTAT. For this open the runTutor.sh and add the following lines to the TutorArg variable that is defined in the .sh file.
 
TutorArg="${TutorArg} -ssLogging" 
TutorArg="${TutorArg} -ssClSolverTutorSAIConverter SimStAlgebraV6.AlgebraV6AdhocSAIConverter"
 
Now when you run SimStudent and see the log-files you can see that apart from the Selection, Action, Input columns you have additional columns called as Expected Selection, Expected Action, Expected Input. The values for these columns are filled by the responses from the CLSolverTutor Oracle.
Comments