Beispiel #1
0
 /// <summary>
 /// Resets the relaxation back to the way it was originally defined.
 /// </summary>
 public void Reset()
 {
     NumberAllowable = initialNumberAllowable;
     fulfilledItems  = null;
     for (int i = 0; i < InitialAllowableRelaxes.GetLength(0); i++)
     {
         items[i].NumberAllowed = InitialAllowableRelaxes[i];
     }
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Relaxation"/> class.
 /// </summary>
 /// <param name="prescribedItems">The prescribed items.</param>
 /// <param name="NumberAllowable">The number allowable.</param>
 public Relaxation(List <RelaxItem> prescribedItems, int NumberAllowable = 0)
 {
     items = prescribedItems;
     InitialAllowableRelaxes = prescribedItems.Select(r => r.NumberAllowed).ToArray();
     if (NumberAllowable >= 0)
     {
         this.NumberAllowable = NumberAllowable;
     }
     else
     {
         this.NumberAllowable = initialNumberAllowable = InitialAllowableRelaxes.Sum();
     }
 }