|
|
I want to use Roulette wheel selection for function minimization and want to select parents for reproduction from the fitness values. I want to ask is this necessary to sort the fitness (in ascending or descending order) values calculated from the population size or not?
|
|
|
|
|
You can use random number generation to simulate roulette wheel output.
Try something and post your code here.
|
|
|
|
|
You may want to read up on "Roulette Wheel Selection[^]" before you stick your foot in your mouth again.
modified 24-Oct-13 12:33pm.
|
|
|
|
|
Weird - but the link is not working?
|
|
|
|
|
*Cough* ahem[^]. I assume you ate the rest of the foot
|
|
|
|
|
Hmmm... It pasted back into a browser window just fine before I pasted it into the post.
Fixed!
|
|
|
|
|
In the book I'm studying and the articles at MSDN, they both say pretty much the same thing…
Just to clarify, in my book it uses this example:
Parent Class
{
}
Child Class
{
}
Grandchild Class
{
}
GreatGrandchild Class
{
}
The Base Class for Great-Grandchild Class would be the Grandchild Class
The Base Class for The Grandchild Class Would Be the Child Class
The Base Class for the Child Class Would Be the Parent Class
If that is true, in both my book and the articles at MSDN also say if I want to call a method that resides in the parent class from great-grandchild class to use the "base" keyword before the method…
Just a little confusing, maybe I read it wrong and misunderstood it.
Any feedback would be greatly appreciated.
|
|
|
|
|
You are right in your assumptions.
Just to correct your code a little bit though -
Parent Class
{
}
Child Class : Parent
{
}
Grandchild Class : Child
{
}
GreatGrandchild Class : Grandchild
{
}
|
|
|
|
|
First of all, you need a method or property which is declared "virtual". That allows you to "override" it in derived classes.
When you override such a virtual function, but need to call the functionality of the original implementation also, you use the base keyword:
public class Parent
{
public virtual void FunctionOne()
{
}
}
...
public class GreatGrandChild : GrandChild
{
public override void FunctionOne()
{
Console.WriteLine("Called in GreatGrandChild");
base.FunctionOne();
}
}
Otherwise, you can access the functions of the base which are not overriden just like any other function of a class, and beyond that you can access "protected" functions/properties.
|
|
|
|
|
Yes, That's Obvious… Or so I thought it was.
|
|
|
|
|
I wanted to create a application in which there will be 10 to 12 users(clients) and database at one place(server).
My Qs is how to create this kind of application and what technology should I use between these..Windows ? or Web based ?.
Pls tell me how to implement this kind of app.
Pls give links to sample application if anyone knows..
thanks in advance.
|
|
|
|
|
What you are really looking at here is usually known as a client-server application. The database will be placed on the server and the client will reside, well on the client. There are many different ways you can partition your application; for instance, you could partition it so that using MVC and an n-tier architecture.
As to what type of app you should write - that really depends. If you need to interact with the local file system, I'd go with a desktop based approach. If everything could be handled through a browser, then I would go with a web based architecture. Only you know your requirements.
|
|
|
|
|
Thanks for ur quick reply.
Everything can be handled through browser. so I think I will go with web based application.
Can you provide some links on these kind of applications or a small sample ?
|
|
|
|
|
Here is a MVC4[^] implementation but I wouldn't use EF.
Edit I forgot to add the link.
Edit 2 Link paste bug.
David
|
|
|
|
|
See this[^] step-by-step tutorial.
/ravi
|
|
|
|
|
Pdeveloper wrote: Windows ? or Web based ?.
What is your client looking for?
Are they ok if you install the client on their local machines.
|
|
|
|
|
I have "bought into" the view that programmers in WinForms should not put a Form inside a Form. My reasoning has gone something like this: [1]
1. A Form is a "heavy-weight" object; using "lighter-weight" objects. like a Panel on the Form, a UserControl (for re-usability), or other ContainerControl(s) on the Form, is better practice. And, I believe the idea of using a TabControl to implement a multi-document work-space is a good one.
2. A Form within a Form (if it is movable: that is, if it has a TitleBar) can easily be moved at run-time so almost all of it is "outside" its Parent Form. It's actually possible to "lose track," visually, of a Form within a Form if: you do "just the wrong thing" while the outer Form is Maximized, and then set the Form WindowState back to 'Normal. Of course, the programmer, can easily write code to control for such cases.
3. Particularly for newcomers to programming in WinForms, putting a Form in a Form is "bad practice" that leads to programming errors, hair growing on the palms, etc.
If I consider what, if any, advantages there might be to using a Form within a Form, I find it hard to come up with anything tangible. Using multiple independent windows (Forms) in an app: yes, I can see that (and I write apps that way); each Form can have its own Opacity value, for example. And, the programmer, with a small amount of effort, can implement docking of the independent Forms to their "main Form," or other Forms, etc.
Based on the belief that questioning one's technical assumptions (frequently) is a healthy thing to do, I'm curious to ask you, my peers, and betters, what you think about putting Forms inside Forms:
1. is it something you do yourself in your own practice (in situations you are not using MDI) ?
2. is it a very "bad thing" in terms of consuming resources (like memory) compared other possible containers ? Does it diminish performance ?
3. do you think it is a mistake for beginning programmers to use Forms inside Forms ?
all-ears, bill
[1] I've left MDI out of this discussion, even though CP is still getting questions on MDI: questions from people working with/on legacy apps; and, questions that I believe are coming from students who are assigned to create an MDI app in their classes. I go along with the view that MDI is outmoded, and read that MS has "deprecated" it. Bias: I find MDI apps butt-ugly.
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
I must say I have never placed a form inside another form and can see no reason to do so - none of the situations I have ever found myself in have needed this.
So it would be interesting to hear about its benefits, if there are any(I think it would just mess my head up trying to debug that sort to of scenario).
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
I'm just a newbie to C#, but… I'm just starting to read about and understand some of, Polymorphism… Whatever methods you have in your main class, you could change them to virtual methods then by using inheritance… The methods in your child classes could use override.
Like I said, I'm just a newbie… But, just a thought.
|
|
|
|
|
- No, sounds like a bad idea.
- I would say yes it's a bad thing, but I have never tested it to see the effect on resources/performance.
- Certainly, they do enough bad things as it is.
Veni, vidi, abiit domum
|
|
|
|
|
BillWoodruff wrote: And, I believe the idea of using a TabControl to implement a multi-document work-space is a good one. I believe that different users are attracted to different MDI implementations.
BillWoodruff wrote: A Form is a "heavy-weight" object; using "lighter-weight" objects. Not by definition; an application is a Window, just like a button is a Window. One can set a new parent, and could choose to set the apps' parent to a button.
BillWoodruff wrote: If I consider what, if any, advantages there might be to using a Form within a Form, I find it hard to come up with anything tangible. Encapsulation and re-use.
BillWoodruff wrote: is it something you do yourself in your own practice (in situations you are not using MDI) ? I sometimes use a complete executable as described above; that's heavier than declaring a thread, but also robuster
BillWoodruff wrote: is it a very "bad thing" in terms of consuming resources (like memory) compared other possible containers ? Does it diminish performance ? How much more resources does a Form use compared to a Panel? Yes, it costs performance, the question should be whether it's "expensive". If you're looking for optimal performance, then you should not be creating a window using a managed language.
BillWoodruff wrote: 3. do you think it is a mistake for beginning programmers to use Forms inside Forms ? I think it's a mistake to make it a black-and-white decision, without any context. The only thing that's "always" wrong is to swallow exceptions.
BillWoodruff wrote: Bias: I find MDI apps butt-ugly. ..yes, most important thing about the car is the color - not whether it's an efficient design.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: an application is a Window, just like a button is a Window. I'm not sure what you meant to say. A Form is a ContainerControl , while a Button is a ButtonBase .
/ravi
|
|
|
|
|
On the WinAPI level, they're all just Windows.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks, Eddy, I hoped someone would respond who would advocate the position that it's okay to put Forms in Forms, or, at least, okay in some circumstances.
I do not understand this statement: "One can set a new parent, and could choose to set the apps' parent to a button," but it's provocative in a fascinating way: would you care to give an example of why you would implement this, and how you would use this type of relationship ?
I also fail to see how using a Form within a Form inherently promotes "Encapsulation and re-use" in a way that a Form that is not contained in another Form does not.
I also believe, but have not verified through any formal analysis, that if you had an Application whose Main Form contained many other Forms, and the Opacity properties of the Main Form, and contained Forms, were different, that you could well have a significant performance hit depending on your memory, CPU, GPU, etc.
I adhere to William of Occam's idea (Occam's Razor, Latin: lex parsimoniae) that parsimony in design is a very good thing: why use a Form instead of a Panel or other ContainerControl unless using the Form provides some significant functionality the Panel does not ?
Using a Form within a Form in WinForms means you sacrifice the ability to do design-time layout of the Form's position in its containing Form.
Another thing a Form in a Form offers is ... if it has a TitleBar ... instant movability, but WinForms provides no "easy" way to constrain a contained Form's location in its Parent Form.
I look at an Application (in WinForms) as a "totality" that includes Objects that have Windows, Forms, UserControls, other Controls with UI's, etc., and other Objects that do not have Windows: Classes, Enumerations, Structs, Interfaces, etc.
While you are free to dismiss my bias against MDI architecture with the ad hominem argument that it's a "skin deep" point-of-view on my part, I assert that MDI architecture has the effect of diminished productivity compared to other multi-window management strategies, and I do not believe there's any inherent "efficiency" in MDI compared to managing multi-documents with a Tabbed UI (TDI).
It is interesting to review the current state of window management of many of the most widely used Applications: [^]. It's a "mixed-bag," as you might expect. But, a trend away from MDI seems apparent ... the "kicker" being that if you regard a tabbed multi-window management application as a form of MDI: well, then MDI is going strong.
I suspect one thing you and I could completely agree on would be the idea that one cannot make any absolute rule about application design
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|