A novel method is introduced in this study to consider flexibility taking into account both system design and operation strategy by using fuzzy logic. A stochastic optimization algorithm is introduced to optimize the system design and operation strategy of the energy system while considering the flexibility. GPU (Graphics Processing Unit)-accelerated computing is introduced to speed up the computation process when computing the expected values of the objective functions considering a pool up to 5832 scenarios. Subsequently, a Pareto optimization is conducted considering Net Present Value (NPV), Grid Integration (GI) level (which represents the autonomy level of the energy system) and system flexibility. The case study assesses an energy system design problem for the city of Lund in Sweden. According to the obtained NPV and GI Pareto front, a renewable energy penetration level covering more than 45% of the annual demand of the energy hub (an integrated energy system consisting of wind turbines, solar PV panels, internal combustion generator and a battery bank) can be achieved. However, the flexibility of the system notably decreases when the renewable energy penetration level exceeds above 30%. Furthermore, the results show that poor system flexibility notably increases the risk of higher-loss of load probability and operation cost. It is also shown that the utility grid acts as a virtual storage when integrating renewable energy sources. In this context, a grid dependency level of 25-30% (of the annual energy demand) is sufficient while reaching a renewable energy penetration level of 30% and maintaining the system flexibility.