I'm getting a strange problem with CLIPS that is kind of difficult to debug. I have the following fact list:
f-0 (initial-fact)
f-1 (SpinWave (quantum_number_names "charge" "isospin" "spin" "parity" "cparity") (quantum_number_values 0 1 2 -1 -1))
f-2 (SpinWave (quantum_number_names "charge" "isospin" "spin" "parity" "cparity") (quantum_number_values 0 1 3 -1 -1))
f-3 (SpinWave (quantum_number_names "charge" "isospin" "spin" "parity" "cparity") (quantum_number_values 0 1 4 -1 -1))
f-4 (SpinWave (quantum_number_names "charge" "isospin" "spin" "parity" "cparity") (quantum_number_values 0 3 1 -1 1))
f-5 (ViolatingRulesForDecay (list_of_violated_rules))
f-6 (SpinQuantumNumber (unique_id 1) (numerator 0) (denominator 1) (z_component_numerator 0))
f-7 (SpinQuantumNumber (unique_id 2) (numerator 1) (denominator 1) (z_component_numerator -1))
f-8 (SpinQuantumNumber (unique_id 3) (numerator 1) (denominator 1) (z_component_numerator 0))
f-9 (SpinQuantumNumber (unique_id 4) (numerator 1) (denominator 1) (z_component_numerator 1))
f-10 (SpinQuantumNumber (unique_id 5) (numerator 2) (denominator 1) (z_component_numerator -2))
f-11 (SpinQuantumNumber (unique_id 6) (numerator 2) (denominator 1) (z_component_numerator -1))
f-12 (SpinQuantumNumber (unique_id 7) (numerator 2) (denominator 1) (z_component_numerator 0))
f-13 (SpinQuantumNumber (unique_id 8) (numerator 2) (denominator 1) (z_component_numerator 1))
f-14 (SpinQuantumNumber (unique_id 9) (numerator 2) (denominator 1) (z_component_numerator 2))
f-15 (AllowedQuantumNumbers (name "spin") (values 1 2 3 4 5 6 7 8 9))
f-16 (AllowedQuantumNumbers (name "isospin") (values 1 2 3 4))
f-17 (AllowedQuantumNumbers (name "charge") (values -1 0 1))
f-18 (AllowedQuantumNumbers (name "parity") (values -1 1))
f-19 (AllowedQuantumNumbers (name "cparity") (values -1 1))
For a total of 20 facts.
Im trying to search for one of the facts within c++ and I do it in the following way:
DATA_OBJECT found_spin_quantum_number_facts;
std::stringstream clips_query;
clips_query << "(find-fact ((?f SpinQuantumNumber))
(and (= ?f:numerator " << spin_state.J_numerator_ << ") (and (=
?f:denominator " << spin_state.J_denominator_ << ") (=
?f:z_component_numerator " << spin_state.J_z_numerator_ << "))))";
std::cout << clips_query.str() << std::endl;
EnvEval(clips_environment_, clips_query.str().c_str(),
&found_spin_quantum_number_facts);
which works several times until it breaks with the following clips expression (which seems legit to me and works several times until it fails):
(find-fact ((?f SpinQuantumNumber)) (and (= ?f:numerator 0) (and (= ?f:denominator 1) (= ?f:z_component_numerator 0))))
The find-fact function actually finishes executing, however in a function FlushMultifields() clips gets stuck... What am I missing? Thanks in advance!
Steve
while (theSegment != NULL) { nextPtr = theSegment->next; if (theSegment->busyCount == 0) {
– steve