public Vector3D InnerOffset(CaseOptimConstraintSet constraintSet)
 {
     return(new Vector3D(
                0.5 * constraintSet.WallThickness * constraintSet.NoWalls[0]
                , 0.5 * constraintSet.WallThickness * constraintSet.NoWalls[1]
                , 0.5 * constraintSet.WallThickness * constraintSet.NoWalls[2]));
 }
 public CaseDefinitionViewer(CaseDefinition caseDefinition, BoxProperties boxProperties, CaseOptimConstraintSet caseConstraintSet)
 {
     _caseDefinition = caseDefinition;
     _boxProperties = boxProperties;
     _caseOptimConstraintSet = caseConstraintSet;
     _globalOrientation = new Orientation(HalfAxis.HAxis.AXIS_X_P, HalfAxis.HAxis.AXIS_Y_P);
 }
 /// <summary>
 ///  Outer dimensions
 /// </summary>
 /// <param name="optimizer">Parent optimizer class</param>
 /// <returns>Outer dimensions stored in Vector3D</returns>
 public Vector3D OuterDimensions(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     return(new Vector3D(
                _arrangement._iLength * boxProperties.Dim(Dim0) + constraintSet.WallThickness * constraintSet.NoWalls[0]
                , _arrangement._iWidth * boxProperties.Dim(Dim1) + constraintSet.WallThickness * constraintSet.NoWalls[1]
                , _arrangement._iHeight * boxProperties.Dim(Dim2) + constraintSet.WallThickness * constraintSet.NoWalls[2]
                ));
 }
        /// <summary>
        /// Returns true
        /// </summary>
        /// <param name="optimizer"></param>
        /// <returns></returns>
        public bool IsValid(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
        {
            Vector3D outerDim = OuterDimensions(boxProperties, constraintSet);

            return(outerDim.X <= constraintSet.CaseLimitMax.X && outerDim.Y <= constraintSet.CaseLimitMax.Y && outerDim.Z <= constraintSet.CaseLimitMax.Z &&
                   outerDim.X >= constraintSet.CaseLimitMin.X && outerDim.Y >= constraintSet.CaseLimitMin.Y && outerDim.Z >= constraintSet.CaseLimitMin.Z &&
                   ((_dim0 == 0 && _dim1 == 1) || !constraintSet.ForceVerticalcaseOrientation));
        }
Example #5
0
 public CaseOptimAnalysis(
     BProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletConstraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
     : base(boxProperties.ParentDocument)
 {
 }
 public CaseOptimAnalysis(
     BProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletConstraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
     : base(boxProperties.ParentDocument)
 {
 }
        public double Area(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
        {
            Vector3D outerDim = OuterDimensions(boxProperties, constraintSet);

            return((constraintSet.NoWalls[0] * outerDim.Y * outerDim.Z
                    + constraintSet.NoWalls[1] * outerDim.X * outerDim.Z
                    + constraintSet.NoWalls[2] * outerDim.X * outerDim.Y) * UnitsManager.FactorSquareLengthToArea);
        }
Example #8
0
 public CaseOptimizer(
     BoxProperties boxProperties
     , PalletProperties palletProperties
     , PalletConstraintSet palletContraintSet
     , CaseOptimConstraintSet caseOptimConstraintSet)
 {
     _boxProperties = boxProperties;
     _palletProperties = palletProperties;
     _palletConstraintSet = palletContraintSet;
     _caseOptimConstraintSet = caseOptimConstraintSet;
 }
Example #9
0
        static void Main(string[] args)
        {
            // define box properties
            BoxProperties boxProperties = new BoxProperties(null, 120.0, 100.0, 70.0);
            // define pallet properties
            PalletProperties palletProperties = new PalletProperties(null, "Block", 1200, 1000, 150);
            // define pallet constraintSet
            CasePalletConstraintSet constraintSet = new CasePalletConstraintSet();
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_N, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_X_P, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_N, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Y_P, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_N, true);
            constraintSet.SetAllowedOrthoAxis(HalfAxis.HAxis.AXIS_Z_P, true);

            constraintSet.SetAllowedPattern("Column");
            constraintSet.SetAllowedPattern("Diagonale");
            constraintSet.SetAllowedPattern("Interlocked");
            constraintSet.SetAllowedPattern("Trilock");
            constraintSet.SetAllowedPattern("Spirale");

            constraintSet.AllowAlignedLayers = true;
            constraintSet.AllowAlternateLayers = true;

            constraintSet.MaximumHeight = 2000;
            constraintSet.MaximumNumberOfItems = 2000;
            constraintSet.UseMaximumHeight = true;
            constraintSet.UseMaximumPalletWeight = false;
            constraintSet.UseMaximumWeightOnBox = false;
            Console.WriteLine("=== Constraint set ===");
            Console.WriteLine(constraintSet.ToString());

            // define case optim constraintSet
            CaseOptimConstraintSet caseOptimConstraintSet = new CaseOptimConstraintSet(
                new int[3]{2, 2, 4}
                , 4.0, 0.01
                , new Vector3D(30.0, 30.0, 70.0)
                , new Vector3D(500.0, 500.0, 500.0)
                , false
                );

            CaseOptimizer caseOptimizer = new CaseOptimizer(boxProperties, palletProperties, constraintSet, caseOptimConstraintSet);

            // get all valid case definitions
            foreach (CaseDefinition caseDefinition in caseOptimizer.CaseDefinitions(48))
                Console.WriteLine(caseDefinition.ToString() + caseDefinition.OuterDimensions(boxProperties, caseOptimConstraintSet));
            // build list of solutions
            List<CaseOptimSolution> caseOptimSolutions = caseOptimizer.CaseOptimSolutions(48);
            foreach (CaseOptimSolution caseOptimSolution in caseOptimSolutions)
                Console.WriteLine(caseOptimSolution.ToString());
        }
        /// <summary>
        /// Instantiate a new case from a box, a case definition and a case optimization constraintset
        /// </summary>
        /// <param name="document">Parent document</param>
        /// <param name="bProperties">Box properties</param>
        /// <param name="constraintSet">Case optimization constraint set</param>
        public CaseOfBoxesProperties(Document document
                                     , BoxProperties boxProperties
                                     , CaseDefinition caseDefinition
                                     , CaseOptimConstraintSet constraintSet)
            : base(document)
        {
            _boxProperties = boxProperties;
            _boxProperties.AddDependancy(this);
            _caseDefinition = caseDefinition;
            _constraintSet  = constraintSet;

            SetWeight(_caseDefinition.CaseEmptyWeight(_boxProperties, _constraintSet));

            OnAttributeModified(boxProperties);
        }
        /// <summary>
        /// Instantiate a new case from a box, a case definition and a case optimization constraintset
        /// </summary>
        /// <param name="document">Parent document</param>
        /// <param name="bProperties">Box properties</param>
        /// <param name="constraintSet">Case optimization constraint set</param>
        public CaseOfBoxesProperties(Document document
            , BoxProperties boxProperties
            , CaseDefinition caseDefinition
            , CaseOptimConstraintSet constraintSet)
            : base(document)
        {
            _boxProperties = boxProperties;
            _boxProperties.AddDependancy(this);
            _caseDefinition = caseDefinition;
            _constraintSet = constraintSet;

            base.Weight = _caseDefinition.CaseEmptyWeight(_boxProperties, _constraintSet);

            OnAttributeModified(boxProperties);
        }
Example #12
0
 public double Area(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     Vector3D outerDim = OuterDimensions(boxProperties, constraintSet);
     return (constraintSet.NoWalls[0] * outerDim.Y * outerDim.Z
         + constraintSet.NoWalls[1] * outerDim.X * outerDim.Z
         + constraintSet.NoWalls[2] * outerDim.X * outerDim.Y) * UnitsManager.FactorSquareLengthToArea;
 }
        public double OuterVolume(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
        {
            Vector3D outerDim = OuterDimensions(boxProperties, constraintSet);

            return(outerDim.X * outerDim.Y * outerDim.Z);
        }
Example #14
0
 private void SaveCaseOptimConstraintSet(CaseOptimConstraintSet caseOptimConstraintSet, XmlElement xmlBoxProperties, XmlDocument xmlDoc)
 {
     XmlElement xmlCaseOptimConstraintSet = xmlDoc.CreateElement("OptimConstraintSet");
     xmlBoxProperties.AppendChild(xmlCaseOptimConstraintSet);
     // wall thickness
     XmlAttribute xmlWallThickness = xmlDoc.CreateAttribute("WallThickness");
     xmlWallThickness.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", caseOptimConstraintSet.WallThickness);
     xmlCaseOptimConstraintSet.Attributes.Append(xmlWallThickness);
     // wall surface mass
     XmlAttribute xmlWallSurfaceMass = xmlDoc.CreateAttribute("WallSurfaceMass");
     xmlWallSurfaceMass.Value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}", caseOptimConstraintSet.WallSurfaceMass);
     xmlCaseOptimConstraintSet.Attributes.Append(xmlWallSurfaceMass);
     // no walls
     XmlAttribute xmlNumberOfWalls = xmlDoc.CreateAttribute("NumberOfWalls");
     xmlNumberOfWalls.Value = string.Format("{0} {1} {2}"
         , caseOptimConstraintSet.NoWalls[0]
         , caseOptimConstraintSet.NoWalls[1]
         , caseOptimConstraintSet.NoWalls[2]);
     xmlCaseOptimConstraintSet.Attributes.Append(xmlNumberOfWalls);
 }
Example #15
0
 public CaseOfBoxesProperties CreateNewCaseOfBoxes(
     string name, string description
     , BoxProperties boxProperties
     , CaseDefinition caseDefinition
     , CaseOptimConstraintSet constraintSet)
 {
     CaseOfBoxesProperties caseProperties = new CaseOfBoxesProperties(this, boxProperties, caseDefinition, constraintSet);
     caseProperties.Name = name;
     caseProperties.Description = description;
     // insert in list
     _typeList.Add(caseProperties);
     // notify listeners
     NotifyOnNewTypeCreated(caseProperties);
     Modify();
     return caseProperties;
 }
Example #16
0
 public double OuterVolume(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     Vector3D outerDim = OuterDimensions(boxProperties, constraintSet);
     return outerDim.X * outerDim.Y * outerDim.Z;
 }
Example #17
0
 private void LoadOptimConstraintSet(XmlElement eltConstraintSet, out CaseOptimConstraintSet constraintSet)
 {
     string sNoWalls = eltConstraintSet.Attributes["NumberOfWalls"].Value;
     int[] iNoWalls = ParseInt3(sNoWalls);
     double wallThickness = UnitsManager.ConvertLengthFrom(
         Convert.ToDouble(eltConstraintSet.Attributes["WallThickness"].Value, System.Globalization.CultureInfo.InvariantCulture)
         , _unitSystem);
     double wallSurfaceMass = UnitsManager.ConvertSurfaceMassFrom(
         Convert.ToDouble(eltConstraintSet.Attributes["WallSurfaceMass"].Value, System.Globalization.CultureInfo.InvariantCulture)
         , _unitSystem);
     constraintSet = new CaseOptimConstraintSet(iNoWalls, wallThickness, wallSurfaceMass, Vector3D.Zero, Vector3D.Zero, false); 
 }
 public double CaseEmptyWeight(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     return(constraintSet.WallSurfaceMass * Area(boxProperties, constraintSet));
 }
Example #19
0
 public double TotalWeight(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     return InnerWeight(boxProperties) + EmptyWeight(boxProperties, constraintSet);                    
 }
Example #20
0
 /// <summary>
 ///  Outer dimensions
 /// </summary>
 /// <param name="optimizer">Parent optimizer class</param>
 /// <returns>Outer dimensions stored in Vector3D</returns>
 public Vector3D OuterDimensions(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     return new Vector3D(
         _arrangement._iLength * boxProperties.Dim(Dim0) + constraintSet.WallThickness * constraintSet.NoWalls[0]
         , _arrangement._iWidth * boxProperties.Dim(Dim1) + constraintSet.WallThickness * constraintSet.NoWalls[1]
         , _arrangement._iHeight * boxProperties.Dim(Dim2) + constraintSet.WallThickness * constraintSet.NoWalls[2]
         );
 }
Example #21
0
 public Vector3D InnerOffset(CaseOptimConstraintSet constraintSet)
 {
     return new Vector3D(
         0.5 * constraintSet.WallThickness * constraintSet.NoWalls[0]
         , 0.5 * constraintSet.WallThickness * constraintSet.NoWalls[1]
         , 0.5 * constraintSet.WallThickness * constraintSet.NoWalls[2]);
 }
 public double TotalWeight(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     return(InnerWeight(boxProperties) + EmptyWeight(boxProperties, constraintSet));
 }
Example #23
0
 public double CaseEmptyWeight(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     return constraintSet.WallSurfaceMass * Area(boxProperties, constraintSet);
 }
Example #24
0
 /// <summary>
 /// Returns true 
 /// </summary>
 /// <param name="optimizer"></param>
 /// <returns></returns>
 public bool IsValid(BoxProperties boxProperties, CaseOptimConstraintSet constraintSet)
 {
     Vector3D outerDim = OuterDimensions(boxProperties, constraintSet);
     return outerDim.X <= constraintSet.CaseLimitMax.X && outerDim.Y <= constraintSet.CaseLimitMax.Y && outerDim.Z <= constraintSet.CaseLimitMax.Z
         && outerDim.X >= constraintSet.CaseLimitMin.X && outerDim.Y >= constraintSet.CaseLimitMin.Y && outerDim.Z >= constraintSet.CaseLimitMin.Z
         && ((_dim0 == 0 && _dim1 == 1) || !constraintSet.ForceVerticalcaseOrientation);
 }