/// <summary>
 /// Only support 1 level of undo
 /// </summary>
 internal void UndoPropagate()
 {
     if (IsActive)
     {
         Propagate(previousActiveOptItem);
         // Allow only one level of undo and prevent a cycle of undo and redo.
         previousActiveOptItem = activeOptItem;
     }
 }
 internal void Propagate(OptimizationItem selectedOptItem)
 {
     if (IsActive && (selectedOptItem != null))
     {
         if (OptimizationItems.Contains(selectedOptItem))
         {
             previousActiveOptItem = activeOptItem;
             activeOptItem         = selectedOptItem;
             OptimizationItems.ForEach(item => item.IsActive = false);
             activeOptItem.IsActive = true;
         }
         else
         {
             // This exception may not be worth throwing since nothing will break if ignored.
             throw new System.Exception("Trying to apply a Mutex relation but the selected item is not part of the Mutex.");
         }
     }
 }
Beispiel #3
0
 internal void PerturbItemRandomly(OptimizationItem optItem)
 {
     optItem.PropagateMutexes();
     optItem.SetIndependentVariableRandomly();
     PerturbedItem = optItem;
 }