kangaroo  1.0
the cbls library
alldifferentViolationValueToValue.hpp
Go to the documentation of this file.
1 
12 #ifndef AllDifferentViolationValueToValueHppIncluded
13 #define AllDifferentViolationValueToValueHppIncluded
14 
15 
16 
18 
19 
20 
22 
23 
24 
35 template <typename paramValue, typename value = paramValue>
37 {
38  public:
39 
40  typedef paramValue ParamValueType;
41  typedef value ValueType;
42 
45 
48  define(System * const pSystem, Dim const ParamCount, Expression * const * pParamExprs);
49 
51 
52  private:
53 
56 
58  Dim const ParamCount, Expression * const * pParamExprs);
60 
62  (AllDifferentViolationValueToValue<paramValue,value> && that) noexcept = delete;
64  (AllDifferentViolationValueToValue<paramValue,value> const & that) = delete;
66  (AllDifferentViolationValueToValue<paramValue,value> && that) noexcept = delete;
68  (AllDifferentViolationValueToValue<paramValue,value> const & that) = delete;
69 
71 
74 
75  virtual void syncExecClock() override final;
76  virtual void syncSimulClock() override final;
77  #if SimulDownwardCache
78  virtual void syncSimulCacheClock() override final;
79  #endif
80 
82 
85 
86  virtual void computeFinal() override final;
87  virtual void executeAnew() override final;
88  virtual void simulateAnew() override final;
89  virtual void executeIncr() override final;
90  virtual void simulateIncr() override final;
91 
92  #if ComputeLazy
93  virtual void executeBacklog() override final;
94  virtual void emulateBacklog() override final;
95  virtual void undoScalars(Serial const ParamSerial) override final;
96  #endif // ComputeLazy
97 
99 
102 
103  kb<ValueRecord<paramValue> const *> mParamExprValueRecords;
104 
105  #if SimulDownwardCache
106  Int cacheSimulateValue;
107  #endif//SimulDownward
108 
110 
111  #if ComputeLazy
112  Int cacheEmulateValue;
113  #endif // ComputeLazy
114 
115  // the number of possible values would be 2 * #parameters
116  nhsf<paramValue> cacheExecParamValues;
120 
121  // maintained for each parameter and used in execution.
124 
125  nhsc<paramValue> tempSimulParamValues;
127 
128  #if ComputeLazy
129  nhsc<paramValue> cacheEmulParamValues;
130  kb<Dim> cacheEmulValueFreqs;
131  #endif
132 
133  #if SimulDownwardCache
134  // used in simulation
135  nhsc<paramValue> cacheSimulParamValues;
136  kb<Dim> cacheSimulValueFreqs;
137  #endif
138 };
139 
140 
143 
144 template <typename paramValue, typename value>
146 
148 
149 
150 
154 template <typename paramValue, typename value>
156 {
157  WatchError
158  CatchError
159 }
160 
161 
162 
166 template <typename paramValue, typename value>
169  (System * const pSystem, Dim const ParamCount, Expression * const * pParamExprs)
170 {
171  WatchError
172  Warn(ParamCount < 2 || ParamCount > MaxDim, kFuncNotRequiredParams);
173 
175  AllDifferentViolationValueToValue<paramValue,value>(pSystem, ParamCount, pParamExprs);
176 
177  Serial const tFuncSerial = Function::defineWithinSystem(tFunction);
178  if (tFuncSerial != InvalidSerial)
179  return scast<AllDifferentViolationValueToValue<paramValue,value> *>(pSystem->LocateFunc(tFuncSerial));
180 
181  tFunction->defineRootWithinSystem();
182  return tFunction;
183  CatchError
184 }
185 
186 
187 
191 template <typename paramValue, typename value>
193  (System * const theSysMaster, Dim const ParamCount, Expression * const * pParamExprs) :
194  NaryValueFunc<value>(theSysMaster, ParamCount), mParamExprValueRecords(ParamCount)
195  #if SimulDownwardCache
196  , cacheSimulateValue()
197  #endif
199  #if ComputeLazy
200  , cacheEmulateValue()
201  #endif
202  , cacheExecParamValues(ParamCount << 1), cacheExecValueFreqs(cacheExecParamValues.SlotCount()),
204  cacheExecParamIndexes(ParamCount), tempPrevParamIndexes(ParamCount),
205  tempSimulParamValues(ParamCount << 1), tempSimulValueFreqs(tempSimulParamValues.SlotCount())
206  #if ComputeLazy
207  , cacheEmulParamValues(ParamCount), cacheEmulValueFreqs(cacheEmulParamValues.SlotCount())
208  #endif
210  , cacheSimulParamValues(ParamCount), cacheSimulValueFreqs(cacheSimulParamValues.SlotCount())
211  #endif
212 {
213  WatchError
215  this->setParameters(UnorderedParams, ParamCount, pParamExprs);
216  this->setExprHash(this->calcExprHash());
217  this->defineExprValueRecord();
218  for(Serial tParamSerial = 0; tParamSerial < ParamCount; ++tParamSerial)
219  this->mParamExprValueRecords[tParamSerial] = getExprValueRecord<paramValue>(this->ParamExprs[tParamSerial]);
220  CatchError
221 }
222 
223 
224 
228 template <typename paramValue, typename value>
230 {
231  WatchError
232  if (this->Updatable())
233  {
234  for(Serial tParamSerial = 1; tParamSerial < this->ParamExprs.ItemCount(); ++tParamSerial)
235  if (this->ParamExprs[tParamSerial] == this->ParamExprs[tParamSerial - 1] &&
236  (!this->ParamSpecs || this->ParamSpecs->Item(tParamSerial) == this->ParamSpecs->Item(tParamSerial - 1)))
237  { this->setUpdatable(false); break;}
238  }
239 
240  if (this->Updatable()) return;
241 
242  cacheExecuteValue = mParamExprValueRecords.ItemCount(); // violation = n - #unique-value
243 
244  for(Serial tParamSerial = 0; tParamSerial < mParamExprValueRecords.ItemCount(); ++tParamSerial)
245  {
246  Index tExecValueIndex;
247 
248  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
249  if (cacheExecParamValues.insertBool(tParamExecValue, tExecValueIndex))
250  {
252  cacheExecValueFreqs[tExecValueIndex] = 1;
253  }
254  else
255  ++cacheExecValueFreqs[tExecValueIndex];
256  cacheExecParamIndexes[tParamSerial] = tExecValueIndex;
257  }
258 
259  this->mExprValueRecord->finaliseRecord(cacheExecuteValue);
260  CatchError
261 }
262 
263 
264 
268 template <typename paramValue, typename value>
270 {
271  WatchError
272  cacheExecuteValue = mParamExprValueRecords.ItemCount();
273 
274  cacheExecParamValues.clear();
275  for(Serial tParamSerial = 0; tParamSerial < mParamExprValueRecords.ItemCount(); ++tParamSerial)
276  {
277  #if ExecDownward
278  Expression::performExecAnew(this->ParamExprs[tParamSerial]);
279  #endif//ExecDownward
280 
281  Index tExecValueIndex;
282  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
283  if (cacheExecParamValues.insertBool(tParamExecValue, tExecValueIndex))
284  {
286  cacheExecValueFreqs[tExecValueIndex] = 1;
287  }
288  else
289  ++cacheExecValueFreqs[tExecValueIndex];
290  cacheExecParamIndexes[tParamSerial] = tExecValueIndex;
291  }
292 
293  cacheParamValueIndexes.sweep(this->SysMaster->ExecClock()); // this help undo
294 
295  this->mExprValueRecord->initialiseExecData(cacheExecuteValue);
296  #if ExecUpwardOrLazyDownward
297  this->runPostExecAnew();
298  #endif
299  CatchError
300 }
301 
302 
303 
307 template <typename paramValue, typename value>
309 {
310  WatchError
311  tempSimulParamValues.clear(this->SysMaster->SimulClock());
312  Int tSimulValue = mParamExprValueRecords.ItemCount(); // initial value
313  for(Serial tParamSerial = 0; tParamSerial < mParamExprValueRecords.ItemCount(); ++tParamSerial)
314  {
315  #if SimulDownward
316  Expression::performSimulAnew(this->ParamExprs[tParamSerial]);
317  #endif//SimulDownward
318  paramValue const & tSimulParamValue = mParamExprValueRecords[tParamSerial]->SimulData(this->SysMaster->SimulClock());
319  if (tempSimulParamValues.insertBool(tSimulParamValue))
320  --tSimulValue;
321  }
322  this->mExprValueRecord->updateSimulData(this->SysMaster->SimulClock(), tc<Int,value>::iof(tSimulValue));
323  #if SimulUpward
324  this->runPostSimulAnew();
325  #endif
326  CatchError
327 }
328 
329 
330 
331 #if ComputeLazy
332 
335 template <typename paramValue, typename value>
336 inline void AllDifferentViolationValueToValue<paramValue,value>::undoScalars(Serial const ParamSerial)
337 {
338  WatchError
339  // delete prev value
340  Index tParamValIndex = cacheExecParamIndexes[ParamSerial];
341  if (cacheParamValueIndexes.tagBool(tParamValIndex))
342  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
343  --cacheExecValueFreqs[tParamValIndex];
344  if (!cacheExecValueFreqs[tParamValIndex])
346  CatchError
347 }
348 #endif // ComputeLazy
349 
350 
351 
355 template <typename paramValue, typename value>
357 {
358  WatchError
359  #if ExecUpward
360  if (this->mExecChangedParams.TagCount())
361  {
362  for(Index tIndex = 0; tIndex < this->mExecChangedParams.TagCount(); ++tIndex)
363  {
364  Serial const tParamSerial = this->mExecChangedParams.TaggedSerial(tIndex);
365  ValueRecord<paramValue> const * tParamExprValueRecord = mParamExprValueRecords[tParamSerial];
366  if (tParamExprValueRecord->PrevDiff(this->SysMaster->ExecClock()))
367  {
368  // delete prev value
369  Index tParamValIndex = cacheExecParamIndexes[tParamSerial];
370  if (cacheParamValueIndexes.tagBool(tParamValIndex))
371  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
372  --cacheExecValueFreqs[tParamValIndex];
373  if (!cacheExecValueFreqs[tParamValIndex])
375 
376  // add new value
377  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
378  if (cacheExecParamValues.insertBool(tParamExecValue, tParamValIndex))
379  cacheExecValueFreqs[tParamValIndex] = 0;
380 
381  tempPrevParamIndexes[tParamSerial] = cacheExecParamIndexes[tParamSerial];
382  cacheExecParamIndexes[tParamSerial] = tParamValIndex;
383 
384  if (!cacheExecValueFreqs[tParamValIndex])
386  if (cacheParamValueIndexes.tagBool(tParamValIndex))
387  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
388  ++cacheExecValueFreqs[tParamValIndex];
389  }
390  }
391 
392  for(Index tIndex = 0; tIndex < cacheParamValueIndexes.TagCount(); ++tIndex)
393  {
394  Index tParamValIndex = cacheParamValueIndexes[tIndex];
395 
396  if (!cacheExecValueFreqs[tParamValIndex]) // new freq == 0
397  cacheExecParamValues.removeWithIndex(tParamValIndex);
398  // after elimination, the iterator is stll assumed to be valid
399  }
400 
403  this->runPostExecIncr();
404  }
405  #endif//ExecUpward
406  #if ExecDownward
407  #if ComputeLazy
408  if (!this->BacklogExists())
409  {
410  #endif // ComputeLazy
411  if (this->needExecParamComputation()) this->listExecParams();
412  if (this->mBlockExecParams->ItemCount())
413  {
414  for(Index tIndex = 0; tIndex < this->mBlockExecParams->ItemCount(); ++tIndex)
415  {
416  Serial const tParamSerial = this->mBlockExecParams->Item(tIndex);
417  Expression::performExecIncr(this->ParamExprs[tParamSerial]);
418  ValueRecord<paramValue> const * tParamExprValueRecord = mParamExprValueRecords[tParamSerial];
419  if (tParamExprValueRecord->PrevDiff(this->SysMaster->ExecClock()))
420  {
421  // delete prev value
422  Index tParamValIndex = cacheExecParamIndexes[tParamSerial];
423  if (cacheParamValueIndexes.tagBool(tParamValIndex))
424  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
425  --cacheExecValueFreqs[tParamValIndex];
426  if (!cacheExecValueFreqs[tParamValIndex])
428 
429  // add new value
430  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
431  if (cacheExecParamValues.insertBool(tParamExecValue, tParamValIndex))
432  cacheExecValueFreqs[tParamValIndex] = 0;
433  tempPrevParamIndexes[tParamSerial] = cacheExecParamIndexes[tParamSerial];
434  cacheExecParamIndexes[tParamSerial] = tParamValIndex;
435 
436  if (!cacheExecValueFreqs[tParamValIndex])
438  if (cacheParamValueIndexes.tagBool(tParamValIndex))
439  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
440  ++cacheExecValueFreqs[tParamValIndex];
441  }
442  }
443 
444  for(Index tIndex = 0; tIndex < cacheParamValueIndexes.TagCount(); ++tIndex)
445  {
446  Index tParamValIndex = cacheParamValueIndexes[tIndex];
447 
448  if (!cacheExecValueFreqs[tParamValIndex]) // new freq == 0
449  cacheExecParamValues.removeWithIndex(tParamValIndex);
450  }
451 
454  } // mBlockExecParams
455  #if ComputeLazy
456  }
457  else
458  {
459  if (this->needExecParamComputation()) this->markExecParams();
460  for(Index tIndex = 0; tIndex < this->mBlockExecParams->ItemCount(); ++tIndex)
461  {
462  Serial const tParamSerial = this->mBlockExecParams->Item(tIndex);
463  Expression::performExecIncr(this->ParamExprs[tParamSerial]);
464  ValueRecord<paramValue> const * tParamExprValueRecord = mParamExprValueRecords[tParamSerial];
465 
466  if (this->mScalarUndoneParams->Tagged(tParamSerial))
467  {
468  // add new value
469  Index tParamValIndex;
470  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
471  if (cacheExecParamValues.insertBool(tParamExecValue, tParamValIndex))
472  cacheExecValueFreqs[tParamValIndex] = 0;
473  tempPrevParamIndexes[tParamSerial] = cacheExecParamIndexes[tParamSerial];
474  cacheExecParamIndexes[tParamSerial] = tParamValIndex;
475 
476  if (!cacheExecValueFreqs[tParamValIndex])
478  if (cacheParamValueIndexes.tagBool(tParamValIndex))
479  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
480  ++cacheExecValueFreqs[tParamValIndex];
481  }
482  else if (tParamExprValueRecord->PrevDiff(this->SysMaster->ExecClock()))
483  {
484  // delete prev value
485  Index tParamValIndex = cacheExecParamIndexes[tParamSerial];
486  if (cacheParamValueIndexes.tagBool(tParamValIndex))
487  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
488  --cacheExecValueFreqs[tParamValIndex];
489  if (!cacheExecValueFreqs[tParamValIndex])
491 
492  // add new value
493  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
494  if (cacheExecParamValues.insertBool(tParamExecValue, tParamValIndex))
495  cacheExecValueFreqs[tParamValIndex] = 0;
496  tempPrevParamIndexes[tParamSerial] = cacheExecParamIndexes[tParamSerial];
497  cacheExecParamIndexes[tParamSerial] = tParamValIndex;
498 
499  if (!cacheExecValueFreqs[tParamValIndex])
501  if (cacheParamValueIndexes.tagBool(tParamValIndex))
502  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
503  ++cacheExecValueFreqs[tParamValIndex];
504  }
505  }
506 
507  for(Index tIndex = 0; tIndex < this->mBacklogParams.TagCount(); ++tIndex)
508  {
509  Serial const tParamSerial = this->mBacklogParams.TaggedSerial(tIndex);
510  if (this->mLabelExecParams.Tagged(tParamSerial)) continue;
511 
512  Expression::performExecBacklog(this->ParamExprs[tParamSerial]);
513  ValueRecord<paramValue> const * tParamExprValueRecord = mParamExprValueRecords[tParamSerial];
514 
515  if (this->mScalarUndoneParams->Tagged(tParamSerial))
516  {
517  // add new value
518  Index tParamValIndex;
519  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
520  if (cacheExecParamValues.insertBool(tParamExecValue, tParamValIndex))
521  cacheExecValueFreqs[tParamValIndex] = 0;
522  tempPrevParamIndexes[tParamSerial] = cacheExecParamIndexes[tParamSerial];
523  cacheExecParamIndexes[tParamSerial] = tParamValIndex;
524 
525  if (!cacheExecValueFreqs[tParamValIndex])
527 
528  if (cacheParamValueIndexes.tagBool(tParamValIndex))
529  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
530  ++cacheExecValueFreqs[tParamValIndex];
531  }
532  else if (tParamExprValueRecord->PrevDiff(this->SysMaster->ExecClock()))
533  {
534  // delete prev value
535  Index tParamValIndex = cacheExecParamIndexes[tParamSerial];
536  if (cacheParamValueIndexes.tagBool(tParamValIndex))
537  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
538  --cacheExecValueFreqs[tParamValIndex];
539  if (!cacheExecValueFreqs[tParamValIndex])
541 
542  // add new value
543  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
544  if (cacheExecParamValues.insertBool(tParamExecValue, tParamValIndex))
545  cacheExecValueFreqs[tParamValIndex] = 0;
546  tempPrevParamIndexes[tParamSerial] = cacheExecParamIndexes[tParamSerial];
547  cacheExecParamIndexes[tParamSerial] = tParamValIndex;
548 
549  if (!cacheExecValueFreqs[tParamValIndex])
551  if (cacheParamValueIndexes.tagBool(tParamValIndex))
552  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
553  ++cacheExecValueFreqs[tParamValIndex];
554  }
555  }
556  for(Index tIndex = 0; tIndex < cacheParamValueIndexes.TagCount(); ++tIndex)
557  {
558  Index tParamValIndex = cacheParamValueIndexes[tIndex];
559 
560  if (!cacheExecValueFreqs[tParamValIndex]) // new freq == 0
561  cacheExecParamValues.removeWithIndex(tParamValIndex);
562  }
563 
566  }
567  this->runPostExecIncr();
568  #endif // ComputeLazy
569  #endif//ExecDownward
570  CatchError
571 }
572 
573 
574 
575 #if ComputeLazy
576 
579 template <typename paramValue, typename value>
581 {
582  WatchError
583  for(Index tIndex = 0; tIndex < this->mBacklogParams.TagCount(); ++tIndex)
584  {
585  Serial const tParamSerial = this->mBacklogParams.TaggedSerial(tIndex);
586 
587  Expression::performExecBacklog(this->ParamExprs[tParamSerial]);
588  ValueRecord<paramValue> const * tParamExprValueRecord = mParamExprValueRecords[tParamSerial];
589 
590  if (this->mScalarUndoneParams->Tagged(tParamSerial))
591  {
592  // add new value
593  Index tParamValIndex;
594  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
595  if (cacheExecParamValues.insertBool(tParamExecValue, tParamValIndex))
596  cacheExecValueFreqs[tParamValIndex] = 0;
597  tempPrevParamIndexes[tParamSerial] = cacheExecParamIndexes[tParamSerial];
598  cacheExecParamIndexes[tParamSerial] = tParamValIndex;
599 
600  if (!cacheExecValueFreqs[tParamValIndex])
602 
603  if (cacheParamValueIndexes.tagBool(tParamValIndex))
604  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
605  ++cacheExecValueFreqs[tParamValIndex];
606  }
607  else if (tParamExprValueRecord->PrevDiff(this->SysMaster->ExecClock()))
608  {
609  // delete prev value
610  Index tParamValIndex = cacheExecParamIndexes[tParamSerial];
611  if (cacheParamValueIndexes.tagBool(tParamValIndex))
612  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
613  --cacheExecValueFreqs[tParamValIndex];
614  if (!cacheExecValueFreqs[tParamValIndex])
616 
617  // add new value
618  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
619  if (cacheExecParamValues.insertBool(tParamExecValue, tParamValIndex))
620  cacheExecValueFreqs[tParamValIndex] = 0;
621  tempPrevParamIndexes[tParamSerial] = cacheExecParamIndexes[tParamSerial];
622  cacheExecParamIndexes[tParamSerial] = tParamValIndex;
623 
624  if (!cacheExecValueFreqs[tParamValIndex])
626 
627  if (cacheParamValueIndexes.tagBool(tParamValIndex))
628  cachePrevValueFreqs[tParamValIndex] = cacheExecValueFreqs[tParamValIndex];
629  ++cacheExecValueFreqs[tParamValIndex];
630  }
631  }
632 
633  for(Index tIndex = 0; tIndex < cacheParamValueIndexes.TagCount(); ++tIndex)
634  {
635  Index tParamValIndex = cacheParamValueIndexes[tIndex];
636 
637  if (!cacheExecValueFreqs[tParamValIndex]) // new freq == 0
638  cacheExecParamValues.removeWithIndex(tParamValIndex);
639  }
640 
643  this->runPostExecBacklog();
644  CatchError
645 }
646 #endif // ComputeLazy
647 
648 
649 
653 template <typename paramValue, typename value>
655 {
656  WatchError
657  #if SimulUpward
658  if (this->mSimulChangedParams.TagCount())
659  {
660  Int tSimulValue = cacheExecuteValue;
661  tempSimulParamValues.clear(this->SysMaster->SimulClock());
662  for(Index tIndex = 0; tIndex < this->mSimulChangedParams.TagCount(); ++tIndex)
663  {
664  Serial const tParamSerial = this->mSimulChangedParams.TaggedSerial(tIndex);
665  ValueRecord<paramValue> const * tParamExprValueRecord = mParamExprValueRecords[tParamSerial];
666  if (tParamExprValueRecord->SimulDiff(this->SysMaster->SimulClock()))
667  {
668  // drop execution value
669  Index tSimulIndex;
670  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecBuffer();
671  if (tempSimulParamValues.insertBool(tParamExecValue, tSimulIndex))
672  {
673  Index tExecIndex = cacheExecParamIndexes[tParamSerial];
674  tempSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
675  }
676  --tempSimulValueFreqs[tSimulIndex];
677  if (!tempSimulValueFreqs[tSimulIndex]) ++tSimulValue;
678 
679  // add simulation value
680  paramValue const & tParamSimulValue = mParamExprValueRecords[tParamSerial]->SimulBuffer();
681  if (tempSimulParamValues.insertBool(tParamSimulValue, tSimulIndex))
682  {
683  Index tExecIndex = cacheExecParamValues.KeyIndex(tParamSimulValue);
684  if (tExecIndex == InvalidIndex) tempSimulValueFreqs[tSimulIndex] = 0;
685  else tempSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
686  }
687  if (!tempSimulValueFreqs[tSimulIndex]) --tSimulValue;
688  ++tempSimulValueFreqs[tSimulIndex];
689  }
690  }
691  this->mExprValueRecord->updateSimulData(this->SysMaster->SimulClock(), tc<Int,value>::iof(tSimulValue));
692  this->runPostSimulIncr();
693  }
694  #endif //SimulUpward
695  #if SimulDownward
696  #if ComputeLazy
697  if (!this->BacklogExists())
698  {
699  #endif // ComputeLazy
700  #if SimulFlexi
701  if (this->needSimulFlexiParamComputation()) this->listSimulFlexiParams();
702  #endif
703  #if SimulFixedFlexi
704  if (this->needSimulFixedParamComputation())
705  this->enumSimulFixedParams(this->mBlockSimulFlexiParams->ItemCount());
706  #elif SimulFixedOnly
707  if (this->needSimulFixedParamComputation()) this->listSimulFixedParams();
708  #endif
709 
710  #if SimulFixed
711  if (this->needSimulCacheComputation())
712  {
713  cacheSimulateValue = cacheExecuteValue;
714  cacheSimulParamValues.clear(this->SysMaster->SimulCacheClock());
715  for(Index tIndex = 0; tIndex < this->mBlockSimulFixedParams->ItemCount(); ++tIndex)
716  {
717  Index tSimulIndex;
718  Serial const tParamSerial = this->mBlockSimulFixedParams->Item(tIndex);
719  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
720  if (cacheSimulParamValues.insertBool(tParamExecValue, tSimulIndex))
721  {
722  Index tExecIndex = cacheExecParamIndexes[tParamSerial];
723  cacheSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
724  }
725  --cacheSimulValueFreqs[tSimulIndex];
726  if (!cacheSimulValueFreqs[tSimulIndex]) ++cacheSimulateValue;
727  }
728  }
729  #endif//SimulFixed
730 
731  #if SimulFixedFlexi
732  if (this->mBlockSimulFixedParams->ItemCount() || this->mBlockSimulFlexiParams->ItemCount())
733  #elif SimulFixedOnly
734  if (this->mBlockSimulFixedParams->ItemCount())
735  #elif SimulFlexiOnly
736  if (this->mBlockSimulFlexiParams->ItemCount())
737  #endif
738  {
739  tempSimulParamValues.clear(this->SysMaster->SimulClock());
740 
741  #if SimulFixed
742  Int tSimulValue = cacheSimulateValue;
743  #else
744  Int tSimulValue = cacheExecuteValue;
745  #endif
746  #if SimulFixed
747  for(Index tIndex = 0; tIndex < this->mBlockSimulFixedParams->ItemCount(); ++tIndex)
748  {
749  Serial const tParamSerial = this->mBlockSimulFixedParams->Item(tIndex);
750  Expression::performSimulIncr(this->ParamExprs[tParamSerial]);
751 
752  Index tSimulIndex;
753  paramValue const & tParamSimulValue = mParamExprValueRecords[tParamSerial]->SimulData(this->SysMaster->SimulClock());
754  if (tempSimulParamValues.insertBool(tParamSimulValue, tSimulIndex))
755  {
756  Index tSimulCacheIndex = cacheSimulParamValues.KeyIndex(tParamSimulValue);
757  if (tSimulCacheIndex != InvalidIndex)
758  tempSimulValueFreqs[tSimulIndex] = cacheSimulValueFreqs[tSimulCacheIndex];
759  else
760  {
761  Index tExecIndex = cacheExecParamValues.KeyIndex(tParamSimulValue);
762  if (tExecIndex == InvalidIndex) tempSimulValueFreqs[tSimulIndex] = 0;
763  else tempSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
764  }
765  }
766 
767  if (!tempSimulValueFreqs[tSimulIndex]) --tSimulValue;
768  ++tempSimulValueFreqs[tSimulIndex];
769  }
770  #endif//SimulFixed
771 
772  #if SimulFlexi
773  for(Index tIndex = 0; tIndex < this->mBlockSimulFlexiParams->ItemCount(); ++tIndex)
774  {
775  Serial const tParamSerial = this->mBlockSimulFlexiParams->Item(tIndex);
776  #if SimulFixed
777  if (this->mLabelSimulFixedParams.Tagged(tParamSerial)) continue;
778  #endif
779  Expression::performSimulIncr(this->ParamExprs[tParamSerial]);
780  ValueRecord<paramValue> const * tParamExprValueRecord = mParamExprValueRecords[tParamSerial];
781  if (tParamExprValueRecord->SimulDiff(this->SysMaster->SimulClock()))
782  {
783  // drop execution value
784  Index tSimulIndex;
785  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecBuffer();
786  if (tempSimulParamValues.insertBool(tParamExecValue, tSimulIndex))
787  {
788  #if SimulFixed
789  Index tSimulCacheIndex = cacheSimulParamValues.KeyIndex(tParamExecValue);
790  if (tSimulCacheIndex != InvalidIndex)
791  tempSimulValueFreqs[tSimulIndex] = cacheSimulValueFreqs[tSimulCacheIndex];
792  else
793  #endif
794  {
795  Index tExecIndex = cacheExecParamIndexes[tParamSerial];
796  tempSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
797  }
798  }
799  --tempSimulValueFreqs[tSimulIndex];
800  if (!tempSimulValueFreqs[tSimulIndex]) ++tSimulValue;
801 
802  // add simulation value
803  paramValue const & tParamSimulValue = mParamExprValueRecords[tParamSerial]->SimulBuffer();
804  if (tempSimulParamValues.insertBool(tParamSimulValue, tSimulIndex))
805  {
806  #if SimulFixed
807  Index tSimulCacheIndex = cacheSimulParamValues.KeyIndex(tParamSimulValue);
808  if (tSimulCacheIndex != InvalidIndex)
809  tempSimulValueFreqs[tSimulIndex] = cacheSimulValueFreqs[tSimulCacheIndex];
810  else
811  #endif
812  {
813  Index tExecIndex = cacheExecParamValues.KeyIndex(tParamSimulValue);
814  if (tExecIndex == InvalidIndex) tempSimulValueFreqs[tSimulIndex] = 0;
815  else tempSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
816  }
817  }
818  if (!tempSimulValueFreqs[tSimulIndex]) --tSimulValue;
819  ++tempSimulValueFreqs[tSimulIndex];
820  }
821  }
822  #endif //SimulFlexi
823  this->mExprValueRecord->updateSimulData(this->SysMaster->SimulClock(), tc<Int,value>::iof(tSimulValue));
824  }
825  #if ComputeLazy
826  }
827  else // defered
828  {
829  #if SimulFlexi
830  if (this->needSimulFlexiParamComputation()) this->listSimulFlexiParams();
831  #endif
832  #if SimulFixed
833  if (this->needSimulFixedParamComputation()) this->markSimulFixedParams();
834  #endif
835 
836  if (this->needSimulCacheComputation())
837  {
838  cacheSimulParamValues.clear(this->SysMaster->SimulCacheClock());
839  if (!this->ChangedSystemEmulClock())
840  {
841  cacheSimulateValue = cacheEmulateValue;
842  #if SimulFixed
843  for(Index tIndex = 0; tIndex < this->mBlockSimulFixedParams->ItemCount(); ++tIndex)
844  {
845  Serial const tParamSerial = this->mBlockSimulFixedParams->Item(tIndex);
846 
847  Index tSimulIndex;
848  paramValue const & tParamEmulValue =
849  mParamExprValueRecords[tParamSerial]->EmulData(this->SysMaster->EmulClock());
850  if (cacheSimulParamValues.insertBool(tParamEmulValue, tSimulIndex))
851  {
852  Index tEmulIndex = cacheEmulParamValues.KeyIndex(tParamEmulValue);
853  if (tEmulIndex != InvalidIndex)
854  cacheSimulValueFreqs[tSimulIndex] = cacheEmulValueFreqs[tEmulIndex];
855  else
856  {
857  Index tExecIndex = cacheExecParamIndexes[tParamSerial];
858  cacheSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
859  }
860  }
861  --cacheSimulValueFreqs[tSimulIndex];
862  if (!cacheSimulValueFreqs[tSimulIndex]) ++cacheSimulateValue;
863  }
864  #endif //SimulFixed
865  }
866  else
867  {
868  cacheSimulateValue = cacheExecuteValue;
869  #if SimulFixed
870  for(Index tIndex = 0; tIndex < this->mBlockSimulFixedParams->ItemCount(); ++tIndex)
871  {
872  Serial const tParamSerial = this->mBlockSimulFixedParams->Item(tIndex);
873  if (!this->mScalarUndoneParams->Tagged(tParamSerial))
874  {
875  Index tSimulIndex;
876  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecData();
877  if (cacheSimulParamValues.insertBool(tParamExecValue, tSimulIndex))
878  {
879  Index tExecIndex = cacheExecParamIndexes[tParamSerial];
880  cacheSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
881  }
882  --cacheSimulValueFreqs[tSimulIndex];
883  if (!cacheSimulValueFreqs[tSimulIndex]) ++cacheSimulateValue;
884  }
885  }
886  #endif //SimulFixed
887  for(Index tIndex = 0; tIndex < this->mBacklogParams.TagCount(); ++tIndex)
888  {
889  Serial const tParamSerial = this->mBacklogParams.TaggedSerial(tIndex);
890  #if SimulFixed
891  if (this->mLabelSimulFixedParams.Tagged(tParamSerial)) continue;
892  #endif //SimulFixed
893  Expression::performEmulBacklog(this->ParamExprs[tParamSerial]);
895  tParamExprValueRecord = mParamExprValueRecords[tParamSerial];
896 
897  if (this->mScalarUndoneParams->Tagged(tParamSerial))
898  {
899  Index tSimulIndex;
900  paramValue const & tParamEmulValue =
901  tParamExprValueRecord->EmulData(this->SysMaster->EmulClock());
902  if (cacheSimulParamValues.insertBool(tParamEmulValue, tSimulIndex))
903  {
904  Index tExecIndex = cacheExecParamValues.KeyIndex(tParamEmulValue);
905  if (tExecIndex == InvalidIndex) cacheSimulValueFreqs[tSimulIndex] = 0;
906  else cacheSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
907  }
908  if (!cacheSimulValueFreqs[tSimulIndex]) --cacheSimulateValue;
909  ++cacheSimulValueFreqs[tSimulIndex];
910  }
911  else if (tParamExprValueRecord->EmulDiff(this->SysMaster->EmulClock()))
912  {
913  // drop execution value
914  Index tSimulIndex;
915  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecBuffer();
916  if (cacheSimulParamValues.insertBool(tParamExecValue, tSimulIndex))
917  {
918  Index tExecIndex = cacheExecParamIndexes[tParamSerial];
919  cacheSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
920  }
921  --cacheSimulValueFreqs[tSimulIndex];
922  if (!cacheSimulValueFreqs[tSimulIndex]) ++cacheSimulateValue;
923 
924  // add emulation value
925  paramValue const & tParamEmulValue = mParamExprValueRecords[tParamSerial]->EmulBuffer();
926  if (cacheSimulParamValues.insertBool(tParamEmulValue, tSimulIndex))
927  {
928  Index tExecIndex = cacheExecParamValues.KeyIndex(tParamEmulValue);
929  if (tExecIndex == InvalidIndex) cacheSimulValueFreqs[tSimulIndex] = 0;
930  else cacheSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
931  }
932  if (!cacheSimulValueFreqs[tSimulIndex]) --cacheSimulateValue;
933  ++cacheSimulValueFreqs[tSimulIndex];
934  }
935  }
936  }
937  }
938 
939  tempSimulParamValues.clear(this->SysMaster->SimulClock());
940  Int tSimulValue = cacheSimulateValue;
941 
942  #if SimulFixed
943  for(Index tIndex = 0; tIndex < this->mBlockSimulFixedParams->ItemCount(); ++tIndex)
944  {
945  Serial const tParamSerial = this->mBlockSimulFixedParams->Item(tIndex);
946  Expression::performSimulIncr(this->ParamExprs[tParamSerial]);
947 
948  Index tSimulIndex;
949  paramValue const & tParamSimulValue =
950  mParamExprValueRecords[tParamSerial]->SimulData(this->SysMaster->SimulClock());
951  if (tempSimulParamValues.insertBool(tParamSimulValue, tSimulIndex))
952  {
953  Index tSimulCacheIndex = cacheSimulParamValues.KeyIndex(tParamSimulValue);
954  if (tSimulCacheIndex != InvalidIndex)
955  tempSimulValueFreqs[tSimulIndex] = cacheSimulValueFreqs[tSimulCacheIndex];
956  else
957  {
958  Index tEmulIndex = InvalidIndex;
959  if (!this->ChangedSystemEmulClock())
960  {
961  tEmulIndex = cacheEmulParamValues.KeyIndex(tParamSimulValue);
962  if (tEmulIndex != InvalidIndex)
963  tempSimulValueFreqs[tSimulIndex] = cacheEmulValueFreqs[tEmulIndex];
964  }
965  if (tEmulIndex == InvalidIndex)
966  {
967  Index tExecIndex = cacheExecParamValues.KeyIndex(tParamSimulValue);
968  if (tExecIndex == InvalidIndex) tempSimulValueFreqs[tSimulIndex] = 0;
969  else tempSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
970  }
971  }
972  }
973  if (!tempSimulValueFreqs[tSimulIndex]) --tSimulValue;
974  ++tempSimulValueFreqs[tSimulIndex];
975  }
976  #endif//SimulFixed
977 
978  #if SimulFlexi
979  for(Index tIndex = 0; tIndex < this->mBlockSimulFlexiParams->ItemCount(); ++tIndex)
980  {
981  Serial const tParamSerial = this->mBlockSimulFlexiParams->Item(tIndex);
982 
983  #if SimulFixed
984  if (this->mLabelSimulFixedParams.Tagged(tParamSerial)) continue;
985  #endif
986 
987  Expression::performEmulBacklog(this->ParamExprs[tParamSerial]);
988  Expression::performSimulIncr(this->ParamExprs[tParamSerial]);
990  tParamExprValueRecord = mParamExprValueRecords[tParamSerial];
991  if (tParamExprValueRecord->EmulSimulDiff(this->SysMaster->EmulClock(), this->SysMaster->SimulClock()))
992  {
993  tSimulValue += tParamExprValueRecord->SimulData(this->SysMaster->SimulClock()) -
994  tParamExprValueRecord->EmulData(this->SysMaster->EmulClock());
995 
996  // drop execution value
997  Index tSimulIndex;
998  paramValue const & tParamEmulValue =
999  tParamExprValueRecord->EmulData(this->SysMaster->EmulClock());
1000  if (tempSimulParamValues.insertBool(tParamEmulValue, tSimulIndex))
1001  {
1002  Index tSimulCacheIndex = cacheSimulParamValues.KeyIndex(tParamEmulValue);
1003  if (tSimulCacheIndex != InvalidIndex)
1004  tempSimulValueFreqs[tSimulIndex] = cacheSimulValueFreqs[tSimulCacheIndex];
1005  else
1006  {
1007  Index tEmulIndex = InvalidIndex;
1008  if (!this->ChangedSystemEmulClock())
1009  {
1010  tEmulIndex = cacheEmulParamValues.KeyIndex(tParamEmulValue);
1011  if (tEmulIndex != InvalidIndex)
1012  tempSimulValueFreqs[tSimulIndex] = cacheEmulValueFreqs[tEmulIndex];
1013  }
1014  if (tEmulIndex == InvalidIndex)
1015  {
1016  Index tExecIndex = cacheExecParamValues.KeyIndex(tParamEmulValue);
1017  tempSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
1018  }
1019  }
1020  }
1021  --tempSimulValueFreqs[tSimulIndex];
1022  if (!tempSimulValueFreqs[tSimulIndex]) ++tSimulValue;
1023 
1024  // add simulation value
1025  paramValue const & tParamSimulValue =
1026  mParamExprValueRecords[tParamSerial]->SimulData(this->SysMaster->SimulClock());
1027  if (tempSimulParamValues.insertBool(tParamSimulValue, tSimulIndex))
1028  {
1029  Index tSimulCacheIndex = cacheSimulParamValues.KeyIndex(tParamSimulValue);
1030  if (tSimulCacheIndex != InvalidIndex)
1031  tempSimulValueFreqs[tSimulIndex] = cacheSimulValueFreqs[tSimulCacheIndex];
1032  else
1033  {
1034  Index tEmulIndex = InvalidIndex;
1035  if (!this->ChangedSystemEmulClock())
1036  {
1037  tEmulIndex = cacheEmulParamValues.KeyIndex(tParamSimulValue);
1038  if (tEmulIndex != InvalidIndex)
1039  tempSimulValueFreqs[tSimulIndex] = cacheEmulValueFreqs[tEmulIndex];
1040  }
1041  if (tEmulIndex == InvalidIndex)
1042  {
1043  Index tExecIndex = cacheExecParamValues.KeyIndex(tParamSimulValue);
1044  if (tExecIndex == InvalidIndex) tempSimulValueFreqs[tSimulIndex] = 0;
1045  else tempSimulValueFreqs[tSimulIndex] = cacheExecValueFreqs[tExecIndex];
1046  }
1047  }
1048  }
1049  if (!tempSimulValueFreqs[tSimulIndex]) --tSimulValue;
1050  ++tempSimulValueFreqs[tSimulIndex];
1051  }
1052  }
1053  #endif
1054  this->mExprValueRecord->updateSimulData(this->SysMaster->SimulClock(), tc<Int,value>::iof(tSimulValue));
1055  }
1056  #endif // ComputeLazy
1057  #endif//SimulDownward
1058  CatchError
1059 }
1060 
1061 
1062 
1063 #if ComputeLazy
1064 
1067 template <typename paramValue, typename value>
1069 {
1070  WatchError
1071  cacheEmulateValue = cacheExecuteValue;
1072  cacheEmulParamValues.clear(this->SysMaster->EmulClock());
1073  for(Index tIndex = 0; tIndex < this->mBacklogParams.TagCount(); ++tIndex)
1074  {
1075  Serial const tParamSerial = this->mBacklogParams.TaggedSerial(tIndex);
1076  Expression::performEmulBacklog(this->ParamExprs[tParamSerial]);
1077  ValueRecord<paramValue> const * tParamExprValueRecord = mParamExprValueRecords[tParamSerial];
1078 
1079  if (this->mScalarUndoneParams->Tagged(tParamSerial))
1080  {
1081  Index tEmulIndex;
1082  paramValue const & tParamEmulValue = mParamExprValueRecords[tParamSerial]->EmulData(this->SysMaster->EmulClock());
1083  if (cacheEmulParamValues.insertBool(tParamEmulValue, tEmulIndex))
1084  {
1085  Index tExecIndex = cacheExecParamValues.KeyIndex(tParamEmulValue);
1086  if (tExecIndex == InvalidIndex) cacheEmulValueFreqs[tEmulIndex] = 0;
1087  else cacheEmulValueFreqs[tEmulIndex] = cacheExecValueFreqs[tExecIndex];
1088  }
1089  if (!cacheEmulValueFreqs[tEmulIndex]) --cacheEmulateValue;
1090  ++cacheEmulValueFreqs[tEmulIndex];
1091  }
1092  else if (tParamExprValueRecord->EmulDiff(this->SysMaster->EmulClock()))
1093  {
1094  // drop execution value
1095  Index tEmulIndex;
1096  paramValue const & tParamExecValue = mParamExprValueRecords[tParamSerial]->ExecBuffer();
1097  if (cacheEmulParamValues.insertBool(tParamExecValue, tEmulIndex))
1098  {
1099  Index tExecIndex = cacheExecParamIndexes[tParamSerial];
1100  cacheEmulValueFreqs[tEmulIndex] = cacheExecValueFreqs[tExecIndex];
1101  }
1102  --cacheEmulValueFreqs[tEmulIndex];
1103  if (!cacheEmulValueFreqs[tEmulIndex]) ++cacheEmulateValue;
1104 
1105  // add simulation value
1106  paramValue const & tParamEmulValue = mParamExprValueRecords[tParamSerial]->EmulBuffer();
1107  if (cacheEmulParamValues.insertBool(tParamEmulValue, tEmulIndex))
1108  {
1109  Index tExecIndex = cacheExecParamValues.KeyIndex(tParamEmulValue);
1110  if (tExecIndex == InvalidIndex) cacheEmulValueFreqs[tEmulIndex] = 0;
1111  else cacheEmulValueFreqs[tEmulIndex] = cacheExecValueFreqs[tExecIndex];
1112  }
1113  if (!cacheEmulValueFreqs[tEmulIndex]) --cacheEmulateValue;
1114  ++cacheEmulValueFreqs[tEmulIndex];
1115  }
1116  }
1117 
1118  this->mExprValueRecord->updateEmulData(this->SysMaster->EmulClock(), cacheEmulateValue);
1119  CatchError
1120 }
1121 #endif // ComputeLazy
1122 
1123 
1124 
1128 template <typename paramValue, typename value>
1130 {
1131  WatchError
1132  cacheParamValueIndexes.syncClock();
1133  #if ComputeLazy
1134  cacheEmulParamValues.syncClock();
1135  #endif
1137  CatchError
1138 }
1139 
1140 
1144 template <typename paramValue, typename value>
1146 {
1147  WatchError
1148  tempSimulParamValues.syncClock();
1150  CatchError
1151 }
1152 
1153 
1154 #if SimulDownwardCache
1155 
1158 template <typename paramValue, typename value>
1160 {
1161  WatchError
1162  cacheSimulParamValues.syncClock();
1164  CatchError
1165 }
1166 #endif//SimulDownwardCache
1167 
1169 
1170 
1171 #endif//AllDifferentViolationValueToValueHppIncluded
void updateExecData(Clock const ExecClock, data const &Data)
Update the execution data.
Definition: scalarrecord.hpp:228
All different violation value to value function.
Definition: alldifferentViolationValueToValue.hpp:36
static void performExecIncr(Expression *const pExpression)
Execute in incremental mode.
Definition: expression1.hpp:287
virtual void simulateAnew() overridefinal
Simulate the expression.
Definition: alldifferentViolationValueToValue.hpp:308
void setExprHash(Hash const pHash)
Set expression hash value.
Definition: expression1.hpp:607
virtual void syncSimulClock() override
synchronise the simulation clock.
Definition: valueFunction.hpp:242
AllDifferentViolationValueToValue(System *const pSystem, Dim const ParamCount, Expression *const *pParamExprs)
Param constructor.
Definition: alldifferentViolationValueToValue.hpp:193
Bool Updatable() const
Whether the expression updatable—variables are updatable, functions may be updatable.
Definition: expression1.hpp:44
Clock SimulClock() const
Get the simulation clock.
Definition: system1.hpp:249
#define SimulFlexiOnly
Use flexi simulation only, not fixed one.
Definition: options.hpp:166
virtual void executeIncr() overridefinal
Execute the expression.
Definition: alldifferentViolationValueToValue.hpp:356
kb< ParamSpecType > const *const ParamSpecs
Parameter specifications i.e. how to use values and metrics.
Definition: function0.hpp:172
kb< Index > tempPrevParamIndexes
Indexes for the previous values of the parameters.
Definition: alldifferentViolationValueToValue.hpp:123
static AllDifferentViolationValueToValue< paramValue, value > * define(System *const pSystem, Dim const ParamCount, Expression *const *pParamExprs)
Define an all different violation value to value function in the system.
Definition: alldifferentViolationValueToValue.hpp:169
nhsc< paramValue > tempSimulParamValues
Simulation values of the parameters.
Definition: alldifferentViolationValueToValue.hpp:125
#define openKangarooSpace
Open the project namespace.
Definition: project.hpp:74
void updateSimulData(Clock const SimulClock, data const &Data)
Update the simulation data.
Definition: valuerecord.hpp:299
constexpr char const * kFuncNotRequiredParams
Function does not have required parameters.
Definition: messages.hpp:247
void initialiseExecData(data const &Data)
Initialise the execution data.
Definition: scalarrecord.hpp:214
virtual void syncSimulClock() overridefinal
Sync the simulation clock.
Definition: alldifferentViolationValueToValue.hpp:1145
Bool SimulDiff(Clock const SimulClock) const
SimulDiff = (SimulClock == SimulClock).
Definition: valuerecord.hpp:420
Bool PrevDiff(Clock const ExecClock) const
PrevDiff = (PrevClock == ExecClock).
Definition: scalarrecord.hpp:313
kb< Expression * > const ParamExprs
Parameter expressions that this function immediately depends on.
Definition: function0.hpp:171
static Serial defineWithinSystem(Function *const pFunction)
Define the function in the system.
Definition: function1.hpp:1619
Hash calcExprHash() const
Calculate expression hash value.
Definition: function1.hpp:855
Int cacheExecuteValue
Execution cache value.
Definition: alldifferentViolationValueToValue.hpp:109
nhsf< paramValue > cacheExecParamValues
Execution values of the parameters.
Definition: alldifferentViolationValueToValue.hpp:116
Flexible arity value functions.
void setParameters(ParamOrder const pParamOrder, Dim const ParamCount, Expression *const *const pParamExprs, ParamSpecType const *const pParamSpecs=nullptr, Index *const pParamIndexes=nullptr)
Set the parameters, if unordered then expression pointers along with indexes (if given) are sorted...
Definition: function1.hpp:927
kb< Dim > cachePrevValueFreqs
Frequencies of the previous values of the parameters.
Definition: alldifferentViolationValueToValue.hpp:118
virtual void simulateIncr() overridefinal
Simulate the expression.
Definition: alldifferentViolationValueToValue.hpp:654
void setExprFormat(Identifier const pFormat)
Set expression format.
Definition: expression1.hpp:577
#define ComputeLazy
Perform lazy computation.
Definition: options.hpp:112
virtual void syncExecClock() overridefinal
Sync the execution clock.
Definition: alldifferentViolationValueToValue.hpp:1129
void finaliseRecord(data const &Data)
Finalise the record.
Definition: valuerecord.hpp:262
static void performExecAnew(Expression *const pExpression)
Execute in anew mode.
Definition: expression1.hpp:271
kb< ValueRecord< paramValue > const * > mParamExprValueRecords
Parameter value record pointers.
Definition: alldifferentViolationValueToValue.hpp:103
~AllDifferentViolationValueToValue()
Destructor.
Definition: alldifferentViolationValueToValue.hpp:155
kb< Dim > cacheExecValueFreqs
Fequencies of the execution values of the parameters.
Definition: alldifferentViolationValueToValue.hpp:117
kb< Dim > tempSimulValueFreqs
Frequencies of the simulation values of the parameters.
Definition: alldifferentViolationValueToValue.hpp:126
Unique identifier of a class.
void defineRootWithinSystem()
Define as a root within the system.
Definition: function1.hpp:1605
value ValueType
Value type.
Definition: alldifferentViolationValueToValue.hpp:41
Clock ExecClock() const
Get the execution clock.
Definition: system1.hpp:237
virtual void syncExecClock() override
Synchronise the execution clock.
Definition: valueFunction.hpp:229
void setUpdatable(Bool const SetNotUnset)
Set expression updatablity.
Definition: expression1.hpp:646
kb< Index > cacheExecParamIndexes
Indexes for the execution values of the parameters.
Definition: alldifferentViolationValueToValue.hpp:122
Unordered parameters.
Definition: parameter.hpp:66
ValueRecord< value > * mExprValueRecord
Expression value.
Definition: valueFunction.hpp:100
static void performSimulIncr(Expression *const pExpression)
Simulate in incremental mode.
Definition: expression1.hpp:326
Constraint-based local search systems.
Definition: system0.hpp:45
kll< Index > cacheParamValueIndexes
Indexes of the parameter values having changes.
Definition: alldifferentViolationValueToValue.hpp:119
System *const SysMaster
The system that contains this expression.
Definition: expression0.hpp:281
#define SimulFixedOnly
Use fixed simulation only, not flexi one.
Definition: options.hpp:165
virtual void computeFinal() overridefinal
Compute the expression.
Definition: alldifferentViolationValueToValue.hpp:229
#define closeKangarooSpace
Close the project namespace.
Definition: project.hpp:75
void defineExprValueRecord()
Define expression value.
Definition: valueFunction.hpp:216
virtual void executeAnew() overridefinal
Execute the expression.
Definition: alldifferentViolationValueToValue.hpp:269
data const & SimulData(Clock const SimulClock) const
SimulDiff ? SimulBuffer : ExecBuffer().
Definition: valuerecord.hpp:408
#define SimulDownwardCache
Use cache in lazy or fixed downward simulation.
Definition: options.hpp:308
Abstract expressions.
Definition: expression0.hpp:41
Value records store expression values.
Definition: valuerecord.hpp:32
static void performSimulAnew(Expression *const pExpression)
Simulate in anew mode.
Definition: expression1.hpp:310
Flexible arity value functions.
Definition: naryValueFunc.hpp:31
paramValue ParamValueType
Parameter value type.
Definition: alldifferentViolationValueToValue.hpp:40