Changeset 1153 for trunk/sources/HeuristicLab.SGA/SGA.cs
- Timestamp:
- 01/16/09 11:24:03 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.SGA/SGA.cs
r65 r1153 33 33 34 34 namespace HeuristicLab.SGA { 35 /// <summary> 36 /// Class for the heuristic optimization technique "simple genetic algorithm". 37 /// </summary> 35 38 public class SGA : ItemBase, IEditable { 36 39 #region Create Operators 40 /// <summary> 41 /// Creates operators for the current instance. 42 /// </summary> 43 /// <param name="engine">The engine where to add the operators.</param> 37 44 public static void Create(IEngine engine) { 38 45 engine.OperatorGraph.Clear(); … … 355 362 #region Properties 356 363 private IEngine myEngine; 364 /// <summary> 365 /// Gets the engine of the current instance. 366 /// </summary> 357 367 public IEngine Engine { 358 368 get { return myEngine; } 359 369 } 360 370 private BoolData mySetSeedRandomly; 371 /// <summary> 372 /// Gets or sets the flag whether to set the seed randomly or not. 373 /// </summary> 361 374 public bool SetSeedRandomly { 362 375 get { return mySetSeedRandomly.Data; } … … 364 377 } 365 378 private IntData mySeed; 379 /// <summary> 380 /// Gets or sets the value of the seed of the current instance. 381 /// </summary> 366 382 public int Seed { 367 383 get { return mySeed.Data; } … … 370 386 private IntData myPopulationSize; 371 387 private IntData myParents; 388 /// <summary> 389 /// Gets or sets the population size of the current instance. 390 /// </summary> 391 /// <remarks>The number of parents is set to two times the population size.</remarks> 372 392 public int PopulationSize { 373 393 get { return myPopulationSize.Data; } … … 378 398 } 379 399 private IntData myMaximumGenerations; 400 /// <summary> 401 /// Gets or sets the number of maximum generations. 402 /// </summary> 380 403 public int MaximumGenerations { 381 404 get { return myMaximumGenerations.Data; } … … 383 406 } 384 407 private DoubleData myMutationRate; 408 /// <summary> 409 /// Gets or sets the mutation rate of the current instance. 410 /// </summary> 385 411 public double MutationRate { 386 412 get { return myMutationRate.Data; } … … 388 414 } 389 415 private IntData myElites; 416 /// <summary> 417 /// Gets or sets the elites of the current instance. 418 /// </summary> 390 419 public int Elites { 391 420 get { return myElites.Data; } … … 394 423 private CombinedOperator mySGA; 395 424 private IOperator myVariableInjection; 425 /// <summary> 426 /// Gets or sets the problem injector of the current instance. 427 /// </summary> 396 428 public IOperator ProblemInjector { 397 429 get { return myVariableInjection.SubOperators[0]; } … … 404 436 } 405 437 private IOperator myPopulationInitialization; 438 /// <summary> 439 /// Gets or sets the solution generator of the current instance. 440 /// </summary> 406 441 public IOperator SolutionGenerator { 407 442 get { return myPopulationInitialization.SubOperators[0]; } … … 413 448 } 414 449 } 450 /// <summary> 451 /// Gets or sets the evaluator of the current instance. 452 /// </summary> 415 453 public IOperator Evaluator { 416 454 get { return myPopulationInitialization.SubOperators[1]; } … … 424 462 } 425 463 private IOperator mySGAMain; 464 /// <summary> 465 /// Gets or sets the selection operator of the current instance. 466 /// </summary> 426 467 public IOperator Selector { 427 468 get { return mySGAMain.SubOperators[0]; } … … 433 474 } 434 475 } 476 /// <summary> 477 /// Gets or sets the crossover operator of the current instance. 478 /// </summary> 435 479 public IOperator Crossover { 436 480 get { return mySGAMain.SubOperators[1]; } … … 442 486 } 443 487 } 488 /// <summary> 489 /// Gets or sets the mutation operator of the current instance. 490 /// </summary> 444 491 public IOperator Mutator { 445 492 get { return mySGAMain.SubOperators[2]; } … … 453 500 #endregion 454 501 502 /// <summary> 503 /// Initializes a new instance of <see cref="SGA"/>. 504 /// </summary> 455 505 public SGA() { 456 506 myEngine = new SequentialEngine.SequentialEngine(); … … 459 509 } 460 510 511 /// <summary> 512 /// Creates a new instance of the <see cref="SGAEditor"/> class. 513 /// </summary> 514 /// <returns>The created instance of the <see cref="SGAEditor"/>.</returns> 461 515 public override IView CreateView() { 462 516 return new SGAEditor(this); 463 517 } 518 /// <summary> 519 /// Creates a new instance of the <see cref="SGAEditor"/> class. 520 /// </summary> 521 /// <returns>The created instance of the <see cref="SGAEditor"/>.</returns> 464 522 public virtual IEditor CreateEditor() { 465 523 return new SGAEditor(this); 466 524 } 467 525 526 /// <summary> 527 /// Clones the current instance (deep clone). 528 /// </summary> 529 /// <remarks>Deep clone through <see cref="Auxiliary.Clone"/> method of helper class 530 /// <see cref="Auxiliary"/>.</remarks> 531 /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param> 532 /// <returns>The cloned object as <see cref="SGA"/>.</returns> 468 533 public override object Clone(IDictionary<Guid, object> clonedObjects) { 469 534 SGA clone = new SGA(); … … 506 571 507 572 #region Persistence Methods 573 /// <summary> 574 /// Saves the current instance as <see cref="XmlNode"/> in the specified <paramref name="document"/>. 575 /// </summary> 576 /// <remarks>The engine of the current instance is saved as a child node with the tag name 577 /// <c>Engine</c>.</remarks> 578 /// <param name="name">The (tag)name of the <see cref="XmlNode"/>.</param> 579 /// <param name="document">The <see cref="XmlDocument"/> where the data is saved.</param> 580 /// <param name="persistedObjects">A dictionary of all already persisted objects. (Needed to avoid cycles.)</param> 581 /// <returns>The saved <see cref="XmlNode"/>.</returns> 508 582 public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) { 509 583 XmlNode node = base.GetXmlNode(name, document, persistedObjects); … … 511 585 return node; 512 586 } 587 /// <summary> 588 /// Loads the persisted instance from the specified <paramref name="node"/>. 589 /// </summary> 590 /// <remarks>The elements of the current instance must be saved in a special way, see 591 /// <see cref="GetXmlNode"/>.</remarks> 592 /// <param name="node">The <see cref="XmlNode"/> where the instance is saved.</param> 593 /// <param name="restoredObjects">The dictionary of all already restored objects. (Needed to avoid cycles.)</param> 513 594 public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) { 514 595 base.Populate(node, restoredObjects);
Note: See TracChangeset
for help on using the changeset viewer.