public CasePalletAnalysis(
     BProperties boxProperties,
     PalletProperties palletProperties,
     InterlayerProperties interlayerProperties,
     InterlayerProperties interlayerPropertiesAntiSlip,
     PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm,
     PalletConstraintSet constraintSet)
     : base(boxProperties.ParentDocument)
 {
     // sanity checks
     if (palletProperties.ParentDocument != ParentDocument
         || (interlayerProperties != null && interlayerProperties.ParentDocument != ParentDocument))
         throw new Exception("box, pallet, interlayer do not belong to the same document");
     if ((boxProperties is BoxProperties && constraintSet is BundlePalletConstraintSet)
         || (boxProperties is BundleProperties && constraintSet is CasePalletConstraintSet))
         throw new Exception("Invalid analysis: either BoxProperties with ConstraintSetBundle or BundleProperties with ConstraintSetBox");
     // has interlayer ?
     constraintSet.HasInterlayer = null != interlayerProperties;
     // setting members
     this.BProperties = boxProperties;
     this.PalletProperties = palletProperties;
     this.InterlayerProperties = interlayerProperties;
     this.InterlayerPropertiesAntiSlip = interlayerPropertiesAntiSlip;
     this.PalletCornerProperties = palletCorners;
     this.PalletCapProperties = palletCap;
     this.PalletFilmProperties = palletFilm;
     this.ConstraintSet = constraintSet;
 }
        public PalletSolutionDesc(PalletSolutionDatabase db, CasePalletSolution sol, string friendlyName)
        {
            BoxProperties       boxProperties    = sol.Analysis.BProperties as BoxProperties;
            PalletProperties    palletProperties = sol.Analysis.PalletProperties;
            PalletConstraintSet constraintSet    = sol.Analysis.ConstraintSet;

            _guid         = Guid.NewGuid();
            _friendlyName = friendlyName;
            _key          = new PalletSolutionKey(
                palletProperties.Length, palletProperties.Width, constraintSet.MaximumHeight
                , constraintSet.OverhangX, constraintSet.OverhangY);

            _caseDimensions[0] = boxProperties.Length;
            _caseDimensions[1] = boxProperties.Width;
            _caseDimensions[2] = boxProperties.Height;

            _insideCaseDimensions[0] = boxProperties.InsideLength;
            _insideCaseDimensions[1] = boxProperties.InsideWidth;
            _insideCaseDimensions[2] = boxProperties.InsideHeight;

            _caseWeight   = boxProperties.Weight;
            _palletWeight = palletProperties.Weight;

            _caseOrientation = sol.CaseOrientation;
            _caseCount       = sol.CaseCount;

            _parentDB = db;
        }
