Changeset 3125
- Timestamp:
- 03/19/10 16:22:26 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Knapsack/3.3/Knapsack.cs
r3124 r3125 138 138 #endregion 139 139 140 private void InitializeRandomKnapsackInstance() { 141 System.Random rand = new System.Random(); 142 143 int itemCount = rand.Next(10, 100); 144 int capacity = itemCount * 5; 145 146 KnapsackCapacity = new IntValue(capacity); 147 Weights = new IntArray(itemCount); 148 Values = new IntArray(itemCount); 149 150 for (int i = 0; i < itemCount; i++ ) { 151 int value = rand.Next(1, 10); 152 int weight = rand.Next(1, 10); 153 154 Values[i] = value; 155 Weights[i] = weight; 156 } 157 } 158 140 159 public Knapsack() 141 160 : base() { … … 155 174 creator.BinaryVectorParameter.ActualName = "KnapsackSolution"; 156 175 evaluator.QualityParameter.ActualName = "NumberOfOnes"; 176 177 InitializeRandomKnapsackInstance(); 178 157 179 ParameterizeSolutionCreator(); 158 180 ParameterizeEvaluator();
Note: See TracChangeset
for help on using the changeset viewer.