Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how well structuring an input file ( by pointers ?)

Status
Not open for further replies.

albi73

Programmer
Sep 16, 2010
18
IT
Hi guys,
i'm breaking my head with a problem that i'm not able to solve!; I have a doubt it could be easier than it seems, but i can't find the way

i'm developing an user interface for a genetic algorithm.
In this GA there are some genes, that pilot an external code. Up today I've changed the genes on which I'd like to work by changing the souce ( a very inefficient way!).

let me try to sketch the problem:

There is an external code ( AA) with many variables that could be all good genes; for example:
E_field(1:4), B_field(1:4), coil_position(1:4) etc.

AA charge these variable by using namelist recorded on the file AA.ini :
&Fields
E_field= 120,125,130,121 /
ect.

I don't want decide before what will be the number of genes and what they will be. I could decide to use only three genes E_field(1:2) and B_field(1) for on optimization or other differents configurations.

solution:
I think the key of the problem could be to define the array genes(1:N) like an array of pointers and then change the variable (target). BUT ...
how can I change the targhet when the code is compiled'

if gene1 => E_field(1) ... how can i change the target without change the code?

please where have i lost my head? :)

ciao, Albi








 
You could input the indices of the genes you wish to use
Code:
&fields
ix1=1
ix2=3
ix3=4
...
/
Then just use
Code:
if (ix1 .gt. 0) gene1 => E_field(ix1)
...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top