Exemplo n.º 3
0
 public CasePalletAnalysis(
     BProperties boxProperties,
     PalletProperties palletProperties,
     InterlayerProperties interlayerProperties,
     InterlayerProperties interlayerPropertiesAntiSlip,
     PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm,
     PalletConstraintSet constraintSet)
     : base(boxProperties.ParentDocument)
 {
     // sanity checks
     if (palletProperties.ParentDocument != ParentDocument ||
         (interlayerProperties != null && interlayerProperties.ParentDocument != ParentDocument))
     {
         throw new Exception("box, pallet, interlayer do not belong to the same document");
     }
     if ((boxProperties is BoxProperties && constraintSet is BundlePalletConstraintSet) ||
         (boxProperties is BundleProperties && constraintSet is CasePalletConstraintSet))
     {
         throw new Exception("Invalid analysis: either BoxProperties with ConstraintSetBundle or BundleProperties with ConstraintSetBox");
     }
     // has interlayer ?
     constraintSet.HasInterlayer = null != interlayerProperties;
     // setting members
     this.BProperties                  = boxProperties;
     this.PalletProperties             = palletProperties;
     this.InterlayerProperties         = interlayerProperties;
     this.InterlayerPropertiesAntiSlip = interlayerPropertiesAntiSlip;
     this.PalletCornerProperties       = palletCorners;
     this.PalletCapProperties          = palletCap;
     this.PalletFilmProperties         = palletFilm;
     this.ConstraintSet                = constraintSet;
 }
 public CaseOptimAnalysis(
     BProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletConstraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
     : base(boxProperties.ParentDocument)
 {
 }
Exemplo n.º 5
0
 public CaseOptimAnalysis(
     BProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletConstraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
     : base(boxProperties.ParentDocument)
 {
 }
Exemplo n.º 6
0
 public CaseOptimizer(
     BoxProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletContraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
 {
     _boxProperties = boxProperties;
     _palletProperties = palletProperties;
     _palletConstraintSet = palletContraintSet;
     _caseOptimConstraintSet = caseOptimConstraintSet;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates a new analysis without generating solutions
 /// </summary>
 /// <param name="name">Name of analysis</param>
 /// <param name="description">Description</param>
 /// <param name="box">Case</param>
 /// <param name="pallet">Pallet</param>
 /// <param name="interlayer">Interlayer</param>
 /// <param name="constraintSet">PalletConstraintSet</param>
 /// <param name="solutions">Solutions</param>
 /// <returns>CasePalletAnalysis generated using input parameters</returns>
 public CasePalletAnalysis CreateNewCasePalletAnalysis(
     string name, string description
     , BProperties box, PalletProperties pallet
     , InterlayerProperties interlayer, InterlayerProperties interlayerAntiSlip
     , PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm
     , PalletConstraintSet constraintSet
     , List<CasePalletSolution> solutions)
 {
     CasePalletAnalysis analysis = new CasePalletAnalysis(
         box, pallet,
         interlayer, interlayerAntiSlip,
         palletCorners, palletCap, palletFilm,
         constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _casePalletAnalyses.Add(analysis);
     // set solutions
     analysis.Solutions = solutions;
     // notify listeners
     NotifyOnNewCasePalletAnalysisCreated(analysis);
     // set solution selected if it is unique
     if (solutions.Count == 1)
         analysis.SelectSolutionByIndex(0);
     return analysis;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Creates a new analysis in this document + compute solutions
 /// </summary>
 /// <param name="name"></param>
 /// <param name="description"></param>
 /// <param name="box"></param>
 /// <param name="pallet"></param>
 /// <param name="interlayer"></param>
 /// <param name="constraintSet"></param>
 /// <param name="solver">Node : analysis creation requires a solver</param>
 /// <returns>An analysis</returns>
 public CasePalletAnalysis CreateNewCasePalletAnalysis(
     string name, string description
     , BProperties box, PalletProperties pallet
     , InterlayerProperties interlayer, InterlayerProperties interlayerAntiSlip
     , PalletCornerProperties palletCorners, PalletCapProperties palletCap, PalletFilmProperties palletFilm
     , PalletConstraintSet constraintSet
     , ICasePalletAnalysisSolver solver)
 {
     CasePalletAnalysis analysis = new CasePalletAnalysis(
         box, pallet,
         interlayer, interlayerAntiSlip,
         palletCorners, palletCap, palletFilm,
         constraintSet);
     analysis.Name = name;
     analysis.Description = description;
     // insert in list
     _casePalletAnalyses.Add(analysis);
     // compute analysis
     solver.ProcessAnalysis(analysis);
     if (analysis.Solutions.Count < 1)
     {	// remove analysis from list if it has no valid solution
         _casePalletAnalyses.Remove(analysis);
         return null;
     }
     // notify listeners
     NotifyOnNewCasePalletAnalysisCreated(analysis);
     Modify();
     return analysis;
 }
 public List<CasePalletSolution> Process(
     BoxProperties boxProperties, PalletProperties palletProperties,
     InterlayerProperties interlayerProperties, InterlayerProperties interlayerPropertiesAntiSlip,
     PalletConstraintSet constraintSet)
 {
     _bProperties = boxProperties;
     _palletProperties = palletProperties;
     _interlayerProperties = interlayerProperties;
     _interlayerPropertiesAntiSlip = interlayerPropertiesAntiSlip;
     _constraintSet = constraintSet;
     // check constraint set validity
     if (!_constraintSet.IsValid)
         throw new EngineException("Constraint set is invalid!");
     // generate solutions
     return GenerateSolutions();
 }
Exemplo n.º 10
0
        private Layer GenerateBestLayer(
            BProperties bProperties, PalletProperties palletProperties, PalletCornerProperties cornerProperties,
            PalletConstraintSet constraintSet, HalfAxis.HAxis hAxis)
        {
            Layer bestLayer = null;
            // loop through all patterns
            foreach (LayerPattern pattern in _patterns)
            {
                // is pattern allowed
                if (!_constraintSet.AllowPattern(pattern.Name)) continue;

                // direction 1
                Layer layer1 = new Layer(bProperties, palletProperties, cornerProperties,
                    constraintSet, hAxis);
                double actualLength = 0.0, actualWidth = 0.0;
                pattern.GetLayerDimensionsChecked(layer1, out actualLength, out actualWidth);
                pattern.GenerateLayer(layer1, actualLength, actualWidth);
                // save as best pattern
                if (null == bestLayer || bestLayer.Count < layer1.Count)
                    bestLayer = layer1;
                // direction 2 (opposite)
                Layer layer2 = new Layer(bProperties, palletProperties, cornerProperties,
                    constraintSet, HalfAxis.Opposite(hAxis));
                actualLength = 0.0; actualWidth = 0.0;
                pattern.GetLayerDimensionsChecked(layer2, out actualLength, out actualWidth);
                pattern.GenerateLayer(layer2, actualLength, actualWidth);
                // save as best pattern
                if (null == bestLayer || bestLayer.Count < layer2.Count)
                    bestLayer = layer2;
            }
            return bestLayer;
        }
Exemplo n.º 11
0
 /// <summary>
 /// Process case/pallet analysis
 /// </summary>
 /// <param name="analysis">Pallet analysis to process</param>
 public void ProcessAnalysis(CasePalletAnalysis analysis)
 {
     _bProperties = analysis.BProperties;
     _palletProperties = analysis.PalletProperties;
     _interlayerProperties = analysis.InterlayerProperties;
     _interlayerPropertiesAntiSlip = analysis.InterlayerPropertiesAntiSlip;
     _cornerProperties = analysis.PalletCornerProperties;
     _capProperties = analysis.PalletCapProperties;
     _constraintSet = analysis.ConstraintSet;
     // check contraint set validity
     if (!_constraintSet.IsValid)
         throw new EngineException("Constraint set is invalid!");
     // generate solutions
     analysis.Solutions = GenerateSolutions();
 }