Info: Apologies in advance as im not sure if my explanation will be sufficient. Im trying to get my head around how a genetic algorithm would be written. Below explanation is the general part im not sure about which someone with a reasonable amount of c# experience should be able to answer as its not GA specific knowledge.
Question:
I need to write a method (Manager_Method) whose main purpose is to pass in different combination of parameters to a second method (Computation_Method) which, using those input values, returns a result.
The tricky part comes with the fact that Manager_Method needs to be able to determine what parameters are required for the selected Computation_Method (There will be several Computation_Methods each with a different number/type of inputs).
So im wondering if someone knows of some slick way that to get around this, bar having to hard code in to an array, what the inputs are for each Computation_Method. Which would require a recompile each time i added a new Computation_Method.
Thanks in advance.
Edit: XML might be an idea. The thing im trying to get away from is hard coding in the parameters. What im trying to avoid is recompiling in the event i added a new Computation_Method AND also somehow get allow the Manager method to know what parameters are required for each Computation_Method. I figured there would be some way of doing this.
Not sure I understand your question but looks like you can use Reflection here. In particular MethodInfo class and its GetParameters method. Here is how I would do it: