public HCylinderPalletAnalysis(
     CylinderProperties cylProperties,
     PalletProperties palletProperties,
     HCylinderPalletConstraintSet constraintSet)
     : base(cylProperties.ParentDocument)
 {
     CylinderProperties = cylProperties;
     PalletProperties   = palletProperties;
     _constraintSet     = constraintSet;
 }
 public HCylinderPalletAnalysis(
     CylinderProperties cylProperties,
     PalletProperties palletProperties,
     HCylinderPalletConstraintSet constraintSet)
     : base(cylProperties.ParentDocument)
 {
     CylinderProperties = cylProperties;
     PalletProperties = palletProperties;
     _constraintSet = constraintSet;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new cylinder/pallet analysis without generating solutions
 /// </summary>
 /// <param name="name">Name</param>
 /// <param name="description">Description</param>
 /// <param name="cylinder">Cylinder</param>
 /// <param name="pallet">Pallet</param>
 /// <param name="interlayer">Interlayer or null</param>
 /// <param name="constraintSet">Cylinder/pallet analysis constraint set</param>
 /// <param name="solutions">Solutions</param>
 /// <returns>Cylinder/pallet analysis</returns>
 public HCylinderPalletAnalysis CreateNewHCylinderPalletAnalysis(
     string name, string description
     , CylinderProperties cylinder, PalletProperties pallet
     , HCylinderPalletConstraintSet constraintSet
     , List<HCylinderPalletSolution> solutions)
 {
     HCylinderPalletAnalysis analysis = new HCylinderPalletAnalysis(cylinder, pallet, constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _hCylinderPalletAnalyses.Add(analysis);
     // set solutions
     analysis.Solutions = solutions;
     // notify listeners
     NotifyOnNewHCylinderPalletAnalysisCreated(analysis);
     // set solution selected if its unique
     if (solutions.Count == 1)
         analysis.SelectSolutionByIndex(0);
     return analysis;
 }
Ejemplo n.º 4
0
 public HCylinderPalletAnalysis CreateNewHCylinderPalletAnalysis(
     string name, string description,
     CylinderProperties cylinder, PalletProperties pallet,
     HCylinderPalletConstraintSet constraintSet,
     IHCylinderAnalysisSolver solver)
 {
     HCylinderPalletAnalysis analysis = new HCylinderPalletAnalysis(cylinder, pallet, constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _hCylinderPalletAnalyses.Add(analysis);
     // compute analysis
     solver.ProcessAnalysis(analysis);
     if (analysis.Solutions.Count < 1)
     {   // remove analysis from list if it has no valid solution
         _hCylinderPalletAnalyses.Remove(analysis);
         return null;
     }
     // notify listeners
     NotifyOnNewHCylinderPalletAnalysisCreated(analysis);
     Modify();
     return analysis;
 }
Ejemplo n.º 5
0
 private HCylinderPalletConstraintSet LoadHCylinderPalletConstraintSet(XmlElement eltConstraintSet)
 {
     HCylinderPalletConstraintSet constraints = new HCylinderPalletConstraintSet();
     // stop criterions
     if (constraints.UseMaximumPalletHeight = eltConstraintSet.HasAttribute("MaximumHeight"))
         constraints.MaximumPalletHeight = UnitsManager.ConvertLengthFrom(double.Parse(eltConstraintSet.Attributes["MaximumHeight"].Value), _unitSystem);
     if (constraints.UseMaximumNumberOfItems = eltConstraintSet.HasAttribute("ManimumNumberOfItems"))
         constraints.MaximumNumberOfItems = int.Parse(eltConstraintSet.Attributes["ManimumNumberOfItems"].Value);
     if (constraints.UseMaximumPalletWeight = eltConstraintSet.HasAttribute("MaximumPalletWeight"))
         constraints.MaximumPalletWeight = UnitsManager.ConvertMassFrom(double.Parse(eltConstraintSet.Attributes["MaximumPalletWeight"].Value), _unitSystem);
     // overhang / underhang
     if (eltConstraintSet.HasAttribute("OverhangX"))
         constraints.OverhangX = UnitsManager.ConvertLengthFrom(double.Parse(eltConstraintSet.Attributes["OverhangX"].Value), _unitSystem);
     if (eltConstraintSet.HasAttribute("OverhangY"))
         constraints.OverhangY = UnitsManager.ConvertLengthFrom(double.Parse(eltConstraintSet.Attributes["OverhangY"].Value), _unitSystem);
     return constraints;
 }
Ejemplo n.º 6
0
 private void AppendHCylinderPalletConstraintSet(HCylinderPalletConstraintSet cs, XmlElement elemPalletAnalysis, XmlDocument xmlDoc)
 {
     string ns = xmlDoc.DocumentElement.NamespaceURI;
     // solution
     XmlElement elemConstraintSet = xmlDoc.CreateElement("constraintSet", ns);
     elemPalletAnalysis.AppendChild(elemConstraintSet);
     AppendElementValue(xmlDoc, elemConstraintSet, "overhangX", UnitsManager.UnitType.UT_LENGTH, cs.OverhangX);
     AppendElementValue(xmlDoc, elemConstraintSet, "overhangY", UnitsManager.UnitType.UT_LENGTH, cs.OverhangY);
     // stopCriterion
     if (cs.UseMaximumPalletHeight)
     {
         XmlElement maximumPalletHeightGroup = xmlDoc.CreateElement("maximumPalletHeightGroup", ns);
         elemConstraintSet.AppendChild(maximumPalletHeightGroup);
         // max pallet height
         AppendElementValue(xmlDoc, maximumPalletHeightGroup, "maximumPalletHeight", UnitsManager.UnitType.UT_LENGTH, cs.MaximumPalletHeight);
     }
     if (cs.UseMaximumNumberOfItems)
     {
         XmlElement maximumNumberOfItemsGroup = xmlDoc.CreateElement("maximumNumberOfItemsGroup", ns);
         elemConstraintSet.AppendChild(maximumNumberOfItemsGroup);
         XmlElement maximumNumberOfItems = xmlDoc.CreateElement("maximumNumberOfItems", ns);
         maximumNumberOfItems.InnerText = string.Format("{0}", cs.MaximumNumberOfItems);
         maximumNumberOfItemsGroup.AppendChild(maximumNumberOfItems);
     }
     if (cs.UseMaximumPalletWeight)
     {
         XmlElement maximumPalletWeightGroup = xmlDoc.CreateElement("maximumPalletWeightGroup", ns);
         elemConstraintSet.AppendChild(maximumPalletWeightGroup);
         // max pallet weight
         AppendElementValue(xmlDoc, maximumPalletWeightGroup, "maximumPalletHeight", UnitsManager.UnitType.UT_MASS, cs.MaximumPalletWeight);
     }
 }
Ejemplo n.º 7
0
        public HCylinderPalletAnalysis CreateNewHCylinderPalletAnalysisUI()
        {
            FormNewAnalysisHCylinder form = new FormNewAnalysisHCylinder(this);
            form.Cylinders = Cylinders.ToArray();
            form.Pallets = Pallets.ToArray();

            if (DialogResult.OK == form.ShowDialog())
            {
                // build constraint set
                HCylinderPalletConstraintSet constraintSet = new HCylinderPalletConstraintSet();
                // stop criterion
                constraintSet.MaximumPalletHeight = form.MaximumPalletHeight;
                constraintSet.UseMaximumPalletHeight = form.UseMaximumPalletHeight;
                constraintSet.MaximumPalletWeight = form.MaximumPalletWeight;
                constraintSet.UseMaximumPalletWeight = form.UseMaximumPalletWeight;
                constraintSet.MaximumNumberOfItems = form.MaximumNumberOfItems;
                constraintSet.UseMaximumNumberOfItems = form.UseMaximumNumberOfItems;
                constraintSet.SetAllowedPatterns(form.AllowPatternDefault, form.AllowPatternStaggered, form.AllowPatternColumn);
                constraintSet.RowSpacing = form.RowSpacing;

                return CreateNewHCylinderPalletAnalysis(
                    form.AnalysisName, form.AnalysisDescription,
                    form.SelectedCylinder, form.SelectedPallet,
                    constraintSet,
                    new HCylinderSolver());
            }
            return null;
        }
Ejemplo n.º 8
0
        public void ProcessAnalysis(HCylinderPalletAnalysis analysis)
        {
            _cylProperties = analysis.CylinderProperties;
            _palletProperties = analysis.PalletProperties;
            _constraintSet = analysis.ConstraintSet;
            if (!_constraintSet.IsValid)
                throw new EngineException("Constraint set is invalid!");

            analysis.Solutions = GenerateSolutions();
        }