Пример #1
0
 public void SwitchEveryRoomInSimple()
 {
     m = ModelConfigurations.InitSimpleModel();
     for (int i = 0; i < m.rooms.Count; i++)
     {
         var mModelRoom = m.rooms[i];
         for (int j = i + 1; j < m.rooms.Count; j++)
         {
             var modelRoom = m.rooms[j];
             m.SwitchRooms(ref mModelRoom, ref modelRoom);
             m.SwitchRooms(ref modelRoom, ref mModelRoom);
         }
     }
 }
Пример #2
0
        private void CalculateSwitchCosts()
        {
            int rooms = Model.rooms.Count;

            for (int index = 0; index < rooms; index++)
            {
                for (int secondindex = index + 1; secondindex < rooms; secondindex++)
                {
                    _Room  r1        = Model.rooms.ElementAt(index);
                    _Room  r2        = Model.rooms.ElementAt(secondindex);
                    _Model tempModel = Model.DeepCopy(r1, r2, out _Room r1target, out _Room r2target);
                    tempModel.SwitchRooms(ref r1target, ref r2target);
                    if (tempModel.IsInInvalidState)
                    {
                        continue;
                    }

                    Cost cost = CostCalculationService.CalculateCostNew(tempModel);
                    lock (locker)
                    {
                        Actions.Add(new Switch(ref r1, ref r2, cost));
                    }
                }
            }
        }
Пример #3
0
 public override void Step(_Model m)
 {
     m.SwitchRooms(ref r1, ref r2);
 }