public ProgramState()
        {
            DegreeOfFreedoms               = new List <double>();
            StablbiblityScores             = new List <double>();
            Solids                         = new Dictionary <string, List <TessellatedSolid> >();
            SolidsNoFastener               = new Dictionary <string, List <TessellatedSolid> >();
            SolidsNoFastenerSimplified     = new Dictionary <string, List <TessellatedSolid> >();
            SimplifiedSolids               = new Dictionary <string, List <TessellatedSolid> >();
            SaveSolids                     = new List <XMLPair <string, List <SaveableSolid> > >();
            SaveSolidsNoFastener           = new List <XMLPair <string, List <SaveableSolid> > >();
            SaveSolidsNoFastenerSimplified = new List <XMLPair <string, List <SaveableSolid> > >();
            SaveSimplifiedSolids           = new List <XMLPair <string, List <SaveableSolid> > >();

            disDirs         = new List <double[]>();
            disDirsWithFast = new List <double[]>();

            dirOps        = new SaveableDict <int, int>();
            dirOpsForPool = new SaveableDict <int, int>();

            SolidsMass     = new Dictionary <string, double>();
            SaveSolidsMass = new SaveableDict <string, double>();

            BBoxes = new SolidKeySaveDict <BoundingBox>();
            BCyls  = new SolidKeySaveDict <BoundingCylinder>();

            Parts   = new SolidKeySaveDict <Partition[]>();
            PartsAB = new SolidKeySaveDict <PartitionAABB[]>();

            SucTasks               = new SaveableDict <string, List <string> >();
            TaskTime               = new SaveableDict <string, double>();
            SucSubassems           = new List <List <string> >();
            TempSucSubassem        = new List <string>();
            InstTasks              = new SaveableDict <string, SubAssembly>();
            SubAssemAndParts       = new SaveableDict <string, SubAssembly>();
            RefWithOneNode         = new List <Part>();
            RefPrec                = new List <SubAssembly>();
            Movings                = new List <SubAssembly>();
            TranslateToMagicBoxDic = new SaveableDict <string, double[, ]>();
            VertsOnCircle          = new List <double[]>();

            StabilityWeightChosenByUser   = 0;
            UncertaintyWeightChosenByUser = 0;
            MeshMagnifier        = 1;
            PointInMagicBox      = new double[] { 0.0, 0.0, 0.0 };
            DetectFasteners      = true;
            AvailableWorkers     = 0;
            FastenersAreThreaded = 0; // 0: none, 1: all, 2: subset
            StabilityScore       = 0;
            RobustSolution       = false;
            globalDirPool        = new List <int>();
            allmtime             = new List <double>();
            allitime             = new List <double>();
            gpmovingtime         = new List <double>();
            gpinstalltime        = new List <double>();
            gpsecuretime         = new List <double>();
            gprotate             = new List <double>();
        }
        public void Save(string destFile)
        {
            RealToSave(Solids, SaveSolids);
            RealToSave(SolidsNoFastener, SaveSolidsNoFastener);
            RealToSave(SolidsNoFastenerSimplified, SaveSolidsNoFastenerSimplified);
            RealToSave(SimplifiedSolids, SaveSimplifiedSolids);
            SaveSolidsMass = new SaveableDict <string, double>(SolidsMass);

            BBoxes = new SolidKeySaveDict <BoundingBox>(BoundingGeometry.OrientedBoundingBoxDic);
            BCyls  = new SolidKeySaveDict <BoundingCylinder>(BoundingGeometry.BoundingCylinderDic);

            Parts   = new SolidKeySaveDict <Partition[]>(PartitioningSolid.Partitions);
            PartsAB = new SolidKeySaveDict <PartitionAABB[]>(PartitioningSolid.PartitionsAABB);


            SucTasks               = new SaveableDict <string, List <string> >(OptimalOrientation.SucTasks);
            TaskTime               = new SaveableDict <string, double>(OptimalOrientation.TaskTime);
            SucSubassems           = OptimalOrientation.SucSubassems;
            TempSucSubassem        = OptimalOrientation.TempSucSubassem;
            InstTasks              = new SaveableDict <string, SubAssembly>(OptimalOrientation.InstTasks);
            SubAssemAndParts       = new SaveableDict <string, SubAssembly>(OptimalOrientation.SubAssemAndParts);
            RefWithOneNode         = OptimalOrientation.RefWithOneNode;
            RefPrec                = OptimalOrientation.RefPrec;
            Movings                = OptimalOrientation.Movings;
            TranslateToMagicBoxDic = new SaveableDict <string, double[, ]>(OptimalOrientation.TranslateToMagicBoxDic);
            VertsOnCircle          = OptimalOrientation.VertsOnCircle;

            disDirs         = DisassemblyDirections.Directions;
            disDirsWithFast = DisassemblyDirectionsWithFastener.Directions;

            dirOps        = new SaveableDict <int, int>(DisassemblyDirections.DirectionsAndOpposits);
            dirOpsForPool = new SaveableDict <int, int>(DisassemblyDirections.DirectionsAndOppositsForGlobalpool);

            XmlSerializer ser    = new XmlSerializer(typeof(ProgramState));
            var           writer = new StreamWriter(destFile);

            ser.Serialize(writer, this);

            SaveableSolid.saveAll();
            writer.Close();
        }