AbstractObtaining high crop yields with limited water consumption requires optimal irrigation strategies based on comprehensive studies of the parameters of plant–environment interactions. Here, we used a structural equation modelling (SEM) to assess the relationships among input irrigation factors and moderate factors to find an optimum water use efficiency (WUE) response factor, for outdoor and greenhouse cultivation of eggplant (Solanum melongena). The input irrigation factors (including irrigation interval, water salinity and environment) and the moderate factors (evapotranspiration, soil salinity, plant parameters, fruit parameters and crop yield) were used in water cycle algorithm (WCA) and genetic algorithm (GA) methods to optimize the water use efficiency. The optimization process included finding the best combination of irrigation factors and optimized eggplant cultivation. The structural equation modelling results indicate that irrigation interval negatively affected water use efficiency with a more dominant effect on plant parameters. Water salinity negatively affected the water use efficiency with a more dominant effect on soil salinity, crop yield and fruit parameters. Low salinity water was more effective than full irrigation to optimize the water use efficiency. The water cycle algorithm revealed that for outdoor cultivation, the optimal range of irrigation interval was 2–5 days and water salinity in the range of 0.8–2.2 ds/m. These factors optimized evapotranspiration (346.23–738.19 mm), soil salinity (4.16–9.45 ds/m), fruit parameters (33.81–35.12 cm) and crop yield (1715.7–2190.8 g/plant), as well as increasing the water use efficiency (3.08–4.89 g/(plant‐mm)). Both the water cycle algorithm and genetic algorithm yielded very close to optimal values. Two years of repeated experiments and the closeness of the optimal values using the algorithms confirmed that the optimal amounts are reliable.