/// <summary>
        /// Creates a clone of this solution
        /// </summary>
        /// <returns>the cloned solution</returns>
        public override ISolution doClone()
        {
            var result = new ProductionSchedule();

            result.proposedSchedule = new List <List <Order> >();
            proposedSchedule.ForEach(ordering =>
            {
                var orderList = new List <Order>();
                ordering.ForEach(order =>
                {
                    orderList.Add(order);
                });
                result.proposedSchedule.Add(orderList);
            });
            result.objectiveEvaluation = new List <EvaluationResult>();
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// creates a new solution by assigning orders randomly
        /// </summary>
        /// <returns>the solutions generated by the agent</returns>
        protected override IEnumerable <ISolution> createNewSolutions()
        {
            // randomly pick an order and assign it randomly to a machine
            ProductionSchedule ps         = new ProductionSchedule();
            var millResources             = (MillProductionResources)ps.getResources();
            var randomListNumberGenerator = new SecureRandom();
            var proposedOrderSchedule     = ps.getProposedOrder();
            var orderBook       = millResources.orderBook.orders;
            int totalNoOfOrders = orderBook.Count;

            for (int i = 0; i < totalNoOfOrders; i++)
            {
                int randomListNumber           = randomListNumberGenerator.Next(millResources.milConfig.machines);
                var randomOrderNumberGenerator = new SecureRandom();
                int randomdomOrder             = randomOrderNumberGenerator.Next(orderBook.Count);
                proposedOrderSchedule[randomListNumber].Add(orderBook[randomdomOrder]);
                orderBook.RemoveAt(randomdomOrder);
            }
            var result = new List <ISolution>();

            ps.setProposedList(proposedOrderSchedule);
            result.Add(ps);
            return(result);
        }