Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2524


Ignore:
Timestamp:
11/23/09 15:17:08 (15 years ago)
Author:
swagner
Message:

Removed plugin HeuristicLab.Constraints (#804)

Location:
trunk/sources
Files:
20 deleted
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab 3.3.sln

    r2520 r2524  
    1717    {E226881D-315F-423D-B419-A766FE0D8685} = {E226881D-315F-423D-B419-A766FE0D8685}
    1818    {C36BD924-A541-4A00-AFA8-41701378DDC5} = {C36BD924-A541-4A00-AFA8-41701378DDC5}
    19     {19C1E42A-4B48-4EFD-B697-899016F1C198} = {19C1E42A-4B48-4EFD-B697-899016F1C198}
    2019    {6A5F8C2D-B0C3-4B36-BC20-9B1A91EE6DB6} = {6A5F8C2D-B0C3-4B36-BC20-9B1A91EE6DB6}
    2120    {0E27A536-1C4A-4624-A65E-DC4F4F23E3E1} = {0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}
     
    5857EndProject
    5958Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Data-3.3", "HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj", "{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}"
    60 EndProject
    61 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Constraints-3.3", "HeuristicLab.Constraints\3.3\HeuristicLab.Constraints-3.3.csproj", "{19C1E42A-4B48-4EFD-B697-899016F1C198}"
    6259EndProject
    6360Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Operators-3.3", "HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj", "{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}"
     
    213210    {BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}.Release|x86.ActiveCfg = Release|x86
    214211    {BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}.Release|x86.Build.0 = Release|x86
    215     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    216     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Debug|Any CPU.Build.0 = Debug|Any CPU
    217     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Debug|x64.ActiveCfg = Debug|x64
    218     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Debug|x64.Build.0 = Debug|x64
    219     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Debug|x86.ActiveCfg = Debug|x86
    220     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Debug|x86.Build.0 = Debug|x86
    221     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Release|Any CPU.ActiveCfg = Release|Any CPU
    222     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Release|Any CPU.Build.0 = Release|Any CPU
    223     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Release|x64.ActiveCfg = Release|x64
    224     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Release|x64.Build.0 = Release|x64
    225     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Release|x86.ActiveCfg = Release|x86
    226     {19C1E42A-4B48-4EFD-B697-899016F1C198}.Release|x86.Build.0 = Release|x86
    227212    {23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    228213    {23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
  • trunk/sources/HeuristicLab 3.3/CopyAssemblies.cmd

    r2520 r2524  
    1414copy "%SolutionDir%\HeuristicLab.Core\3.3\%Outdir%\HeuristicLab.Core-3.3.dll" .\plugins
    1515copy "%SolutionDir%\HeuristicLab.Core.Views\3.3\%Outdir%\HeuristicLab.Core.Views-3.3.dll" .\plugins
    16 copy "%SolutionDir%\HeuristicLab.Constraints\3.3\%Outdir%\HeuristicLab.Constraints-3.3.dll" .\plugins
    1716copy "%SolutionDir%\HeuristicLab.Data\3.3\%Outdir%\HeuristicLab.Data-3.3.dll" .\plugins
    1817copy "%SolutionDir%\HeuristicLab.Evolutionary\3.3\%Outdir%\HeuristicLab.Evolutionary-3.3.dll" .\plugins
     
    2524copy "%SolutionDir%\HeuristicLab.Operators\3.3\%Outdir%\HeuristicLab.Operators-3.3.dll" .\plugins
    2625copy "%SolutionDir%\HeuristicLab.Operators.Programmable\3.3\%Outdir%\HeuristicLab.Operators.Programmable-3.3.dll" .\plugins
    27 copy "%SolutionDir%\HeuristicLab.OptimizationFrontend\3.3\%Outdir%\HeuristicLab.OptimizationFrontend-3.3.dll" .\plugins
    2826copy "%SolutionDir%\HeuristicLab.Optimizer\3.3\%Outdir%\HeuristicLab.Optimizer-3.3.dll" .\plugins
    2927copy "%SolutionDir%\HeuristicLab.Permutation\3.3\%Outdir%\HeuristicLab.Permutation-3.3.dll" .\plugins
  • trunk/sources/HeuristicLab.Core.Views/3.3/Auxiliary.cs

    r2520 r2524  
    3030  /// </summary>
    3131  public static class Auxiliary {
    32     #region Cloning
    33     /// <summary>
    34     /// Clones the given <paramref name="obj"/> (deep clone).
    35     /// </summary>
    36     /// <remarks>Checks before clone if object has not already been cloned.</remarks>
    37     /// <param name="obj">The object to clone.</param>
    38     /// <param name="clonedObjects">A dictionary of all already cloned objects. (Needed to avoid cycles.)</param>
    39     /// <returns>The cloned object.</returns>
    40     public static object Clone(IStorable obj, IDictionary<Guid, object> clonedObjects) {
    41       object clone;
    42       if (clonedObjects.TryGetValue(obj.Guid, out clone))
    43         return clone;
    44       else
    45         return obj.Clone(clonedObjects);
    46     }
    47     #endregion
    48 
    4932    #region Error Messages
    5033    /// <summary>
     
    8467    }
    8568    #endregion
    86 
    87     #region Constraint Violation Messages
    88     /// <summary>
    89     /// Shows a warning message box with an OK-Button, indicating that the given constraints were violated and so
    90     /// the operation could not be completed.
    91     /// </summary>
    92     /// <param name="violatedConstraints">The constraints that could not be fulfilled.</param>
    93     public static void ShowConstraintViolationMessageBox(ICollection<IConstraint> violatedConstraints) {
    94       string message = BuildConstraintViolationMessage(violatedConstraints);
    95       MessageBox.Show("The following constraints are violated. The operation could not be completed.\n\n" + message,
    96                       "Constraint Violation",
    97                       MessageBoxButtons.OK,
    98                       MessageBoxIcon.Warning);
    99     }
    100     /// <summary>
    101     /// Shows a question message box with a yes-no option, where to choose whether to ignore
    102     /// the given violated constraints and to complete the operation or not.
    103     /// </summary>
    104     /// <param name="violatedConstraints">The constraints that could not be fulfilled.</param>
    105     /// <returns>The result of the choice ("Yes" = 6, "No" = 7).</returns>
    106     public static DialogResult ShowIgnoreConstraintViolationMessageBox(ICollection<IConstraint> violatedConstraints) {
    107       string message = BuildConstraintViolationMessage(violatedConstraints);
    108       return MessageBox.Show("The following constraints are violated. Do you want to complete the operation anyhow?\n\n" + message,
    109                              "Constraint Violation",
    110                              MessageBoxButtons.YesNo,
    111                              MessageBoxIcon.Question);
    112     }
    113     /// <summary>
    114     /// Builds a message out of a given collection of violated constraints,
    115     /// including the constraints type and description.
    116     /// </summary>
    117     /// <param name="violatedConstraints">The constraints that could not be fulfilled.</param>
    118     /// <returns>The message to display.</returns>
    119     private static string BuildConstraintViolationMessage(ICollection<IConstraint> violatedConstraints) {
    120       StringBuilder sb = new StringBuilder();
    121       foreach (IConstraint constraint in violatedConstraints) {
    122         sb.AppendLine(constraint.GetType().Name);
    123         sb.AppendLine(constraint.Description);
    124         sb.AppendLine();
    125       }
    126       return sb.ToString();
    127     }
    128     #endregion
    12969  }
    13070}
  • trunk/sources/HeuristicLab.Core.Views/3.3/HeuristicLab.Core.Views-3.3.csproj

    r2520 r2524  
    7070      <DependentUpon>ChooseTypeDialog.cs</DependentUpon>
    7171    </Compile>
    72     <Compile Include="ConstrainedItemBaseView.cs">
    73       <SubType>UserControl</SubType>
    74     </Compile>
    75     <Compile Include="ConstrainedItemBaseView.Designer.cs">
    76       <DependentUpon>ConstrainedItemBaseView.cs</DependentUpon>
    77     </Compile>
    7872    <Compile Include="EditorBase.cs">
    7973      <SubType>UserControl</SubType>
     
    210204    <EmbeddedResource Include="ChooseTypeDialog.resx">
    211205      <DependentUpon>ChooseTypeDialog.cs</DependentUpon>
    212     </EmbeddedResource>
    213     <EmbeddedResource Include="ConstrainedItemBaseView.resx">
    214       <DependentUpon>ConstrainedItemBaseView.cs</DependentUpon>
    215206    </EmbeddedResource>
    216207    <EmbeddedResource Include="EditorBase.resx">
  • trunk/sources/HeuristicLab.Core.Views/3.3/OperatorBaseView.Designer.cs

    r2520 r2524  
    5353      this.variablesTabPage = new System.Windows.Forms.TabPage();
    5454      this.operatorBaseVariablesView = new HeuristicLab.Core.Views.OperatorBaseVariablesView();
    55       this.constraintsTabPage = new System.Windows.Forms.TabPage();
    56       this.constrainedItemBaseView = new HeuristicLab.Core.Views.ConstrainedItemBaseView();
    5755      this.descriptionTabPage = new System.Windows.Forms.TabPage();
    5856      this.operatorBaseDescriptionView = new HeuristicLab.Core.Views.OperatorBaseDescriptionView();
     
    6058      this.variableInfosTabPage.SuspendLayout();
    6159      this.variablesTabPage.SuspendLayout();
    62       this.constraintsTabPage.SuspendLayout();
    6360      this.descriptionTabPage.SuspendLayout();
    6461      this.SuspendLayout();
     
    6865      this.tabControl.Controls.Add(this.variableInfosTabPage);
    6966      this.tabControl.Controls.Add(this.variablesTabPage);
    70       this.tabControl.Controls.Add(this.constraintsTabPage);
    7167      this.tabControl.Controls.Add(this.descriptionTabPage);
    7268      this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
     
    119115      this.operatorBaseVariablesView.TabIndex = 0;
    120116      //
    121       // constraintsTabPage
    122       //
    123       this.constraintsTabPage.Controls.Add(this.constrainedItemBaseView);
    124       this.constraintsTabPage.Location = new System.Drawing.Point(4, 22);
    125       this.constraintsTabPage.Name = "constraintsTabPage";
    126       this.constraintsTabPage.Padding = new System.Windows.Forms.Padding(3);
    127       this.constraintsTabPage.Size = new System.Drawing.Size(415, 307);
    128       this.constraintsTabPage.TabIndex = 2;
    129       this.constraintsTabPage.Text = "Constraints";
    130       this.constraintsTabPage.UseVisualStyleBackColor = true;
    131       //
    132       // constrainedItemBaseView
    133       //
    134       this.constrainedItemBaseView.Caption = "Constrained Data";
    135       this.constrainedItemBaseView.ConstrainedItem = null;
    136       this.constrainedItemBaseView.Dock = System.Windows.Forms.DockStyle.Fill;
    137       this.constrainedItemBaseView.Location = new System.Drawing.Point(3, 3);
    138       this.constrainedItemBaseView.Name = "constrainedItemBaseView";
    139       this.constrainedItemBaseView.Size = new System.Drawing.Size(409, 301);
    140       this.constrainedItemBaseView.TabIndex = 0;
    141       //
    142117      // descriptionTabPage
    143118      //
     
    172147      this.variableInfosTabPage.ResumeLayout(false);
    173148      this.variablesTabPage.ResumeLayout(false);
    174       this.constraintsTabPage.ResumeLayout(false);
    175149      this.descriptionTabPage.ResumeLayout(false);
    176150      this.ResumeLayout(false);
     
    183157    protected TabPage variableInfosTabPage;
    184158    protected TabPage variablesTabPage;
    185     private TabPage constraintsTabPage;
    186     protected ConstrainedItemBaseView constrainedItemBaseView;
    187159    protected OperatorBaseVariableInfosView operatorBaseVariableInfosView;
    188160    protected OperatorBaseVariablesView operatorBaseVariablesView;
  • trunk/sources/HeuristicLab.Core.Views/3.3/OperatorBaseView.cs

    r2520 r2524  
    7070      operatorBaseVariableInfosView.Operator = null;
    7171      operatorBaseVariablesView.Operator = null;
    72       constrainedItemBaseView.ConstrainedItem = null;
    7372      operatorBaseDescriptionView.Operator = null;
    7473      base.RemoveItemEvents();
     
    8180      operatorBaseVariableInfosView.Operator = Operator;
    8281      operatorBaseVariablesView.Operator = Operator;
    83       constrainedItemBaseView.ConstrainedItem = Operator;
    8482      operatorBaseDescriptionView.Operator = Operator;
    8583    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/OperatorGraphView.cs

    r2520 r2524  
    353353              IOperator newParent = (IOperator)node.Parent.Tag;
    354354              int newIndex = node.Index;
    355               ICollection<IConstraint> violatedConstraints;
    356               ICollection<IConstraint> violatedConstraints2;
    357               oldParent.TryRemoveSubOperator(oldIndex, out violatedConstraints);
    358               newParent.TryAddSubOperator(op, newIndex, out violatedConstraints2);
    359               if ((violatedConstraints.Count == 0) && (violatedConstraints2.Count == 0)) {
    360                 graphTreeView.SelectedNode = parentNode.Nodes[newIndex];
    361               } else {
    362                 List<IConstraint> allViolatedConstraints = new List<IConstraint>(violatedConstraints);
    363                 allViolatedConstraints.AddRange(violatedConstraints2);
    364                 if (Auxiliary.ShowIgnoreConstraintViolationMessageBox(allViolatedConstraints) == DialogResult.Yes) {
    365                   if (violatedConstraints.Count > 0)
    366                     oldParent.RemoveSubOperator(oldIndex);
    367                   if (violatedConstraints2.Count > 0)
    368                     newParent.AddSubOperator(op, newIndex);
    369                   graphTreeView.SelectedNode = parentNode.Nodes[newIndex];
    370                 } else {
    371                   if (violatedConstraints.Count == 0)
    372                     oldParent.AddSubOperator(op, oldIndex);
    373                   if (violatedConstraints2.Count == 0)
    374                     newParent.RemoveSubOperator(newIndex);
    375                 }
    376               }
     355              oldParent.RemoveSubOperator(oldIndex);
     356              newParent.AddSubOperator(op, newIndex);
     357              graphTreeView.SelectedNode = parentNode.Nodes[newIndex];
    377358            }
    378359          } else {
    379360            if (node != null) {
    380361              IOperator parent = (IOperator)node.Tag;
    381               ICollection<IConstraint> violatedConstraints;
    382               if (parent.TryAddSubOperator(op, out violatedConstraints)) {
    383                 graphTreeView.SelectedNode = node.Nodes[node.Nodes.Count - 1];
    384               } else if (Auxiliary.ShowIgnoreConstraintViolationMessageBox(violatedConstraints) == DialogResult.Yes) {
    385                 parent.AddSubOperator(op);
    386                 graphTreeView.SelectedNode = node.Nodes[node.Nodes.Count - 1];
    387               }
     362              parent.AddSubOperator(op);
     363              graphTreeView.SelectedNode = node.Nodes[node.Nodes.Count - 1];
    388364            }
    389365          }
  • trunk/sources/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj

    r2520 r2524  
    9999  <ItemGroup>
    100100    <Compile Include="Auxiliary.cs" />
    101     <Compile Include="ConstrainedItemBase.cs" />
    102101    <Compile Include="AtomicOperation.cs" />
    103102    <Compile Include="CompositeOperation.cs" />
     
    106105    <Compile Include="Interfaces\IOperatorLibrary.cs" />
    107106    <Compile Include="Interfaces\IVisualizationItem.cs" />
    108     <Compile Include="Interfaces\IConstrainedItem.cs" />
    109     <Compile Include="Interfaces\IConstraint.cs" />
    110107    <Compile Include="Interfaces\IItem.cs" />
    111108    <Compile Include="ItemBase.cs" />
  • trunk/sources/HeuristicLab.Core/3.3/Interfaces/IOperator.cs

    r2474 r2524  
    3030  /// a basic instruction of an algorithm.
    3131  /// </summary>
    32   public interface IOperator : IConstrainedItem {
     32  public interface IOperator : IItem {
    3333    /// <summary>
    3434    /// Gets or sets the name of the current instance.
     
    6868    void AddSubOperator(IOperator op);
    6969    /// <summary>
    70     /// Adds the given sub operator to the current instance if all constraints can be fulfilled.
    71     /// </summary>
    72     /// <param name="op">The operator to add.</param>
    73     /// <returns><c>true</c> if the operator could be added without violating constraints,
    74     /// <c>false</c> otherwise.</returns>
    75     bool TryAddSubOperator(IOperator op);
    76     /// <summary>
    77     /// Adds the given sub operator to the current instance if all constraints can be fulfilled.
    78     /// </summary>
    79     /// <param name="op">The operator to add.</param>
    80     /// <param name="violatedConstraints">Output parameter; contains all constraints that could not be
    81     /// fulfilled.</param>
    82     /// <returns><c>true</c> if the operator could be added without violating constraints,
    83     /// <c>false</c> otherwise.</returns>
    84     bool TryAddSubOperator(IOperator op, out ICollection<IConstraint> violatedConstraints);
    85     /// <summary>
    8670    /// Adds the given sub operator at a the specified <paramref name="index"/>.
    8771    /// </summary>
     
    9074    void AddSubOperator(IOperator op, int index);
    9175    /// <summary>
    92     /// Adds the given operator at the specified <paramref name="index"/> to the current instance
    93     /// if all constraints can be fulfilled.
    94     /// </summary>
    95     /// <param name="op">The operator to add.</param>
    96     /// <param name="index">The position where to add the operator.</param>
    97     /// <returns><c>true</c> if the operator could be added without violating constraints,
    98     /// <c>false</c> otherwise.</returns>
    99     bool TryAddSubOperator(IOperator op, int index);
    100     /// <summary>
    101     /// Adds the given operator at the specified <paramref name="index"/> to the current instance
    102     /// if all constraints can be fulfilled.
    103     /// </summary>
    104     /// <param name="op">The operator to add.</param>
    105     /// <param name="index">The position where to add the operator.</param>
    106     /// <param name="violatedConstraints">Output parameter; contains all constraints that could not be
    107     /// fulfilled.</param>
    108     /// <returns><c>true</c> if the operator could be added without violating constraints,
    109     /// <c>false</c> otherwise.</returns>
    110     bool TryAddSubOperator(IOperator op, int index, out ICollection<IConstraint> violatedConstraints);
    111     /// <summary>
    11276    /// Removes a sub operator at the specified <paramref name="index"/>.
    11377    /// </summary>
    11478    /// <param name="index">The position where to delete the operator.</param>
    11579    void RemoveSubOperator(int index);
    116     /// <summary>
    117     /// Removes a sub operator at the specified <paramref name="index"/> if all constraint can be fulfilled.
    118     /// </summary>
    119     /// <param name="index">The position where to delete the operator.</param>
    120     /// <returns><c>true</c> if the operator could be deleted without violating constraints,
    121     /// <c>false</c> otherwise.</returns>
    122     bool TryRemoveSubOperator(int index);
    123     /// <summary>
    124     /// Deletes the operator at the specified <paramref name="index"/> 
    125     /// if all constraints can be fulfilled.
    126     /// </summary>
    127     /// <param name="index">The position where to delete the operator.</param>
    128     /// <param name="violatedConstraints">Output parameter; contains all constraints that could not be
    129     /// fulfilled.</param>
    130     /// <returns><c>true</c> if the operator could be deleted without violating constraints,
    131     /// <c>false</c> otherwise.</returns>
    132     bool TryRemoveSubOperator(int index, out ICollection<IConstraint> violatedConstraints);
    13380
    13481    /// <summary>
     
    14491    void AddVariableInfo(IVariableInfo variableInfo);
    14592    /// <summary>
    146     /// Adds the specified variable info to the current instance, if all constraints can be fulfilled.
    147     /// </summary>
    148     /// <param name="variableInfo">The variable info to add.</param>
    149     /// <returns><c>true</c> if the variable info could be added without violating constraints,
    150     /// <c>false</c> otherwise.</returns>
    151     bool TryAddVariableInfo(IVariableInfo variableInfo);
    152     /// <summary>
    153     /// Adds the specified variable info to the current instance, if all constraints can be fulfilled.
    154     /// </summary>
    155     /// <param name="variableInfo">The variable info to add.</param>
    156     /// <param name="violatedConstraints">Output parameter; contains all constraints that could not be
    157     /// fulfilled.</param>
    158     /// <returns><c>true</c> if the variable info could be added without violating constraints,
    159     /// <c>false</c> otherwise.</returns>
    160     bool TryAddVariableInfo(IVariableInfo variableInfo, out ICollection<IConstraint> violatedConstraints);
    161     /// <summary>
    16293    /// Removes the variable info with the given formal name.
    16394    /// </summary>
    16495    /// <param name="formalName">The formal name of the variable info to remove.</param>
    16596    void RemoveVariableInfo(string formalName);
    166     /// <summary>
    167     /// Deletes the variable info with the given formal name,
    168     /// if all constraints can be fulfilled.
    169     /// </summary>
    170     /// <param name="formalName">The formal name of the variable info to remove.</param>
    171     /// <returns><c>true</c> if the variable info could be deleted without violating constraints,
    172     /// <c>false</c> otherwise.</returns>
    173     bool TryRemoveVariableInfo(string formalName);
    174     /// <summary>
    175     /// Deletes the variable info with the given formal name,
    176     /// if all constraints can be fulfilled.
    177     /// </summary>
    178     /// <param name="formalName">The formal name of the variable info to remove.</param>
    179     /// <param name="violatedConstraints">Output parameter; contains all constraints that could not be
    180     /// fulfilled.</param>
    181     /// <returns><c>true</c> if the variable info could be deleted without violating constraints,
    182     /// <c>false</c> otherwise.</returns>
    183     bool TryRemoveVariableInfo(string formalName, out ICollection<IConstraint> violatedConstraints);
    18497
    18598    /// <summary>
     
    195108    void AddVariable(IVariable variable);
    196109    /// <summary>
    197     /// Adds the specified <paramref name="variable"/> to the current instance if all constraints can
    198     /// be fulfilled.
    199     /// </summary>
    200     /// <param name="variable">The variable to add.</param>
    201     /// <returns><c>true</c> if the variable could be added without violating constraints,
    202     /// <c>false</c> otherwise.</returns>
    203     bool TryAddVariable(IVariable variable);
    204     /// <summary>
    205     /// Adds the specified <paramref name="variable"/> to the current instance if all constraints can
    206     /// be fulfilled.
    207     /// </summary>
    208     /// <param name="variable">The variable to add.</param>
    209     /// <param name="violatedConstraints">Output parameter; contains all constraints that could
    210     /// not be fulfillled.</param>
    211     /// <returns><c>true</c> if the variable could be added without violating constraints,
    212     /// <c>false</c> otherwise.</returns>
    213     bool TryAddVariable(IVariable variable, out ICollection<IConstraint> violatedConstraints);
    214     /// <summary>
    215110    /// Deletes the variable with the specified <paramref name="name"/>.
    216111    /// </summary>
    217112    /// <param name="name">The name of the variable to delete.</param>
    218113    void RemoveVariable(string name);
    219     /// <summary>
    220     /// Deletes the variable with the specified <paramref name="name"/> if all constraints can be
    221     /// fulfilled.
    222     /// </summary>
    223     /// <param name="name">The name of the variable to remove.</param>
    224     /// <returns><c>true</c> if the variable could be deleted without violating constraints,
    225     /// <c>false</c> otherwise.</returns>
    226     bool TryRemoveVariable(string name);
    227     /// <summary>
    228     /// Deletes the variable with the specified <paramref name="name"/> if all constraints can be
    229     /// fulfilled.
    230     /// </summary>
    231     /// <param name="name">The name of the variable to remove.</param>
    232     /// <param name="violatedConstraints">Output parameter; contains all constraints that could
    233     /// not be fulfilled.</param>
    234     /// <returns><c>true</c> if the variable could be deleted without violating constraints,
    235     /// <c>false</c> otherwise.</returns>
    236     bool TryRemoveVariable(string name, out ICollection<IConstraint> violatedConstraints);
    237    
     114
    238115    /// <inheritdoc cref="GetVariableValue(string, HeuristicLab.Core.IScope, bool)"/>
    239116    /// <typeparam name="T">The type of the value that is searched.</typeparam>       
  • trunk/sources/HeuristicLab.Core/3.3/OperatorBase.cs

    r2520 r2524  
    3131  /// The base class for all operators.
    3232  /// </summary>
    33   public abstract class OperatorBase : ConstrainedItemBase, IOperator {
     33  public abstract class OperatorBase : ItemBase, IOperator {
    3434
    3535    [Storable]
     
    154154      OnSubOperatorAdded(subOperator, mySubOperators.Count - 1);
    155155    }
    156     /// <inheritdoc cref="IOperator.TryAddSubOperator(HeuristicLab.Core.IOperator)"/>
    157     /// <param name="subOperator">The sub operator to add.</param>
    158     /// <remarks>Calls <see cref="OnSubOperatorAdded"/>.</remarks>
    159     public virtual bool TryAddSubOperator(IOperator subOperator) {
    160       mySubOperators.Add(subOperator);
    161       if (IsValid()) {
    162         OnSubOperatorAdded(subOperator, mySubOperators.Count - 1);
    163         return true;
    164       } else {
    165         mySubOperators.RemoveAt(mySubOperators.Count - 1);
    166         return false;
    167       }
    168     }
    169     /// <inheritdoc cref="HeuristicLab.Core.IOperator.TryAddSubOperator(HeuristicLab.Core.IOperator,
    170     /// out System.Collections.Generic.ICollection&lt;HeuristicLab.Core.IConstraint&gt;)"/>
    171     /// <param name="subOperator">The sub operator to add.</param>
    172     /// <remarks>Calls <see cref="OnSubOperatorAdded"/>.</remarks>
    173     public virtual bool TryAddSubOperator(IOperator subOperator, out ICollection<IConstraint> violatedConstraints) {
    174       mySubOperators.Add(subOperator);
    175       if (IsValid(out violatedConstraints)) {
    176         OnSubOperatorAdded(subOperator, mySubOperators.Count - 1);
    177         return true;
    178       } else {
    179         mySubOperators.RemoveAt(mySubOperators.Count - 1);
    180         return false;
    181       }
    182     }
    183156    /// <inheritdoc cref="HeuristicLab.Core.IOperator.AddSubOperator(HeuristicLab.Core.IOperator, int)"/>
    184157    /// <param name="subOperator">The sub operator to add.</param>
     
    188161      OnSubOperatorAdded(subOperator, index);
    189162    }
    190     /// <inheritdoc cref="IOperator.TryAddSubOperator(HeuristicLab.Core.IOperator, int)"/>
    191     /// <param name="subOperator">The sub operator to add.</param>
    192     /// <remarks>Calls <see cref="OnSubOperatorAdded"/>.</remarks>
    193     public virtual bool TryAddSubOperator(IOperator subOperator, int index) {
    194       mySubOperators.Insert(index, subOperator);
    195       if (IsValid()) {
    196         OnSubOperatorAdded(subOperator, index);
    197         return true;
    198       } else {
    199         mySubOperators.RemoveAt(index);
    200         return false;
    201       }
    202     }
    203     /// <inheritdoc cref="IOperator.TryAddSubOperator(HeuristicLab.Core.IOperator, int, out
    204     /// System.Collections.Generic.ICollection&lt;HeuristicLab.Core.IConstraint&gt;)"/>
    205     /// <param name="subOperator">The sub operator to add.</param>
    206     /// <remarks>Calls <see cref="OnSubOperatorAdded"/>.</remarks>
    207     public virtual bool TryAddSubOperator(IOperator subOperator, int index, out ICollection<IConstraint> violatedConstraints) {
    208       mySubOperators.Insert(index, subOperator);
    209       if (IsValid(out violatedConstraints)) {
    210         OnSubOperatorAdded(subOperator, index);
    211         return true;
    212       } else {
    213         mySubOperators.RemoveAt(index);
    214         return false;
    215       }
    216     }
    217163    /// <inheritdoc/>
    218164    /// <remarks>Calls <see cref="OnSubOperatorRemoved"/>.</remarks>
     
    221167      mySubOperators.RemoveAt(index);
    222168      OnSubOperatorRemoved(op, index);
    223     }
    224     /// <inheritdoc/>
    225     /// <remarks>Calls <see cref="OnSubOperatorRemoved"/>.</remarks>
    226     public virtual bool TryRemoveSubOperator(int index) {
    227       IOperator op = mySubOperators[index];
    228       mySubOperators.RemoveAt(index);
    229       if (IsValid()) {
    230         OnSubOperatorRemoved(op, index);
    231         return true;
    232       } else {
    233         mySubOperators.Insert(index, op);
    234         return false;
    235       }
    236     }
    237     /// <inheritdoc/>
    238     /// <remarks>Calls <see cref="OnSubOperatorRemoved"/>.</remarks>
    239     public virtual bool TryRemoveSubOperator(int index, out ICollection<IConstraint> violatedConstraints) {
    240       IOperator op = mySubOperators[index];
    241       mySubOperators.RemoveAt(index);
    242       if (IsValid(out violatedConstraints)) {
    243         OnSubOperatorRemoved(op, index);
    244         return true;
    245       } else {
    246         mySubOperators.Insert(index, op);
    247         return false;
    248       }
    249169    }
    250170    #endregion
     
    266186    }
    267187    /// <inheritdoc/>
    268     /// <remarks>Calls <see cref="OnVariableInfoAdded"/>.</remarks>
    269     public virtual bool TryAddVariableInfo(IVariableInfo variableInfo) {
    270       myVariableInfos.Add(variableInfo.FormalName, variableInfo);
    271       if (IsValid()) {
    272         OnVariableInfoAdded(variableInfo);
    273         return true;
    274       } else {
    275         myVariableInfos.Remove(variableInfo.FormalName);
    276         return false;
    277       }
    278     }
    279     /// <inheritdoc/>
    280     /// <remarks>Calls <see cref="OnVariableInfoAdded"/>.</remarks>
    281     public virtual bool TryAddVariableInfo(IVariableInfo variableInfo, out ICollection<IConstraint> violatedConstraints) {
    282       myVariableInfos.Add(variableInfo.FormalName, variableInfo);
    283       if (IsValid(out violatedConstraints)) {
    284         OnVariableInfoAdded(variableInfo);
    285         return true;
    286       } else {
    287         myVariableInfos.Remove(variableInfo.FormalName);
    288         return false;
    289       }
    290     }
    291     /// <inheritdoc/>
    292188    /// <remarks>Calls <see cref="OnVariableInfoRemoved"/>.</remarks>
    293189    public virtual void RemoveVariableInfo(string formalName) {
     
    297193        OnVariableInfoRemoved(variableInfo);
    298194      }
    299     }
    300     /// <inheritdoc/>
    301     /// <remarks>Calls <see cref="OnVariableInfoRemoved"/>.</remarks>
    302     public virtual bool TryRemoveVariableInfo(string formalName) {
    303       IVariableInfo variableInfo;
    304       if (myVariableInfos.TryGetValue(formalName, out variableInfo)) {
    305         myVariableInfos.Remove(formalName);
    306         if (IsValid()) {
    307           OnVariableInfoRemoved(variableInfo);
    308           return true;
    309         } else {
    310           myVariableInfos.Add(formalName, variableInfo);
    311           return false;
    312         }
    313       }
    314       return true;
    315     }
    316     /// <inheritdoc/>
    317     /// <remarks>Calls <see cref="OnVariableInfoRemoved"/>.</remarks>
    318     public virtual bool TryRemoveVariableInfo(string formalName, out ICollection<IConstraint> violatedConstraints) {
    319       IVariableInfo variableInfo;
    320       if (myVariableInfos.TryGetValue(formalName, out variableInfo)) {
    321         myVariableInfos.Remove(formalName);
    322         if (IsValid(out violatedConstraints)) {
    323           OnVariableInfoRemoved(variableInfo);
    324           return true;
    325         } else {
    326           myVariableInfos.Add(formalName, variableInfo);
    327           return false;
    328         }
    329       }
    330       violatedConstraints = new List<IConstraint>();
    331       return true;
    332195    }
    333196    #endregion
     
    350213      variable.NameChanged += new EventHandler(Variable_NameChanged);
    351214      OnVariableAdded(variable);
    352     }
    353     /// <inheritdoc/>
    354     /// <remarks>Calls <see cref="OnVariableAdded"/> and adds <c>NameChanging</c> and <c>NameChanged</c>
    355     /// event handlers.</remarks>
    356     public virtual bool TryAddVariable(IVariable variable) {
    357       myVariables.Add(variable.Name, variable);
    358       if (IsValid()) {
    359         variable.NameChanging += new EventHandler<CancelEventArgs<string>>(Variable_NameChanging);
    360         variable.NameChanged += new EventHandler(Variable_NameChanged);
    361         OnVariableAdded(variable);
    362         return true;
    363       } else {
    364         myVariableInfos.Remove(variable.Name);
    365         return false;
    366       }
    367     }
    368     /// <inheritdoc/>
    369     /// <remarks>Calls <see cref="OnVariableAdded"/> and adds <c>NameChanging</c> and <c>NameChanged</c>
    370     /// event handlers.</remarks>
    371     public virtual bool TryAddVariable(IVariable variable, out ICollection<IConstraint> violatedConstraints) {
    372       myVariables.Add(variable.Name, variable);
    373       if (IsValid(out violatedConstraints)) {
    374         variable.NameChanging += new EventHandler<CancelEventArgs<string>>(Variable_NameChanging);
    375         variable.NameChanged += new EventHandler(Variable_NameChanged);
    376         OnVariableAdded(variable);
    377         return true;
    378       } else {
    379         myVariableInfos.Remove(variable.Name);
    380         return false;
    381       }
    382215    }
    383216    /// <inheritdoc/>
     
    392225        OnVariableRemoved(variable);
    393226      }
    394     }
    395     /// <inheritdoc/>
    396     /// <remarks>Calls <see cref="OnVariableRemoved"/> and removes <c>NameChanging</c> and <c>NameChanged</c>
    397     /// event handlers.</remarks>
    398     public virtual bool TryRemoveVariable(string name) {
    399       IVariable variable;
    400       if (myVariables.TryGetValue(name, out variable)) {
    401         myVariables.Remove(name);
    402         if (IsValid()) {
    403           variable.NameChanging -= new EventHandler<CancelEventArgs<string>>(Variable_NameChanging);
    404           variable.NameChanged -= new EventHandler(Variable_NameChanged);
    405           OnVariableRemoved(variable);
    406           return true;
    407         } else {
    408           myVariables.Add(name, variable);
    409           return false;
    410         }
    411       }
    412       return true;
    413     }
    414     /// <inheritdoc/>
    415     /// <remarks>Calls <see cref="OnVariableRemoved"/> and removes <c>NameChanging</c> and <c>NameChanged</c>
    416     /// event handlers.</remarks>
    417     public virtual bool TryRemoveVariable(string name, out ICollection<IConstraint> violatedConstraints) {
    418       IVariable variable;
    419       if (myVariables.TryGetValue(name, out variable)) {
    420         myVariables.Remove(name);
    421         if (IsValid(out violatedConstraints)) {
    422           variable.NameChanging -= new EventHandler<CancelEventArgs<string>>(Variable_NameChanging);
    423           variable.NameChanged -= new EventHandler(Variable_NameChanged);
    424           OnVariableRemoved(variable);
    425           return true;
    426         } else {
    427           myVariables.Add(name, variable);
    428           return false;
    429         }
    430       }
    431       violatedConstraints = new List<IConstraint>();
    432       return true;
    433227    }
    434228    private void Variable_NameChanging(object sender, CancelEventArgs<string> e) {
  • trunk/sources/HeuristicLab.Data/3.3/HeuristicLab.Data-3.3.csproj

    r2520 r2524  
    128128      <DependentUpon>BoolMatrixDataView.cs</DependentUpon>
    129129    </Compile>
    130     <Compile Include="ConstrainedItemList.cs" />
    131     <Compile Include="ConstrainedItemListView.cs">
    132       <SubType>UserControl</SubType>
    133     </Compile>
    134     <Compile Include="ConstrainedItemListView.Designer.cs">
    135       <DependentUpon>ConstrainedItemListView.cs</DependentUpon>
    136     </Compile>
    137     <Compile Include="ConstrainedObjectData.cs" />
    138     <Compile Include="ConstrainedIntData.cs" />
    139     <Compile Include="ConstrainedIntDataView.cs">
    140       <SubType>UserControl</SubType>
    141     </Compile>
    142     <Compile Include="ConstrainedIntDataView.Designer.cs">
    143       <DependentUpon>ConstrainedIntDataView.cs</DependentUpon>
    144     </Compile>
    145     <Compile Include="ConstrainedDoubleData.cs" />
    146     <Compile Include="ConstrainedDoubleDataView.cs">
    147       <SubType>UserControl</SubType>
    148     </Compile>
    149     <Compile Include="ConstrainedDoubleDataView.Designer.cs">
    150       <DependentUpon>ConstrainedDoubleDataView.cs</DependentUpon>
    151     </Compile>
    152130    <Compile Include="EditKeyValueDialog.cs">
    153131      <SubType>Form</SubType>
     
    277255    <EmbeddedResource Include="BoolDataView.resx">
    278256      <DependentUpon>BoolDataView.cs</DependentUpon>
    279       <SubType>Designer</SubType>
    280     </EmbeddedResource>
    281     <EmbeddedResource Include="ConstrainedIntDataView.resx">
    282       <DependentUpon>ConstrainedIntDataView.cs</DependentUpon>
    283       <SubType>Designer</SubType>
    284     </EmbeddedResource>
    285     <EmbeddedResource Include="ConstrainedDoubleDataView.resx">
    286       <DependentUpon>ConstrainedDoubleDataView.cs</DependentUpon>
    287       <SubType>Designer</SubType>
    288     </EmbeddedResource>
    289     <EmbeddedResource Include="ConstrainedItemListView.resx">
    290       <DependentUpon>ConstrainedItemListView.cs</DependentUpon>
    291257      <SubType>Designer</SubType>
    292258    </EmbeddedResource>
  • trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperatorView.Designer.cs

    r2520 r2524  
    5757      this.variablesTabPage = new System.Windows.Forms.TabPage();
    5858      this.operatorBaseVariablesView = new HeuristicLab.Core.Views.OperatorBaseVariablesView();
    59       this.constraintsTabPage = new System.Windows.Forms.TabPage();
    60       this.constrainedItemBaseView = new HeuristicLab.Core.Views.ConstrainedItemBaseView();
    6159      this.descriptionTabPage = new System.Windows.Forms.TabPage();
    6260      this.descriptionTextBox = new System.Windows.Forms.TextBox();
     
    6563      this.variableInfosTabPage.SuspendLayout();
    6664      this.variablesTabPage.SuspendLayout();
    67       this.constraintsTabPage.SuspendLayout();
    6865      this.descriptionTabPage.SuspendLayout();
    6966      this.SuspendLayout();
     
    7471      this.tabControl.Controls.Add(this.variableInfosTabPage);
    7572      this.tabControl.Controls.Add(this.variablesTabPage);
    76       this.tabControl.Controls.Add(this.constraintsTabPage);
    7773      this.tabControl.Controls.Add(this.descriptionTabPage);
    7874      this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
     
    206202      this.operatorBaseVariablesView.TabIndex = 0;
    207203      //
    208       // constraintsTabPage
    209       //
    210       this.constraintsTabPage.Controls.Add(this.constrainedItemBaseView);
    211       this.constraintsTabPage.Location = new System.Drawing.Point(4, 22);
    212       this.constraintsTabPage.Name = "constraintsTabPage";
    213       this.constraintsTabPage.Padding = new System.Windows.Forms.Padding(3);
    214       this.constraintsTabPage.Size = new System.Drawing.Size(427, 325);
    215       this.constraintsTabPage.TabIndex = 3;
    216       this.constraintsTabPage.Text = "Constraints";
    217       this.constraintsTabPage.UseVisualStyleBackColor = true;
    218       //
    219       // constrainedItemBaseView
    220       //
    221       this.constrainedItemBaseView.Caption = "Constrained Item";
    222       this.constrainedItemBaseView.ConstrainedItem = null;
    223       this.constrainedItemBaseView.Dock = System.Windows.Forms.DockStyle.Fill;
    224       this.constrainedItemBaseView.Location = new System.Drawing.Point(3, 3);
    225       this.constrainedItemBaseView.Name = "constrainedItemBaseView";
    226       this.constrainedItemBaseView.Size = new System.Drawing.Size(421, 319);
    227       this.constrainedItemBaseView.TabIndex = 0;
    228       //
    229204      // descriptionTabPage
    230205      //
     
    262237      this.variableInfosTabPage.ResumeLayout(false);
    263238      this.variablesTabPage.ResumeLayout(false);
    264       this.constraintsTabPage.ResumeLayout(false);
    265239      this.descriptionTabPage.ResumeLayout(false);
    266240      this.descriptionTabPage.PerformLayout();
     
    278252    private System.Windows.Forms.TabPage variablesTabPage;
    279253    private HeuristicLab.Core.Views.OperatorBaseVariablesView operatorBaseVariablesView;
    280     private System.Windows.Forms.TabPage constraintsTabPage;
    281     private HeuristicLab.Core.Views.ConstrainedItemBaseView constrainedItemBaseView;
    282254    private System.Windows.Forms.TabPage descriptionTabPage;
    283255    private System.Windows.Forms.TextBox descriptionTextBox;
  • trunk/sources/HeuristicLab.Operators.Programmable/3.3/ProgrammableOperatorView.cs

    r2520 r2524  
    5151      operatorBaseVariableInfosView.Operator = null;
    5252      operatorBaseVariablesView.Operator = null;
    53       constrainedItemBaseView.ConstrainedItem = null;
    5453      ProgrammableOperator.CodeChanged -= new EventHandler(ProgrammableOperator_CodeChanged);
    5554      ProgrammableOperator.DescriptionChanged -= new EventHandler(ProgrammableOperator_DescriptionChanged);
     
    6160      operatorBaseVariableInfosView.Operator = ProgrammableOperator;
    6261      operatorBaseVariablesView.Operator = ProgrammableOperator;
    63       constrainedItemBaseView.ConstrainedItem = ProgrammableOperator;
    6462      ProgrammableOperator.CodeChanged += new EventHandler(ProgrammableOperator_CodeChanged);
    6563      ProgrammableOperator.DescriptionChanged += new EventHandler(ProgrammableOperator_DescriptionChanged);
  • trunk/sources/HeuristicLab.Operators/3.3/CombinedOperatorView.Designer.cs

    r2520 r2524  
    5252      this.variablesTabPage = new System.Windows.Forms.TabPage();
    5353      this.operatorBaseVariablesView = new HeuristicLab.Core.Views.OperatorBaseVariablesView();
    54       this.constraintsTabPage = new System.Windows.Forms.TabPage();
    55       this.constrainedItemBaseView = new HeuristicLab.Core.Views.ConstrainedItemBaseView();
    5654      this.descriptionTabPage = new System.Windows.Forms.TabPage();
    5755      this.descriptionTextBox = new System.Windows.Forms.TextBox();
     
    6260      this.variableInfosTabPage.SuspendLayout();
    6361      this.variablesTabPage.SuspendLayout();
    64       this.constraintsTabPage.SuspendLayout();
    6562      this.descriptionTabPage.SuspendLayout();
    6663      this.SuspendLayout();
     
    7168      this.tabControl.Controls.Add(this.variableInfosTabPage);
    7269      this.tabControl.Controls.Add(this.variablesTabPage);
    73       this.tabControl.Controls.Add(this.constraintsTabPage);
    7470      this.tabControl.Controls.Add(this.descriptionTabPage);
    7571      this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
     
    148144      this.operatorBaseVariablesView.TabIndex = 0;
    149145      //
    150       // constraintsTabPage
    151       //
    152       this.constraintsTabPage.Controls.Add(this.constrainedItemBaseView);
    153       this.constraintsTabPage.Location = new System.Drawing.Point(4, 22);
    154       this.constraintsTabPage.Name = "constraintsTabPage";
    155       this.constraintsTabPage.Padding = new System.Windows.Forms.Padding(3);
    156       this.constraintsTabPage.Size = new System.Drawing.Size(389, 309);
    157       this.constraintsTabPage.TabIndex = 3;
    158       this.constraintsTabPage.Text = "Constraints";
    159       this.constraintsTabPage.UseVisualStyleBackColor = true;
    160       //
    161       // constrainedItemBaseView
    162       //
    163       this.constrainedItemBaseView.Caption = "Constrained Item";
    164       this.constrainedItemBaseView.ConstrainedItem = null;
    165       this.constrainedItemBaseView.Dock = System.Windows.Forms.DockStyle.Fill;
    166       this.constrainedItemBaseView.Location = new System.Drawing.Point(3, 3);
    167       this.constrainedItemBaseView.Name = "constrainedItemBaseView";
    168       this.constrainedItemBaseView.Size = new System.Drawing.Size(383, 303);
    169       this.constrainedItemBaseView.TabIndex = 0;
    170       //
    171146      // descriptionTabPage
    172147      //
     
    226201      this.variableInfosTabPage.ResumeLayout(false);
    227202      this.variablesTabPage.ResumeLayout(false);
    228       this.constraintsTabPage.ResumeLayout(false);
    229203      this.descriptionTabPage.ResumeLayout(false);
    230204      this.descriptionTabPage.PerformLayout();
     
    239213    private System.Windows.Forms.TabPage variableInfosTabPage;
    240214    private System.Windows.Forms.TabPage variablesTabPage;
    241     private System.Windows.Forms.TabPage constraintsTabPage;
    242215    private System.Windows.Forms.TabPage descriptionTabPage;
    243216    private System.Windows.Forms.TextBox descriptionTextBox;
     
    245218    private HeuristicLab.Core.Views.OperatorBaseVariableInfosView operatorBaseVariableInfosView;
    246219    private HeuristicLab.Core.Views.OperatorBaseVariablesView operatorBaseVariablesView;
    247     private HeuristicLab.Core.Views.ConstrainedItemBaseView constrainedItemBaseView;
    248220    private System.Windows.Forms.Button removeVariableInfoButton;
    249221    private System.Windows.Forms.Button addVariableInfoButton;
  • trunk/sources/HeuristicLab.Operators/3.3/CombinedOperatorView.cs

    r2520 r2524  
    5555      operatorBaseVariableInfosView.Operator = null;
    5656      operatorBaseVariablesView.Operator = null;
    57       constrainedItemBaseView.ConstrainedItem = null;
    5857      CombinedOperator.DescriptionChanged -= new EventHandler(CombinedOperator_DescriptionChanged);
    5958      base.RemoveItemEvents();
     
    6968      operatorBaseVariableInfosView.Operator = CombinedOperator;
    7069      operatorBaseVariablesView.Operator = CombinedOperator;
    71       constrainedItemBaseView.ConstrainedItem = CombinedOperator;
    7270      CombinedOperator.DescriptionChanged += new EventHandler(CombinedOperator_DescriptionChanged);
    7371    }
  • trunk/sources/HeuristicLab.Operators/3.3/HeuristicLab.Operators-3.3.csproj

    r2520 r2524  
    139139  </ItemGroup>
    140140  <ItemGroup>
    141     <ProjectReference Include="..\..\HeuristicLab.Constraints\3.3\HeuristicLab.Constraints-3.3.csproj">
    142       <Project>{19C1E42A-4B48-4EFD-B697-899016F1C198}</Project>
    143       <Name>HeuristicLab.Constraints-3.3</Name>
    144     </ProjectReference>
    145141    <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
    146142      <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>
  • trunk/sources/HeuristicLab.Operators/3.3/HeuristicLabOperatorsPlugin.cs

    r2520 r2524  
    3131  [ClassInfo(Name = "HeuristicLab.Operators-3.3")]
    3232  [PluginFile(Filename = "HeuristicLab.Operators-3.3.dll", Filetype = PluginFileType.Assembly)]
    33   [Dependency(Dependency = "HeuristicLab.Constraints-3.3")]
    3433  [Dependency(Dependency = "HeuristicLab.Core-3.3")]
    3534  [Dependency(Dependency = "HeuristicLab.Core.Views-3.3")]
  • trunk/sources/HeuristicLab.Random/3.3/HeuristicLab.Random-3.3.csproj

    r1691 r2524  
    9696  </ItemGroup>
    9797  <ItemGroup>
    98     <ProjectReference Include="..\..\HeuristicLab.Constraints\3.3\HeuristicLab.Constraints-3.3.csproj">
    99       <Project>{19C1E42A-4B48-4EFD-B697-899016F1C198}</Project>
    100       <Name>HeuristicLab.Constraints-3.3</Name>
    101     </ProjectReference>
    10298    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
    10399      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
  • trunk/sources/HeuristicLab.Random/3.3/NormalRandomAdder.cs

    r1853 r2524  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Data;
    27 using HeuristicLab.Constraints;
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2928
     
    106105      if (value is IntData)
    107106        AddNormal((IntData)value, normal);
    108       else if (value is ConstrainedIntData)
    109         AddNormal((ConstrainedIntData)value, normal);
    110       else if (value is ConstrainedDoubleData)
    111         AddNormal((ConstrainedDoubleData)value, normal);
    112107      else if (value is DoubleData)
    113108        AddNormal((DoubleData)value, normal);
     
    125120
    126121    /// <summary>
    127     /// Generates a new double random number and adds it to the value of the given <paramref name="data"/>
    128     /// checking its constraints.
    129     /// </summary>
    130     /// <exception cref="InvalidProgramException">Thrown when with the current settings no valid value
    131     /// could be found.</exception>
    132     /// <param name="data">The double object where to add the random number and whose constraints
    133     /// to fulfill.</param>
    134     /// <param name="normal">The continuous, normally distributed random variable.</param>
    135     public void AddNormal(ConstrainedDoubleData data, NormalDistributedRandom normal) {
    136       for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
    137         double newValue = data.Data + normal.NextDouble();
    138         if (IsIntegerConstrained(data)) {
    139           newValue = Math.Round(newValue);
    140         }
    141         if (data.TrySetData(newValue)) {
    142           return;
    143         }
    144       }
    145       throw new InvalidProgramException("Coudn't find a valid value");
    146     }
    147 
    148     /// <summary>
    149122    /// Generates a new int random number and adds it to value of the given <paramref name="data"/>.
    150123    /// </summary>
     
    154127      data.Data = (int)Math.Round(data.Data + normal.NextDouble());
    155128    }
    156 
    157     /// <summary>
    158     /// Generates a new int random number and adds it to the value of the given <paramref name="data"/>
    159     /// checking its constraints.
    160     /// </summary>
    161     /// <exception cref="InvalidProgramException">Thrown when with the current settings no valid value
    162     /// could be found.</exception>
    163     /// <param name="data">The int object where to add the generated value and whose contraints to check.</param>
    164     /// <param name="normal">The continuous, normally distributed random variable.</param>
    165     public void AddNormal(ConstrainedIntData data, NormalDistributedRandom normal) {
    166       for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
    167         if (data.TrySetData((int)Math.Round(data.Data + normal.NextDouble())))
    168           return;
    169       }
    170       throw new InvalidProgramException("Couldn't find a valid value.");
    171     }
    172 
    173     private bool IsIntegerConstrained(ConstrainedDoubleData data) {
    174       foreach (IConstraint constraint in data.Constraints) {
    175         if (constraint is IsIntegerConstraint) {
    176           return true;
    177         }
    178       }
    179       return false;
    180     }
    181129  }
    182130}
  • trunk/sources/HeuristicLab.Random/3.3/NormalRandomizer.cs

    r1853 r2524  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Data;
    27 using HeuristicLab.Constraints;
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2928
     
    9897      if (value is IntData)
    9998        RandomizeNormal((IntData)value, n);
    100       else if (value is ConstrainedIntData)
    101         RandomizeNormal((ConstrainedIntData)value, n);
    10299      else if (value is DoubleData)
    103100        RandomizeNormal((DoubleData)value, n);
    104       else if (value is ConstrainedDoubleData)
    105         RandomizeNormal((ConstrainedDoubleData)value, n);
    106101      else throw new InvalidOperationException("Can't handle type " + value.GetType().Name);
    107     }
    108 
    109     /// <summary>
    110     /// Generates a new double random variable based on a continuous, normally distributed random number generator
    111     /// <paramref name="normal"/> and checks some contraints.
    112     /// </summary>
    113     /// <exception cref="InvalidOperationException">Thrown when with the given settings no valid value in
    114     /// 100 tries could be found.
    115     /// </exception>
    116     /// <param name="data">The double object where to assign the new number to and whose constraints
    117     /// must be fulfilled.</param>
    118     /// <param name="normal">The continuous, normally distributed random variable.</param>
    119     public void RandomizeNormal(ConstrainedDoubleData data, NormalDistributedRandom normal) {
    120       for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
    121         double r = normal.NextDouble();
    122         if (IsIntegerConstrained(data)) {
    123           r = Math.Round(r);
    124         }
    125         if (data.TrySetData(r)) {
    126           return;
    127         }
    128       }
    129       throw new InvalidOperationException("Couldn't find a valid value in 100 tries with mu=" + normal.Mu + " sigma=" + normal.Sigma);
    130     }
    131 
    132     /// <summary>
    133     /// Generates a new int random variable based on a continuous, normally distributed random number
    134     /// generator <paramref name="normal"/> and checks some constraints.
    135     /// </summary>
    136     /// <exception cref="InvalidOperationException">Thrown when with the given settings no valid
    137     /// value could be found.</exception>
    138     /// <param name="data">The int object where to assign the new value to and whose constraints must
    139     /// be fulfilled.</param>
    140     /// <param name="normal">The continuous, normally distributed random variable.</param>
    141     public void RandomizeNormal(ConstrainedIntData data, NormalDistributedRandom normal) {
    142       for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
    143         double r = normal.NextDouble();
    144         if (data.TrySetData((int)Math.Round(r))) // since r is a continuous, normally distributed random variable rounding should be OK
    145           return;
    146       }
    147       throw new InvalidOperationException("Couldn't find a valid value");
    148102    }
    149103
     
    167121      data.Data = (int)Math.Round(normal.NextDouble());
    168122    }
    169 
    170 
    171     private bool IsIntegerConstrained(ConstrainedDoubleData data) {
    172       foreach (IConstraint constraint in data.Constraints) {
    173         if (constraint is IsIntegerConstraint) {
    174           return true;
    175         }
    176       }
    177       return false;
    178     }
    179123  }
    180124}
  • trunk/sources/HeuristicLab.Random/3.3/UniformRandomAdder.cs

    r1530 r2524  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Data;
    27 using HeuristicLab.Constraints;
    2827
    2928namespace HeuristicLab.Random {
     
    9190      if (value is IntData)
    9291        AddUniform((IntData)value, mt, min, max);
    93       else if (value is ConstrainedIntData)
    94         AddUniform((ConstrainedIntData)value, mt, min, max);
    9592      else if (value is DoubleData)
    9693        AddUniform((DoubleData)value, mt, min, max);
    97       else if (value is ConstrainedDoubleData)
    98         AddUniform((ConstrainedDoubleData)value, mt, min, max);
    9994      else throw new InvalidOperationException("Can't handle type " + value.GetType().Name);
    100     }
    101 
    102     /// <summary>
    103     /// Adds a new double random variable being restricted to some constraints to the value of the given
    104     /// <paramref name="data"/>.
    105     /// </summary>
    106     /// <exception cref="InvalidProgramException">Thrown when no valid value can be found.</exception>
    107     /// <param name="data">The data where to add the new variable and where to assign the new value to.</param>
    108     /// <param name="mt">The random number generator.</param>
    109     /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
    110     /// <param name="max">The right border (exclusive) of the interval in which the next random number
    111     /// has to lie.</param>
    112     public void AddUniform(ConstrainedDoubleData data, MersenneTwister mt, double min, double max) {
    113       for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
    114         double newValue = data.Data + mt.NextDouble() * (max - min) + min;
    115         if (IsIntegerConstrained(data)) {
    116           newValue = Math.Floor(newValue);
    117         }
    118         if (data.TrySetData(newValue)) {
    119           return;
    120         }
    121       }
    122       throw new InvalidProgramException("Couldn't find a valid value");
    123     }
    124 
    125     /// <summary>
    126     /// Adds a new int random variable being restricted to some constraints to the value of the given
    127     /// <paramref name="data"/>.
    128     /// </summary>
    129     /// <exception cref="InvalidProgramException">Thrown when no valid value could be found.</exception>
    130     /// <param name="data">The data where to add the random value and where to assign the new value to.</param>
    131     /// <param name="mt">The random number generator.</param>
    132     /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
    133     /// <param name="max">The right border (exclusive) of the interval in which the next random number
    134     /// has to lie.</param>
    135     public void AddUniform(ConstrainedIntData data, MersenneTwister mt, double min, double max) {
    136       for (int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
    137         int newValue = (int)Math.Floor(data.Data + mt.NextDouble() * (max - min) + min);
    138         if (data.TrySetData(newValue)) {
    139           return;
    140         }
    141       }
    142       throw new InvalidProgramException("Couldn't find a valid value");
    14395    }
    14496
     
    168120      data.Data = (int)Math.Floor(data.Data + mt.NextDouble() * (max - min) + min);
    169121    }
    170     private bool IsIntegerConstrained(ConstrainedDoubleData data) {
    171       foreach (IConstraint constraint in data.Constraints) {
    172         if (constraint is IsIntegerConstraint) {
    173           return true;
    174         }
    175       }
    176       return false;
    177     }
    178122  }
    179123}
  • trunk/sources/HeuristicLab.Random/3.3/UniformRandomizer.cs

    r1853 r2524  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Data;
    27 using HeuristicLab.Constraints;
    2827using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2928
     
    105104      if (value is DoubleData)
    106105        RandomizeUniform((DoubleData)value, mt, min, max);
    107       else if (value is ConstrainedDoubleData)
    108         RandomizeUniform((ConstrainedDoubleData)value, mt, min, max);
    109106      else if (value is IntData)
    110107        RandomizeUniform((IntData)value, mt, min, max);
    111       else if (value is ConstrainedIntData)
    112         RandomizeUniform((ConstrainedIntData)value, mt, min, max);
    113108      else throw new ArgumentException("Can't handle type " + value.GetType().Name);
    114109    }
     
    137132        data.Data = (int)Math.Floor(mt.NextDouble() * (max - min) + min);
    138133      }
    139 
    140       /// <summary>
    141       /// Generates a new double random number, being restricted to some constraints.
    142       /// </summary>
    143       /// <exception cref="InvalidOperationException">Thrown when no valid value could be found.</exception>
    144       /// <param name="data">The double object which the new value is assigned to and whose constraints
    145       /// must be fulfilled.</param>
    146       /// <param name="mt">The random number generator.</param>
    147       /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
    148       /// <param name="max">The right border (exclusive) of the interval in which the next random number
    149       /// has to lie.</param>
    150       public void RandomizeUniform(ConstrainedDoubleData data, MersenneTwister mt, double min, double max) {
    151         for(int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
    152           double r = mt.NextDouble() * (max - min) + min;
    153           if(IsIntegerConstrained(data)) {
    154             r = Math.Floor(r);
    155           }
    156           if(data.TrySetData(r)) {
    157             return;
    158           }
    159         }
    160         throw new InvalidOperationException("Couldn't find a valid value");
    161       }
    162       /// <summary>
    163       /// Generates a new int random number, being restricted to some constraints.
    164       /// </summary>
    165       /// <exception cref="InvalidOperationException">Thrown when no valid value could be found.</exception>
    166       /// <param name="data">The int object which the new value is assigned to and whose constraints
    167       /// must be fulfilled.</param>
    168       /// <param name="mt">The random number generator.</param>
    169       /// <param name="min">The left border of the interval in which the next random number has to lie.</param>
    170       /// <param name="max">The right border (exclusive) of the interval in which the next random number
    171       /// has to lie.</param>
    172       public void RandomizeUniform(ConstrainedIntData data, MersenneTwister mt, double min, double max) {
    173         for(int tries = MAX_NUMBER_OF_TRIES; tries >= 0; tries--) {
    174           int r = (int)Math.Floor(mt.NextDouble() * (max - min) + min);
    175           if(data.TrySetData(r)) {
    176             return;
    177           }
    178         }
    179         throw new InvalidOperationException("Couldn't find a valid value");
    180       }
    181 
    182       private bool IsIntegerConstrained(ConstrainedDoubleData data) {
    183         foreach(IConstraint constraint in data.Constraints) {
    184           if(constraint is IsIntegerConstraint) {
    185             return true;
    186           }
    187         }
    188         return false;
    189       }
    190134    }
    191135}
  • trunk/sources/HeuristicLab.SGA/3.3/HeuristicLab.SGA-3.3.csproj

    r2520 r2524  
    9999      <Name>HeuristicLab.Common-3.2</Name>
    100100    </ProjectReference>
    101     <ProjectReference Include="..\..\HeuristicLab.Constraints\3.3\HeuristicLab.Constraints-3.3.csproj">
    102       <Project>{19C1E42A-4B48-4EFD-B697-899016F1C198}</Project>
    103       <Name>HeuristicLab.Constraints-3.3</Name>
    104     </ProjectReference>
    105101    <ProjectReference Include="..\..\HeuristicLab.Core.Views\3.3\HeuristicLab.Core.Views-3.3.csproj">
    106102      <Project>{E226881D-315F-423D-B419-A766FE0D8685}</Project>
Note: See TracChangeset for help on using the changeset viewer.