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