(0) imports

we import all the python files needed


In [2]:
import lib.operations as operations # basic variables concerning operations
from lib.schemas import * # related to the mathematical structure of the problem
from lib.textRepresentations import * # related to the propositions constituting the problem

from lib.subjectRepresentations import * # related to the problem state of a subject (representations and quantities)
from lib.paths import * # related to the solving process and its storing and analysis
from lib.dataManager import * # related to the final steps in the process gathering and printing results of simulation

(1) Load the result of a simulation

A complete simulation of 16 problems can take 2 hours. To avoid waisting time in simulations we used a module allowing object persistence : pickle


In [3]:
simulatedDatas=SimulatedDatas()
simulatedDatas.pickleLoad("simulation24072014.pkl")

(2) Inspect the datas

Redundancies in the simulation has been drastically reduced by considering a solution path is new if and only the couple {formula,reinterpretations recquired} is new. Indeed, may paths generated by the programm computes unnecessary unkowns and produce unecessary reinterpretations. Even if this behavior can be found in students, this is not the core of our study.


In [4]:
for i in range(5,15):
    data=simulatedDatas.datas[i]
    print (data["path"].formula, data["path"].interpretationsList, data["problem"], data["model"])


('(T1-d)+P1', ['T1 interpreted as LucasGAIN', 'P1 interpreted as LucasEI'], 'Tc1t', '[1, 1, 2, 2, 2, 3]')
('(T1+P1)-d', ['T1 interpreted as LucasGAIN', 'P1 interpreted as LucasEI'], 'Tc1t', '[1, 1, 2, 2, 2, 3]')
('T1', ['dEI interpreted as LucasEFminusSimonEF'], 'Tc1t', '[1, 1, 2, 2, 2, 3]')
('((T1-P1)-d)+(P1-d)', ['dEI interpreted as LucasEFminusSimonEF', 'P1 interpreted as LucasEI'], 'Tc1t', '[1, 1, 2, 2, 2, 3]')
('T1-P1', ['dEI interpreted as LucasGAINminusSimonGAIN', 'P1 interpreted as LucasEI'], 'Tc1t', '[1, 1, 2, 2, 2, 3]')
('P1+d', ['d interpreted as SimonGAIN', 'P1 interpreted as LucasEI'], 'Tc1t', '[1, 1, 2, 2, 2, 3]')
('T1-((T1-P1)-d)', ['d interpreted as SimonGAIN', 'P1 interpreted as LucasEI'], 'Tc1t', '[1, 1, 2, 2, 2, 3]')
('P1-d', ['-d interpreted as SimonGAIN', 'P1 interpreted as LucasEI'], 'Tc1t', '[1, 1, 2, 2, 2, 3]')
('T1-((T1-P1)+d)', ['-d interpreted as SimonGAIN', 'P1 interpreted as LucasEI'], 'Tc1t', '[1, 1, 2, 2, 2, 3]')
('((T1-P1)+d)+P1', ['-d interpreted as LucasGAINminusSimonGAIN', 'P1 interpreted as LucasEI'], 'Tc1t', '[1, 1, 2, 2, 2, 3]')

In [5]:
path=data["path"]

In [6]:
dic=simulatedDatas.buildBigDic()

In [7]:
move=path.richInterpretationsList[0]

In [8]:
print(data["path"].interpretationsList)
for move in path.richInterpretationsList:
    print(move.indexTextInformation)
    print(move.indexSelectedRepresentation)


['-d interpreted as LucasGAINminusSimonGAIN', 'P1 interpreted as LucasEI']
3
3
0
1

In [9]:
schema1=Schema("PoissonEF","PoissonEI",operations.addition,"PoissonGAIN","change")
schema2=Schema("ViandeEF","ViandeEI",operations.addition,"ViandeGAIN","change")
struct=ProblemStructure()
struct.addSchema(schema1)
struct.addSchema(schema2)
struct.addBridgingSchemas(schema1,schema2)
struct.updateObjectSet()

text=Text()
text.addTextInformation(TextInformation(Representation(Quantity("PoissonGAIN","P1"),'Au supermarché, le kilo de poisson a augmenté de 5 euros cette année')))
text.addTextInformation(TextInformation(Representation(Quantity("PoissonEF","T1"),'Un kilo de poisson coute maintenant 12 euros.')))
text.addTextInformation(TextInformation(Representation(Quantity("PoissonEIminusViandeEI","dEI"),'Au début de l\'année, le kilo de viande coutait le même prix que le kilo de poisson.')))
text.addTextInformation(TextInformation(Representation(Quantity("PoissonGAINminusViandeGAIN","d"),'Le kilo de viande a augmenté de 3 euros de moins que le kilo de poisson')))
text.setGoal(TextGoal(Goal('ViandeEF','Combien coute le kilo de viande maintenant?')))

text.getTextInformation(0).addAlternativeRepresentation(Representation(Quantity("PoissonEI","P1"),'Au supermarché, le kilo de poisson était de 5 euros'))
text.getTextInformation(0).addAlternativeRepresentation(Representation(Quantity("PoissonEF","P1"),'Au supermarché, le kilo de poisson coute 5 euros'))
text.getTextInformation(1).addAlternativeRepresentation(Representation(Quantity("PoissonEI","T1"),'Un kilo de poisson était de 12 euros.'))
text.getTextInformation(2).addAlternativeRepresentation(Representation(Quantity("PoissonEFminusViandeEF","dEI"),'Au la fin de l\'année, le kilo de viande coute le même prix que le kilo de poisson.'))
text.getTextInformation(2).addAlternativeRepresentation(Representation(Quantity("PoissonGAINminusViandeGAIN","dEI"),'Le kilo de viande a augmenté du même prix que le kilo de poisson.'))
text.getTextInformation(3).addAlternativeRepresentation(Representation(Quantity("ViandeGAIN","d"),'Le kilo de viande a augmenté de 3 euros'))
text.getTextInformation(3).addAlternativeRepresentation(Representation(Quantity("ViandeGAIN","-d"),'Le kilo de viande a diminué de 3 euros'))
text.getTextInformation(3).addAlternativeRepresentation(Representation(Quantity("PoissonGAINminusViandeGAIN","-d"),'Le kilo de viande a augmenté de 3 euros de plus que le kilo de poisson'))
text.getTextInformation(3).addAlternativeRepresentation(Representation(Quantity("PoissonEFminusViandeEF","d"),'Le kilo de viande vaut 3 euros de moins que le kilo de poisson'))
text.getTextInformation(3).addAlternativeRepresentation(Representation(Quantity("PoissonEFminusViandeEF","-d"),'Le kilo de viande vaut 3 euros de plus que le kilo de poisson'))
text.getTextInformation(3).addAlternativeRepresentation(Representation(Quantity("ViandeEF","d"),'Le kilo coute 3 euros à la fin'))
problemTc4t=Problem(struct,text)
problemTc4t.name="Tc4t"

In [11]:
t=problemTc4t.text.textInformations[0]

In [17]:
float (5)/8


Out[17]:
0.625