# How to Define Decision variable in EMT for GA?

Hi every one
I want to create a scenario using a genetic algorithm to inject contamination into the network. But I do not know how to define the decision variables that include the location and time of the injection. I just got acquainted with EMT. please guide me.
regard

1 Like

Salam
You have to define the problem in ga algorithm using constraints. Fitness function will be calculated from epanet output in another .m file you call. Explain your problem for more help.

1 Like

I want to create contamination injection scenarios into the water distribution network using a genetic algorithm and find the node that generates the most concentration as contamination in the network (actually a function of this goal). I want to consider the decision variable as the location of the node and the time of injection into the network, but I do not know how to define this decision variable. And the constraints are the number of nodes!
And I want to use MATLAB toolbox (GA).
I know that the function must be defined in a separate M file, and I know how to call the epant and MSX files, but I do not know how to define the decision variable I described.
thanks for yotr attention.

1 Like

Salam dobare,
Your problem is with defining ga algorithm to fit your project and not with EPANET. Your best solution is to first define the potential injection nodes and times, and then use INTCON from ga to generate for example two integers that are indices of potential nodes and times. This could also be done using INTCON and binary programming in ga. But i suppose you wouldn`t need ga optimization for the mentioned project. You can do a Monte Carlo Simulation on potential scenarios or simply build your potential scenario matrix (which constitutes from injection time, node , mass and etc) and use epanet quality/msx quality analysis in a loop to find the concentrations related to each scenario then you can sort the potential scenarios using average concentrations in descending order and choose them accordingly.
Omidvaram be dardet khorde bashe

2 Likes

Hi
your project is very easy. like a simple optimization problem you should to create a function for your problem (define decision variables, constraints, objective …) in a separate m file than use GA or other algorithms to solve it (optimization problem). when you are using a scenario based-approach you can generate the samples (demand, contamination, injection or …) based on MCS and call the samples in duration of optimization (for first time).

Regards

1 Like

@mosi2x
kheili mamnoon az rahnamaitoon.
من خیلی درگیر این مسئله م که چطوری متغیر تصمیم رو تعریف بکنم.
و باید این این کار رو با الگوریتم انجام بدم.
بازم ممنون

1 Like

@Jafariasl