public BoxCaseAnalysis(BProperties bProperties, BoxProperties caseProperties, BCaseConstraintSet constraintSet) : base(bProperties.ParentDocument) { if (!constraintSet.IsValid) throw new Exception("Using invalid box/case constraintset -> Can not instantiate box/case analysis!"); this.BProperties = bProperties; this.CaseProperties = caseProperties; _constraintSet = constraintSet; }
public BoxCaseAnalysis(BProperties bProperties, BoxProperties caseProperties, BCaseConstraintSet constraintSet) : base(bProperties.ParentDocument) { if (!constraintSet.IsValid) { throw new Exception("Using invalid box/case constraintset -> Can not instantiate box/case analysis!"); } this.BProperties = bProperties; this.CaseProperties = caseProperties; _constraintSet = constraintSet; }
public void ProcessAnalysis(BoxCaseAnalysis analysis) { _bProperties = analysis.BProperties; _caseProperties = analysis.CaseProperties; _constraintSet = analysis.ConstraintSet; if (!_constraintSet.IsValid) throw new EngineException("Constraint set is invalid!"); analysis.Solutions = GenerateSolutions(); }
public BoxCaseAnalysis CreateNewBoxCaseAnalysis( string name, string description , BProperties boxProperties, BoxProperties caseProperties , BCaseConstraintSet constraintSet , IBoxCaseAnalysisSolver solver) { BoxCaseAnalysis analysis = new BoxCaseAnalysis(boxProperties, caseProperties, constraintSet); analysis.Name = name; analysis.Description = description; // insert in list _boxCaseAnalyses.Add(analysis); // compute analysis if (null != solver) { solver.ProcessAnalysis(analysis); if (analysis.Solutions.Count < 1) { // remove analysis from list if it has no valid solution _boxCaseAnalyses.Remove(analysis); return null; } } // notify listeners NotifyOnNewBoxCaseAnalysis(analysis); Modify(); return analysis; }
public BoxCaseAnalysis CreateNewBoxCaseAnalysis( string name, string description , BProperties boxProperties, BoxProperties caseProperties , BCaseConstraintSet constraintSet , List<BoxCaseSolution> solutions) { BoxCaseAnalysis analysis = new BoxCaseAnalysis(boxProperties, caseProperties, constraintSet); analysis.Name = name; analysis.Description = description; // insert in list _boxCaseAnalyses.Add(analysis); // set solutions analysis.Solutions = solutions; // notify listeners NotifyOnNewBoxCaseAnalysis(analysis); // set solution selected if it is unique if (solutions.Count == 1) analysis.SelectSolutionByIndex(0); return analysis; }
public void SaveBoxCaseConstraintSet(BCaseConstraintSet constraintSet, XmlElement xmlAnalysisElt, XmlDocument xmlDoc) { // ConstraintSet XmlElement constraintSetElement = xmlDoc.CreateElement("ConstraintSetCase"); xmlAnalysisElt.AppendChild(constraintSetElement); BoxCaseConstraintSet boxCaseContraintSet = constraintSet as BoxCaseConstraintSet; if (null != boxCaseContraintSet) { // allowed box positions XmlAttribute allowedAxisAttribute = xmlDoc.CreateAttribute("AllowedBoxPositions"); constraintSetElement.Attributes.Append(allowedAxisAttribute); allowedAxisAttribute.Value = boxCaseContraintSet.AllowOrthoAxisString; } // stop criterions // 1. maximum number of boxes if (constraintSet.UseMaximumNumberOfBoxes) { XmlAttribute maximumNumberOfBoxes = xmlDoc.CreateAttribute("ManimumNumberOfBoxes"); maximumNumberOfBoxes.Value = string.Format("{0}", constraintSet.MaximumNumberOfBoxes); constraintSetElement.Attributes.Append(maximumNumberOfBoxes); } // 2. maximum case weight if (constraintSet.UseMaximumCaseWeight) { XmlAttribute maximumPalletWeight = xmlDoc.CreateAttribute("MaximumCaseWeight"); maximumPalletWeight.Value = string.Format( System.Globalization.CultureInfo.InvariantCulture, "{0}", constraintSet.MaximumCaseWeight); constraintSetElement.Attributes.Append(maximumPalletWeight); } xmlAnalysisElt.AppendChild(constraintSetElement); }
private void AppendBoxCaseConstraintSet(BCaseConstraintSet bCaseConstraintSet, XmlElement elemDocument, XmlDocument xmlDoc) { string ns = xmlDoc.DocumentElement.NamespaceURI; // caseConstraintSet element XmlElement elemCaseConstraintSet = null; if (bCaseConstraintSet is BoxCaseConstraintSet) { elemCaseConstraintSet = CreateElement("boxCaseConstraintSet", null, elemDocument, xmlDoc, ns); // down cast BoxCaseConstraintSet boxCaseConstraintSet = bCaseConstraintSet as BoxCaseConstraintSet; // allowedOrthoAxis CreateElement("allowedOrthoAxis", boxCaseConstraintSet.AllowOrthoAxisString, elemCaseConstraintSet, xmlDoc, ns); } else if (bCaseConstraintSet is BundleCaseConstraintSet) { elemCaseConstraintSet = CreateElement("bundleCaseConstraintSet", null, elemDocument, xmlDoc, ns); } // maximumCaseWeightGroup if (bCaseConstraintSet.UseMaximumCaseWeight) { XmlElement maximumCaseWeightGroup = CreateElement("maximumCaseWeightGroup", null, elemCaseConstraintSet, xmlDoc, ns); AppendElementValue(xmlDoc, maximumCaseWeightGroup, "maximumCaseWeight", UnitsManager.UnitType.UT_MASS, bCaseConstraintSet.MaximumCaseWeight); } // minimumBoxPerCaseGroup if (bCaseConstraintSet.UseMaximumNumberOfBoxes) { XmlElement maximumBoxPerCaseGroup = CreateElement("MaximumNumberOfBoxesGroup", null, elemCaseConstraintSet, xmlDoc, ns); CreateElement("maximumBoxPerCase", bCaseConstraintSet.MaximumNumberOfBoxes, maximumBoxPerCaseGroup, xmlDoc, ns); } }