HLR / DomiKnowS

37 stars 6 forks source link

WIQA constraint problems #261

Closed DariusNafar closed 3 years ago

DariusNafar commented 3 years ago

@auszok please run my code and see what the problem is. when i run the file DomiKnowS/examples/WIQA/WIQA_aug.py i get the following error: ( in order to run the file please pip install install networkx and transformers)

INFO:gurobipy.gurobipy:Restricted license - for non-production use only - expires 2022-01-13 Traceback (most recent call last): File "", line 1, in File "/Applications/PyCharm Edu.app/Contents/plugins/python-ce/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "/Applications/PyCharm Edu.app/Contents/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/Users/dariusnafar/PycharmProjects/DomiKnowS/examples/WIQA/WIQAaug.py", line 168, in paragraph.inferILPResults() File "/Users/dariusnafar/PycharmProjects/DomiKnowS/regr/graph/dataNode.py", line 884, in inferILPResults myilpOntSolver.calculateILPSelection(self, *conceptsRelations, fun=None, epsilon = 0.00001, minimizeObjective = minimizeObjective) File "/Users/dariusnafar/PycharmProjects/DomiKnowS/regr/solver/gurobiILPOntSolver.py", line 765, in calculateILPSelection self.addLogicalConstrains(mP, dn, lcs, p) File "/Users/dariusnafar/PycharmProjects/DomiKnowS/regr/solver/gurobiILPOntSolver.py", line 518, in addLogicalConstrains result = self.constructLogicalConstrains(lc, self.myIlpBooleanProcessor, m, dn, p, key = key, headLC = True) File "/Users/dariusnafar/PycharmProjects/DomiKnowS/regr/solver/gurobiILPOntSolver.py", line 598, in constructLogicalConstrains _eDns = _rDn.getEdgeDataNode(variable.v[1:]) # Get Datanodes for the edge defined by the path part of the v File "/Users/dariusnafar/PycharmProjects/DomiKnowS/regr/graph/dataNode.py", line 610, in getEdgeDataNode if isinstance(concept, Concept): UnboundLocalError: local variable 'concept' referenced before assignment

auszok commented 3 years ago

This error is caught now in the datanode. It is caused by the logical constraint having path in the V not consistent with the graph.

You can find errors like that in the solver log file:

2021-03-17 14:50:10,900 - ERROR - ilpOntSolver:__constructLogicalConstrains - The element is_less of logical constrain LC1 has v referring to not valid path ('symmetric', 'arg2')

The logical constraints have to match the graph definition and the sensors output constructing the the node data graph. It seems that the relation symmetric is not present in the data nodes for the _isless concept.

Additional the datanode log files have error and warning messages like that below:

2021-03-17 14:48:37,554 - ERROR - dataNodeBuilder:__buildRelationLink - Number of relation is 1 and is different then the length of the provided tensor 4

These should be fixed by correcting sensor output.