646 {
647 nCreatedTotal = 0;
648 nVerbose =
p.nVerbose;
649
650 if(
p.nObjsMaxLog <
p.nObjsAllocLog)
651 fatal_error("nObjsMax must not be smaller than nObjsAlloc");
652 if(nVars_ >= (int)VarMax())
653 fatal_error("Memout (nVars) in init");
654 nVars = nVars_;
655 lit nObjsMaxLit = (
lit)1 <<
p.nObjsMaxLog;
656 if(!nObjsMaxLit)
657 fatal_error("Memout (nObjsMax) in init");
658 if(nObjsMaxLit > (
lit)BvarMax())
659 nObjsMax = BvarMax();
660 else
661 nObjsMax = (
bvar)nObjsMaxLit;
662 lit nObjsAllocLit = (
lit)1 <<
p.nObjsAllocLog;
663 if(!nObjsAllocLit)
664 fatal_error("Memout (nObjsAlloc) in init");
665 if(nObjsAllocLit > (
lit)BvarMax())
666 nObjsAlloc = BvarMax();
667 else
668 nObjsAlloc = (
bvar)nObjsAllocLit;
669 if(nObjsAlloc <= (
bvar)nVars)
670 fatal_error("nObjsAlloc must be larger than nVars");
671 uniq nUniqueSize = (
uniq)1 <<
p.nUniqueSizeLog;
672 if(!nUniqueSize)
673 fatal_error("Memout (nUniqueSize) in init");
674
675 if(nVerbose)
676 std::cout << "Allocating " << nObjsAlloc << " nodes and " << nVars << " x " << nUniqueSize << " unique table entries" << std::endl;
677 vVars.resize(nObjsAlloc);
678 vObjs.resize((
lit)nObjsAlloc * 2);
679 vNexts.resize(nObjsAlloc);
680 vMarks.resize(nObjsAlloc);
681 vvUnique.resize(nVars);
682 vUniqueMasks.resize(nVars);
683 vUniqueCounts.resize(nVars);
684 vUniqueTholds.resize(nVars);
685 for(
var v = 0; v < nVars; v++) {
686 vvUnique[v].resize(nUniqueSize);
687 vUniqueMasks[v] = nUniqueSize - 1;
688 if((
lit)(nUniqueSize *
p.UniqueDensity) > (
lit)BvarMax())
689 vUniqueTholds[v] = BvarMax();
690 else
691 vUniqueTholds[v] = (
bvar)(nUniqueSize *
p.UniqueDensity);
692 }
694 if(nVars > 1023)
695 fatal_error("nVars must be less than 1024 to count ones");
696 vOneCounts.resize(nObjsAlloc);
697 }
698
699 cache =
new Cache(
p.nCacheSizeLog,
p.nCacheMaxLog,
p.nCacheVerbose);
700
701 nObjs = 1;
702 vVars[0] = VarMax();
703 for(
var v = 0; v < nVars; v++)
704 UniqueCreateInt(v, 1, 0);
705
706 Var2Level.resize(nVars);
707 Level2Var.resize(nVars);
708 for(
var v = 0; v < nVars; v++) {
710 Var2Level[v] = (*
p.pVar2Level)[v];
711 else
712 Var2Level[v] = v;
713 Level2Var[Var2Level[v]] = v;
714 }
715
716 RemovedHead = 0;
719 MaxGrowth =
p.MaxGrowth;
720 fReoVerbose =
p.fReoVerbose;
721 if(nGbc || nReo != BvarMax())
722 vRefs.resize(nObjsAlloc);
723 }