/// <summary>
        /// Creates new AdvancesSolverSettings.
        /// </summary>
        /// <param name="baseSettings">Base settings to copy.</param>
        /// <param name="totalPoints">Maximum for points spent in the result tree. (>= 0)</param>
        /// <param name="initialAttributes">Starting attributes of stats that calculations are based on.</param>
        /// <param name="attributeConstraints">The attribute constraints the solver should try to fullfill.</param>
        /// <param name="pseudoAttributeConstraints">The pseudo attribute constraints the solver should try to fullfill.</param>
        /// <param name="weaponClass">WeaponClass used for pseudo attribute calculation.</param>
        /// <param name="tags">Tags used for pseudo attribute calculation.</param>
        /// <param name="offHand">OffHand used for pseudo attribute calculation.</param>
        public AdvancedSolverSettings(SolverSettings baseSettings,
            int totalPoints,
            Dictionary<string, float> initialAttributes,
            Dictionary<string, Tuple<float, double>> attributeConstraints,
            Dictionary<PseudoAttribute, Tuple<float, double>> pseudoAttributeConstraints,
            WeaponClass weaponClass, Tags tags, OffHand offHand)
            : base(baseSettings)
        {
            if (totalPoints < 0) throw new ArgumentOutOfRangeException(nameof(totalPoints), totalPoints, "must be >= 0");

            TotalPoints = totalPoints;
            WeaponClass = weaponClass;
            Tags = tags;
            OffHand = offHand;
            AttributeConstraints = attributeConstraints ?? new Dictionary<string, Tuple<float, double>>();
            PseudoAttributeConstraints = pseudoAttributeConstraints ?? new Dictionary<PseudoAttribute, Tuple<float, double>>();
            InitialAttributes = initialAttributes ?? new Dictionary<string, float>();

            if (AttributeConstraints.Values.Any(tuple => tuple.Item2 < 0 || tuple.Item2 > 1))
                throw new ArgumentException("Weights need to be between 0 and 1", "attributeConstraints");
            if (AttributeConstraints.Values.Any(t => t.Item1 <= 0))
                throw new ArgumentException("Target values need to be greater zero", "attributeConstraints");
            if (PseudoAttributeConstraints.Values.Any(tuple => tuple.Item2 < 0 || tuple.Item2 > 1))
                throw new ArgumentException("Weights need to be between 0 and 1", "pseudoAttributeConstraints");
            if (PseudoAttributeConstraints.Values.Any(t => t.Item1 <= 0))
                throw new ArgumentException("Target values need to be greater zero", "pseudoAttributeConstraints");
        }
 /// <summary>
 /// Creates new AdvancesSolverSettings.
 /// </summary>
 /// <param name="baseSettings">Base settings to copy.</param>
 /// <param name="initialAttributes">Starting attributes of stats that calculations are based on.</param>
 /// <param name="attributeConstraints">The attribute constraints the solver should try to fullfill.</param>
 /// <param name="pseudoAttributeConstraints">The pseudo attribute constraints the solver should try to fullfill.</param>
 /// <param name="weaponClass">WeaponClass used for pseudo attribute calculation.</param>
 /// <param name="tags">Tags used for pseudo attribute calculation.</param>
 /// <param name="offHand">OffHand used for pseudo attribute calculation.</param>
 public AdvancedSolverSettings(SolverSettings baseSettings,
     Dictionary<string, float> initialAttributes,
     Dictionary<string, Tuple<float, double>> attributeConstraints,
     Dictionary<PseudoAttribute, Tuple<float, double>> pseudoAttributeConstraints,
     WeaponClass weaponClass, Tags tags, OffHand offHand)
     : this(baseSettings.Level, baseSettings.TotalPoints, baseSettings.Checked, baseSettings.Crossed,
         baseSettings.SubsetTree, baseSettings.InitialTree, initialAttributes,
         attributeConstraints, pseudoAttributeConstraints, weaponClass, tags, offHand)
 { }
예제 #3
0
 protected override async Task<ISolver> CreateSolverAsync(SolverSettings settings)
 {
     if (!settings.Checked.Any())
     {
         // todo "this" as context is not registered when running without window
         await DialogCoordinator.ShowInfoAsync(DialogContext,
                 L10n.Message("Please tag non-skilled nodes by right-clicking them."));
         return null;
     }
     return new SteinerSolver(Tree, settings);
 }
예제 #4
0
 protected override Task<ISolver> CreateSolverAsync(SolverSettings settings)
 {
     throw new NotImplementedException();
 }
 public override ISolver CreateSolver(SolverSettings settings)
 {
     var attributeConstraints = AttributeConstraints.ToDictionary(
         constraint => constraint.Data,
         constraint => new Tuple<float, double>(constraint.TargetValue, constraint.Weight / 100.0));
     var pseudoConstraints = PseudoAttributeConstraints.ToDictionary(
         constraint => constraint.Data,
         constraint => new Tuple<float, double>(constraint.TargetValue, constraint.Weight / 100.0));
     return new AdvancedSolver(Tree, new AdvancedSolverSettings(settings, CreateInitialAttributes(), attributeConstraints,
         pseudoConstraints, WeaponClass, Tags, OffHand));
 }
 public override ISolver CreateSolver(SolverSettings settings)
 {
     return new SteinerSolver(Tree, settings);
 }
 /// <summary>
 /// Creates a solver that uses the settings defined by the user in this ViewModel.
 /// </summary>
 /// <param name="settings">(not null) Base settings specified in SettingsViewModel.</param>
 /// <returns></returns>
 public abstract ISolver CreateSolver(SolverSettings settings);
예제 #8
0
 /// <param name="settings">The settings to create a (shallow) copy of.</param>
 protected SolverSettings(SolverSettings settings)
     : this(settings.Checked, settings.Crossed, settings.Iterations)
 {
 }
 public override ISolver CreateSolver(SolverSettings settings)
 {
     throw new System.NotImplementedException();
 }
예제 #10
0
 protected override Task<ISolver> CreateSolverAsync(SolverSettings settings)
 {
     var attributeConstraints = AttributeConstraints.ToDictionary(
         constraint => constraint.Data,
         constraint => new Tuple<float, double>(constraint.TargetValue, constraint.Weight / 100.0));
     var pseudoConstraints = PseudoAttributeConstraints.ToDictionary(
         constraint => constraint.Data,
         constraint => new Tuple<float, double>(constraint.TargetValue, constraint.Weight / 100.0));
     var solver = new AdvancedSolver(Tree, new AdvancedSolverSettings(settings, TotalPoints,
         CreateInitialAttributes(), attributeConstraints,
         pseudoConstraints, WeaponClass.Value, Tags.Value, OffHand.Value));
     return Task.FromResult<ISolver>(solver);
 }