Skip to main content

Hybrid approach based on particle swarm optimization for electricity markets participation


In many large-scale and time-consuming problems, the application of metaheuristics becomes essential, since these methods enable achieving very close solutions to the exact one in a much shorter time. In this work, we address the problem of portfolio optimization applied to electricity markets negotiation. As in a market environment, decision-making is carried out in very short times, the application of the metaheuristics is necessary. This work proposes a Hybrid model, combining a simplified exact resolution of the method, as a means to obtain the initial solution for a Particle Swarm Optimization (PSO) approach. Results show that the presented approach is able to obtain better results in the metaheuristic search process.


This paper is an extension of work originally presented in 2017 IEEE SSCI (Faia et al. 2017).

Traditionally, existing methods for analyzing electrical systems focus on centralized solutions (Foley et al. 2010) and, to a certain extent, are based on obsolete assumptions. With the new Smart Grid (SG) paradigm, innovation and new methods (or adaptations of the existing ones) are required to study the electrical system to have adequate decision support. In this dynamic context, thanks to SGs technologies, the appearance of new actors and roles is becoming more relevant and is leading to new operational procedures. One of the most debated and targeted cases is the role of Virtual Power Players (VPP), which combine consumers, energy storage systems (ESS) and generators at a local level. In (Burger et al. 2017), it is possible to find a review on the role of VPPs in the current electric system. This type of entity in SGs allows for electric and economic transactions in the so-called local electricity markets, as well as micro-markets in some studies (Olivella-Rosell et al. 2018).

The diversity of market models and opportunities that have been arising in recent years force the involved players to look for solutions to help them manage their investments and negotiation strategies. Considering the MIBEL market (MIBEL 2007), the time for players to act (submit their bids) may depend on the market models. In the Spot market model, all players must submit it 1 h before the start of the market (e.g., in day-ahead market, the cycle starts at 12 am and the bids for the next 24 h must be submitted until 11 am). In the Balancing market model there are six sessions per day, and in each session the players must also submit their bids 1 h before its start. In this way, to submit their bids, the players have to do it from the end of the last session to 1 h before the start of the next session. In the real-time markets model, which is the case of PJM Energy Market (PJM 2018) it is repeated every 15 min, the players have 15 min to present their bids. The time of actuation in this market is much smaller considering the times of Spot and Balancing markets in the MIBEL market. A crucial point is deciding in which markets to participate in each moment and what amount of energy to negotiate. This problem is commonly known in economics and finance as the portfolio optimization problem (Markowitz 1952).

The resolution of the portfolio optimization problem in electricity markets using metaheuristics has been much explored since the metaheuristics usually manage to arrive at a solution very close to the optimum in a short time in a short time. In this type of problems, the time is critical because the decisions have to be fast enough for the user to have time to plan until the decision is taken. On the other hand, metaheuristics have a random nature, which presents variability in the results, which means that sometimes these results can be far from the best solution. This is a gap that we address in this paper, by proposing a hybrid metaheuristic approach that decreases the variance of the results when compared with other metaheuristics.

Metaheuristic approaches are especially useful for reaching good solutions for massive computational problems in fast execution times. This is especially relevant when solving real-world problems, in which the decision time is a relevant decision factor. The participation in electricity markets is one of these problems due to the significant changes during the last decades (Meeus and Belmans 2008). Before the liberalization of electricity markets, the system operator considered demand to be fixed and scheduled operation plans based on generation resources. This made electricity negotiations highly restricted, mostly due to the fact that much of the produced energy came from fully controllable generation sources.

The recent energy policy has favored a massive introduction of renewable energy sources on electricity markets, which has greatly impacted their penetration in power systems (European Commission 2013). The intermittent nature of renewable energy had a very large impact on the way the negotiations operated since the energy supply directly influences the market prices. At the market level, the competition has increased, bringing a higher number of sellers to participate (Yoo et al. 2017). This also leads to the emergence of aggregators to represent (and even manage) groups of small player (Vale et al. 2011a), in order to increase their impact on the market. A market dimension is also being introduced into retail markets, in order to motivate consumers to change their passive attitudes. The wide-scale rollout of smart metering infrastructure is now creating the means to enable consumers to participate in competitive retail markets by overcoming the lack of infrastructure that enables sending market signals to and from consumers (Palensky and Dietrich 2011).

With the increase in competitiveness in electricity markets (Ciarreta et al. 2017), caused by the increase of energy producers (in particular renewables), there is an increasing need for tools that can provide support to electricity market participants. Multi-Agent Simulator of Competitive Electricity Markets (MASCEM) (Vale et al. 2011b) is integrated with a decision support system that aims at providing market players with suitable suggestions on which actions should be performed at each time and in different contexts of negotiation. This system is Adaptive Decision Support for Electricity Markets Negotiations (AiD-EM). AiD-EM is itself composed of several distinct decision support systems, directed to the negotiation in different EM types; e.g., Adaptive Learning Strategic Bidding System (ALBidS) (Pinto et al. 2015).

After this introduction, section 2 presents an overview of the related work the field, and section 3 presents the mathematical formulation of the addressed problem. Section 4 details the proposed hybrid model based on particle swarm optimization methodology. Section 5 shows the results of the case study, and finally, section 6 presents the most relevant conclusions of this work.

Related work

Markowitz proposed the Markowitz Portfolio Selection Theory in (Markowitz 1952). This theory enables combining assets in such a way that the resulting portfolio is characterized by a higher return to risk ratio, when compared to that provided by every single asset by itself, an effect known as diversification; i.e., the more diversified the portfolio, the lower risk level.

The concepts of portfolio optimization and diversification are instrumental in the development and understanding of financial markets and financial decision making. However, in the last years, the theory of portfolios has been applied in the electricity markets area, with the purpose of supporting the decision making (Denton et al. 2003). Using the portfolio optimization results, market participants can obtain better market participation, by obtaining a larger profit / lower cost from their participation.

In (Pinto et al. 2015), the authors propose a portfolio optimization for multiple electricity market participation. In this methodology, the players can sell and buy electricity in several markets as well as selling the produced energy. A risk management model is also considered, but it considers that risk is originating from the prices forecasting. The prices forecasting is made through an artificial neural network (ANN) (Pinto et al. 2012) and three different values for each case are presented. These three values are considered as the risk levels. The risk is associated with the expected price because with the simulations ANN arrives in different values for the same case. The maximum, minimum and average values for all simulations are calculated, in order to feed the optimization problem. Particle Swarm Optimization (PSO) (Kennedy and Eberhart 1995) variant is used to solve the optimization problem.

In (Pinheiro Neto et al. 2017), the authors propose a methodology for risk analysis and portfolio optimization of power assets with hydro, wind and solar power. In the case of study the authors considering the Regulated Contacting Environment and the Mechanism for Reallocation of Energy Brazil.

When the execution time for reaching a solution for these problems is a relevant decision factor, metaheuristic optimization approaches are often applied. Metaheuristics can be based on (Boussaïd et al. 2013): single-solution, if they use a single starting point (e.g., local search, simulated annealing, iterated local search and tabu search) or population-based if a population search points are used (e.g., particle swarm, evolutionary algorithms, colony based optimization). Many of these approached are inspired by natural processes (e.g., evolutionary algorithms from biology or simulated annealing from physics).

In metaheuristics search there two ways to characterize the research: the exploration of the search space (diversification) and exploitation of the best-found solution (intensification). Exploration means the diversification of the search to different regions in the search space for a better sampling of the solution space. On the other hand, exploitation means the intensification of the search around some the good quality solutions in other to find an improved solution. A balance between two contradictory objectives must, therefore, be guaranteed (Mehdi 1981). When applying these strategies to the solution of any optimization problem, the main concern is to determine the algorithm capability for finding the global optimum. The desirable feature of an effective optimization method is a high successes probability for finding the global solution ate the expenses the lower computational efforts. Theoretically, it is important to remark that stochastic methods (metaheuristics) need an infinite number of objective function evaluations to guarantee the convergence of the global optimum. This number is determined by the parameters employed for controlling the search process (exploitation and exploration) and the termination criterion (Fernández-Vargas et al. 2016). There are many stopping criteria used in stochastic optimization methods: they are based on the measurement of the relative error to the known value of the global optimum, the improvement of the value of objective function for a certain number of iterations or functions evaluations, or a maximum allowable numerical effort that is defined in terms of the number of algorithm iterations or objective function evaluations.

In summary, the optimal solution cannot be guaranteed when using a metaheuristic, but a reasonably good solution is obtained without having to explore the whole solutions space, and consequently in a much shorter time when compared to resolution by exact methods. There are different metaheuristics that can be applied. These vary depending on the search heuristic method chosen to guide the search. Thus, each metaheuristic can present different results. In real-world applications, the main interest is in obtaining a good solution in a reasonable amount of time. Therefore, metaheuristic methods are highly appreciated as efficient means for dealing with real-world applications (Yusta 2009).

Mathematical formulation

The formulation presented in (1) is used to represent the optimization problem, as proposed in (Pinto et al. 2014). In (1) d represents the weekday, Nday represent the number of days, p represents the negotiation period, Nper represent the number of negotiation periods, binSM,d,p and binBm,d,p are boolean variables, indicating if this player can enter in negotiation in each market type, M represents the referred market, NM represents the number of markets. Variables PSM,d,p and PBM,d,p represent the expected (forecasted) prices of selling and buying electricity in each session of each market type, in each period of each day. The outputs are SpowM representing the amount of power to sell in market M and BpowM representing the amount of power to buy in market M.

$$ {\displaystyle \begin{array}{c}\mathit{\operatorname{Max}}(Profit)=\left(\sum \limits_{M=M1}^{NM}\left({Spow}_{M,d,p}\times {PS}_{M,d,p}\times {binS}_{M,d,p}\right)\right)\\ {}-\left(\sum \limits_{S=S1}^{NM}\left({Bpow}_{S,d,p}\times {PB}_{S,d,p}\times {binB}_{m,d,p}\right.\right)\\ {}\forall d\in Nday,\forall p\in Nper,{binS}_{M,d,p}\in \left\{0,1\right\},{binB}_{m,d,p}\in \left\{0,1\right\}\\ {}{PS}_{M,d,p}= Value{\left({Spow}_M\right)}_{M,d,p}\\ {}{PB}_{M,d,p}= Value{\left({Bpow}_M\right)}_{M,d,p}\end{array}} $$

The formulation considers the expected production of a market player for each period of each day. The price value of electricity in some markets depends on the power amount to trade. With the application of a clustering mechanism it is possible to apply a fuzzy approach to estimate the expected prices depending on the negotiated amount (Faia et al. 2016). Eq. (2) defines this condition.

$$ Value{\left({Spow}_M\ or\ {Bpow}_M\right)}_{d,p,M}=\mathrm{Data}{\left(\mathrm{fuzzy}\left(\mathrm{pow}\right)\right)}_{d,p,M} $$

Equation (3) represents the main constraint to be applied in this type of problems, and imposes that the total power that can be sold in the set of all markets is never higher than the total expect production (TEP) of the player, plus the total of purchased power (Pinto et al. 2014). Restrictions (4), (5) and (6) refer to the type of generation of the supported player.

$$ {}^{\sum \limits_{M=M1}^{NM}{Spow}_M\le TEP+\sum \limits_{S=S1}^{NM}{Bpow}_M} $$
$$ TEP=\sum {Energy}_{prod},{Energy}_{prod}\in \left\{{Renew}_{prod},{Therm}_{prod}\right\} $$
$$ 0\le {Renew}_{prod}\le {\mathit{\operatorname{Max}}}_{prod} $$
$$ {\mathit{\operatorname{Min}}}_{prod}\le {Therm}_{prod}\le {\mathit{\operatorname{Max}}}_{prod}, if\ {Therm}_{prod}>0 $$

From the presented restrictions and considerations one can see that the energy produced comes from renewable sources and non-renewable sources (thermoelectric). If the player is a producer of thermoelectric power, the production has to either be null or set at a minimum value, since it is not feasible for the production plant to work under a technical operation limit. If the player is a producer of renewable energy, the only restriction is the maximum production capacity.

Proposed hybrid approach

The methodology proposed in this work is created to solve the portfolio optimization problem. In this case two different methods are used, namely an exact resolution method and a stochastic resolution method (PSO). As it is possible to observe by Fig. 1, a simplified version of the problem optimization is done by using the exact method, using the CPLEX solver to solve the Mixed Integer Linear Programing (MILP) problem. The solution that is achieved for the simplified version of the problem is then used as initial solution for the approximate method (PSO) to be executed.

Fig. 1
figure 1

Hybrid methodology pseudo code

All the metaheuristic optimization methods require an initial solution to start the optimization process (which is often randomly generated). The role of CPLEX is to provide the initial solution for PSO to initialize the search. Usually the resolution of MILP problems, as indicated in the Fig. 1, can take along execution time, depending on the problem in hand, However, to circumvent this problem the solutions are only restricted to integers and the resolution time is quite acceptable (the comparison can be consulted in the case study presented in section V).

As can be followed by Fig. 1, after performing the optimization by CPLEX, the iterative search process, the PSO, is started. In the first step, the initial solution is created so that the PSO method starts its search. Different variants are experimented and compared in the case study of section V for the creation of the initial solution, but all based on the solution from CPLEX.

The PSO algorithm does not guarantee the optimal global solution. Generally, the search is stopped when the stopping criteria are reached. At each iteration, PSO applies Eq. (7) and Eq. (8). During the iterations of the algorithm, each particle of PSO moves in the space with a velocity that is dynamically adjusted (different in each iteration). The velocity determines particles’ positions according to their own and their neighboring-particles experiences, thus moving two points in each iteration: (i) the best position found so far by itself, called Pbest; and (ii) the best position of all neighbor particles, called Gbest (Denton et al. 2003).

$$ {v}_{id}^{k+1}=w.{v}_{id}^k+{c}_1.{r}_1^k.\left({Pbest}_{id}^k-{x}_{id}^k\right)+{c}_2.{r}_2^k.\left({Gbest}_{id}^k-{x}_{id}^k\right) $$
$$ {x}_{id}^{k+1}={x}_{id}^k+{v}_{id}^{k+1} $$


  • \( {\boldsymbol{v}}_{\boldsymbol{id}}^{\boldsymbol{k}} \)- velocity of particle i, parameter d and iteration k,

  • \( {\boldsymbol{x}}_{\boldsymbol{id}}^{\boldsymbol{k}} \)- position of particle i, parameter d and iteration k,

  • k- iteration,

  • Pbest- personal best,

  • Gbest- global best,

  • w - inertia term,

  • c1 – local attraction term.

  • c2 - global attraction term.

  • r1,r2- random numbers between [0,1].

Afterwards, Eq. (7) and (8) are applied to find new positions for each particle, and the fitness is calculated by using the objective function, Eq. (1). The next step is to update the best individual positions (Pbesti) if the current position of a particle is the best found so far by that particle. Pbest is also compared to the best global position (Gbest). If Pbesti is better than Gbest, Gbest is also updated to the new position.

Considering that the PSO performs its search based on parameters, for the parameter of inertia, has been defined that adaptive inertia will be used, Eq. (9).

$$ {w}_k^v=1.1-\frac{Gbest}{average\left( Pbes{t}_v\right)} $$

The adaptive inertia weight tries to adapt the value of inertia based on parameters that provide status information of where the particles are in the search space at each time, the inertia weight value in Eq. (9) is different for each variable, taking into account the global best position and the value of each specific variable in the personal best position of each particle (Arumugam and Rao 2008; Faia et al. 2018)

Case study

This section presents the case study that illustrates the application of the proposed methodology. All simulations were executed on a computer with 1 processor Intel® w3565 3.2GHz, with 4 Cores, 8 GB of RAM and operating system Windows 10 of 64 bits As has been previously started, the PSO algorithm starts with an initial solution based on the CPLEX resolution. In this scenario, five different markets type has been considered. The considered markets are the day-ahead spot market, negotiations by means of bilateral contacts, the balancing or intra-day market, and a local market, at the Smart-Grid (SG) level.

The balancing market is divided into different sessions. In the day-ahead spot market, the player (acting as a seller) is only allowed to sell electricity, while in the other market types the player can either buy or sell depending on the expected prices. Limits have also been imposed on the possible amount of negotiation in each market. In this case, it is only possible to buy up to 10 MW in each market in each period of negotiation, which makes a total of 40 MW purchased. It is possible to sell power on any market, and it can be transacted as a whole or in installments. The player has 10 MW of own production (TEP) for sale.

Table 1 shows the initial solution achieved by the CPLEX method. For this resolution, the Tomlab toolbox of MATLAB® has been used. CPLEX2 represents the version of the CPLEX resolution used to generate the initial solution. In this case, the variables that constitute the solution are only positive integer values; this particularity greatly simplifies the method, enabling it to solve the problem in short execution time. Table 2 CPLEX1 represents the complete version of CPLEX resolution (when the variables of the solution can be positive rational numbers), which leads to high execution times.

Table 1 Cplex result for initial solution
Table 2 Objective function results (€)

Table 1 presents the optimized variables, assuming only integer values; this configuration of the solution allows to obtain an objective function value present in Table 2. In the Spot market, 14 MW is sold, 12 MW by means of bilateral contracts and 9 MW in SG, in the variables that represent the purchase can see that in the balance markets the maximum quantity (10 MW) is bought, and it will also buy 5 MW to bilateral markets.

In the bilateral contracts, as can be observed in the variables, the two actions are performed, buying and selling. This is possible due to the fact that in this market the quantity of electricity traded influences the price of it. In the SG market, there is also this possibility, but the resolution by this method does not present this possibility.

In order to obtain better results with the PSO, an initial study was carried out in order to find the optimum parameterization of the parameters, especially the value of the local term attraction and global attraction. By the results obtained from the training of the parameters can be concluded that the best combinations of parameters are the parameters with a color of lighter tonality, as indicated by the scale of values present on the right. Analyzing the graph of Fig. 2, which represents the mean of the objective function of 100 simulations with 500 iterations each, which in the end will result in 50,000 evaluations of the objective function.

Fig. 2
figure 2

Local and Global attraction heatmap

This process was repeated for each combination of parameters, in the y-axis, the parameter c1 is represented and in the x-axis the parameter c2, both can take values from 0 to 2 with an increment of 0.1, in total we will have 441 combinations. Analysing the graph can see that the best combination of parameters is obtained when the value of c2 is less than 0.5, and for c1 the higher the value, the better the performance (Lezama et al. 2017b). Given the results obtained for the value of the combination of values that will be used will be 2 for c1 and 0 for c2, in this way the global component of the research process will be canceled.

After obtaining the initial solution, it is tested as input for different versions of the PSO. These versions differ in the construction of the initial solution. Initially, it is considered that only one particle receives the solution of CPLEX2, and thus the other particles will have a random solution, this version is called “Hybrid PSO”.

In order to understand the influence of the initial solution in the PSO research, four more versions were created. In these versions, all the particles receive solutions built from a solution of the CPLEX2. In the solution, the construction phase is used the normal distribution, since, as explained in section 4, since the problem has ten variables, each variable must have a value for PSO to start the search. Figure 3, presents three representations of a normal distribution, varying the Standard Deviation (STD), for the first variable: sell in the spot market.

Fig. 3
figure 3

Normal distribution for mean = 14

The normal distribution is characterized by the mean and the STD. In PSO, the initial solution requires one solution for each variable, so one particle has ten different variables. The representation in Fig. 3, demonstrates the influence of the STD in the creation of the initial solution, since the average of the distribution was used the value of the variable of sale in the spot market optimized by the CPLEX2 present in Table 1, this process is repeated for all variables and for each particle.

From the analysis of Fig. 3, one can verify that the bigger the STD, the greater the dispersion of the distribution, and the possible range values for each variable increase. E.g., if STD = 0.5 there is a higher probability of the value created to be closer to the value of the mean than if STD = 2.5. In this case, the STD value allows the creation of different initial solutions to the problem using the variables that resulted from the CPLEX2 resolution.

Table 2 presents the objective function results for all methods. The STD = 0.5 version represents the hybrid PSO that starts its search with a solution created from a normal distribution with a mean corresponding to the deterministic resolution value (CPLEX2, Table 1) and with STD = 0.5. The versions of STD = 1.5 and STD = 2.5, is exactly the same as version STD = 0.5, but the value of the standard deviation is respectively 1.5 and 2.5.

The version STD = 2.5 (> = 0), represents the hybrid method when all PSO particles start with a solution generated by a normal distribution with STD = 2.5, and all variables in all solutions have some positive values. The CPLEX1 and CPLEX2 only have a maximum number for objective function because these are deterministic methods and not population-based. The other resolutions have different measurements because for each method 1000 simulations are executed. Table 2 shows the values of the objective function for all implemented methods. As expected, the deterministic resolution (CPLEX1) reached the best objective function value, followed by the Hybrid PSO where only one of the particles starts with the initial solution of CPLEX2. Next, the hybrid versions appear, in which the initial solution of all the particles was created using the normal distribution. Finally appears the PSO where the initial solution was created by random values and finally appears the CPLEX2.

As one can see, the difference between CPLEX1 and PSO in the objective function value for the maximum is 0.000023, it is residual value. In the average parameter, there is already a larger difference, but the hybrid PSO has a value very close to CPLEX1 (reference result) with a difference of 0.0155. The greater difference in results is observed in the STD of the methods including the PSO.

Table 3 shows the comparison of execution times between all the considered methods. The “Total mean values” column represents the mean value of execution times. As noted, CPLEX1 and CPLEX2 only have one value – exact solution, which means that it was only executed once. In the other cases, the values refer to the 1000 simulations.

Table 3 Time results for all methods in seconds

By the Table 3, it is possible to verify that PSO presents the smaller value of execution time. As expected, the CPLEX1 presents a high value but on the other hand, guarantees the maximum value for the objective function. In this case, the hybrid PSO methods and all other versions of the normal distribution have very similar values. It is worth noting that STD 2.5 (> = 0) takes twice the STD 2.5 due to the fact that the solutions are corrected to positive values.

In the column of “Total for all runs” the total value of the 1000 simulations is shown, which is proportional to the average value. In the last column, the total average value is displayed with all steps, from the data load creation of the initial solution (CPLEX2 time). The average value of the whole process is about 50 s for the hybrid PSO method, which is much smaller when compared to the value of CPLEX1; however, the objective function value is very close. Figure 4 shows the results for the number of iterations. In the bar graph, the average value for each method is shown.

Fig. 4
figure 4

Mean iteration results

As can be observed by Fig. 4, the average number of iterations in the methods where the initial solution contains information of the resolution of CPLEX2 is between 80 and 90 iterations and in the PSO with a random solution is about 63. With the inclusion of the initial solution the average value of the iterations increases, this fact can be explained because in the PSO since the search has to start with random solution and often far away from the optimum, the search tends to fall in local points and the method does not have the ability to get out of there, often converging to a bad solution.

Figure 5 shows a representation of the convergence process of the different versions of the PSO, by showing the convergence in all the 1000 executions. This enables assessing how the STD stands for in the solution search using random methods.

Fig. 5
figure 5

Algorithms performance, a PSO, b Hybrid-PSO, c STD = 2.5, d STD = 1.5, e STD = 0.5 and f STD = 0.5, (> = 0)

In Fig. 5, six different representations are presented, which refer to the results of the PSO algorithms. Since 1000 runs were performed for each, each algorithm obtains 1000 different results, and each line in the figure represents the evolution of the solution throughout the iterations.

As one can see, the images of Fig. 5, do not have the scales in the same magnitude, which may make it difficult to observe, but with the scales, all the same, it was not possible to have the notion of what really happens in the convergence process. Figure 5a) represented the standard PSO, which has an STD of 150, as can be seen in Table 2. One can observe that this resolution presents the simulations with very different final results hence the existence of the large STD. Also, in Fig. 5, is represented the Hybrid PSO method, which results, from Table 2, in the lowest value of STD. Then the methods with an initial solution based on the normal distributions follow in terms of STD. Within these can see that the STD of the 1000 simulations decreases depending on the STD of the normal distribution applied for the creation of the initial solution. It is important to mention that the method where only one of the particles starts with the initial solution obtained through CPLEX2 presents a better performance in terms of STD than the versions where all the particles receive a solution containing information from the solution of CPLEX2. Figure 6 shows a graph of the maximum convergence that the algorithms obtained during the iterations.

Fig. 6
figure 6

Mean iteration results

In the x-axis, the number of iterations is represented, and at each iteration, the maximum of the 1000 executions is calculated. As it is possible to observe, the PSO starts its search with an objective function value much lower than the other methods, but by the fortieth iteration, the value is practically the same. As it is possible to see the algorithms that start the search based on the CPLEX 2 solution quickly converge to a solution, another curious question is that the algorithms that have their initial solutions generated from the normal distribution start their search with a lower objective function value than the PSO version that directly contains the CPLEX 2 solution starts.

Figure 7 shows the boxplot performance of the PSO and Hybrid PSO algorithms since these variants obtained the lowest and highest objective function value respectively.

Fig. 7
figure 7

a Box plot for PSO and (b) box plot for Hybrid PSO

The boxplots give the indication of the concentration of the final solutions of the 1000 executed executions, so between the minimum value and the first quartile we have 25% of the observations, between the quartiles 50% of the observations are represented and between the 3° quartile and the maximum are 25% of the observations, the value in green corresponds to the median. Analyzing the boxplots, it is clear that the performance of the Hybrid PSO is better than the performance of the PSO, as the Hybrid PSO values are more concentrated. How it is possible to observe the range values of Fig. 7b) is smaller compared to the range values of Fig. 7a), this may indicate that solutions obtained by Hybrid PSO are more concentrated.

Figure 8 shows the confidence intervals for a) PSO and b) for Hybrid PSO. The graphs presented show the 95% confidence interval for the experiments performed on each one. Each of these graphs is associated with a certain error, in the case of PSO is 16.20, and in the case of Hybrid PSO is 0.00274. In this way we can consider that applying the resolution of the hybrid PSO we have 95% of hypotheses to find a value between od limits Upper bound and lower bound. So, we can consider Hybrid PSO to be more reliable.

Fig. 8
figure 8

Confidence intervals of 95% for (a) PSO and (b) Hybrid PSO

Figure 9, represented the value of the different variables in the different resolution methods. In the y-axis, the negative values represent the electricity purchases, and positive values represent the amount of electricity sold.

Fig. 9
figure 9

Sale and purchase in the different markets

In this case, as can be seen from the caption of Fig. 9, the five different markets are considered. Each bar of each method corresponds to the value of each variable, so have two possible actions for each market that gives a total of ten variables and ten bars in each method. Table 4 shows the values corresponding to the scaling of the result of the method that obtained the maximum objective function value, CPLEX1, and the results obtained by CPLEX2.

Table 4 Scheduling of sale and purchase in the different markets

The representation of Table 4 shows the difference in the deterministic resolutions from the full and simplified versions of the exact resolution method. As one can see, using CPLEX2 the variables only contain positive integer values, on the other hand in CPLEX1 the variables are numbers with several decimal places. From the result of the objective function of Table 2, one can see that there is a difference in the solutions, and from the analysis of Table 3 the execution time is also different, with about 0.06% of the time of CPLEX1, CPLEX2 can obtain a solution 0.09% inferior to CPLEX1.

Analyzing the CPLEX1 scheduling results, it can be concluded that the method respected the imposed rules that were defined, as it can be observed in the Spot market the sale was not premised and as can see from the Table 4. the variable of this case is 0, another of the conditions was the fact that in the Balancing markets only one of the actions is allowed and thus it happens, and only the action (buy electricity) is realized, keeping the variable of sales to 0, in the other two markets the two actions are realized because as the price is variable with the quantity of purchase and can occur multiple opportunities which can result in positive profit.


This paper presented a novel hybrid optimization model based on the combination of a PSO approach and a simplified resolution using an exact method, to solve the portfolio optimization problem for multiple electricity markets participation. Results enable concluding that the proposed hybrid resolution has advantages in solving the problem, as can be observed by comparing the proposed approach results with those of the standard PSO, in which the algorithm starts the search with a random solution. Using the standard PSO in this problem, a very high STD is obtained; while using the proposed approach, the STD decreased. This represents a great advantage since this measurement gives the indication of the dispersion solution of the population around the mean. As can be seen, there was also a large increase in the mean objective function value that is achieved, being located near the maximum reference value (CPLEX1).

Another of the advantageous conclusions refers to the execution time because with this method the execution time decreases considerably compared to the time of the reference result using the exact method to solve the complete version of the problem. In this sense, since in electricity markets negotiations, decisions must be taken in short times, this methodology can bring high benefits for real-world application.

As future work, it is intended to expand this methodology by combining different methods such as genetic algorithms and simulated annealing, as well as by using simple metaheuristics to select the initial solution (e.g., Vortex Search algorithm (VSA), (Yusta 2009) and Evolutionary Computation (Lezama et al. 2017a). In another phase, it is also envisaged to include a risk component in the model and thus obtaining a multiobjective problem so as to be solved with a variation of the proposed methodology.


  • Arumugam MS, Rao MVC (2008) On the improved performances of the particle swarm optimization algorithms with adaptive parameters, cross-over operators and root mean square (RMS) variants for computing optimal control of a class of hybrid systems. Appl Soft Comput 8:324–336

    Article  Google Scholar 

  • Boussaïd I, Lepagnot J, Siarry P (2013) A survey on optimization metaheuristics. Inf Sci 237:82–117.

    Article  MathSciNet  MATH  Google Scholar 

  • Burger S, Chaves-Ávila JP, Batlle C, Pérez-Arriaga IJ (2017) A review of the value of aggregators in electricity systems. Renew Sust Energ Rev 77:395–405.

    Article  Google Scholar 

  • Ciarreta A, Espinosa MP, Pizarro-Irizar C (2017) Has renewable energy induced competitive behavior in the Spanish electricity market? Energy Policy 104:171–182.

    Article  Google Scholar 

  • Denton M, Palmer A, Masiello R, Skantze P (2003) Managing market risk in energy. IEEE Trans Power Syst 18:494–502.

    Article  Google Scholar 

  • European Commission (2013) Horizon 2020: The EU Framework Programme for Research and Innovation. Accessed 17 Jul 2017

    Google Scholar 

  • Faia R, Pinto T, Vale Z (2016) Dynamic fuzzy clustering method for decision support in electricity markets negotiation. ADCAIJ Adv Distrib Comput Artif Intell J 5(23).

  • Faia R, Pinto T, Vale Z, Corchado JM (2017) Hybrid particle swarm optimization of electricity market participation portfolio. Special session on Agent-based modeling for smart grids and M2M applications, 2017 IEEE Symposium on Computational Intelligence Applications in Smart Grid (IEEE CIASG'17), 2017 IEEE Symposium Series on Computational Intelligence (IEEE SSCI 2017), Honolulu, Hawaii, 27 November-1 December, 2017

  • Faia R, Pinto T, Vale Z, Corchado JM (2018) Strategic particle swarm inertia selection for the electricity markets participation portfolio optimization problem. Appl Artif Intell.

  • Fernández-Vargas JA, Bonilla-Petriciolet A, Rangaiah GP, Fateen SEK (2016) Performance analysis of stopping criteria of population-based metaheuristics for global optimization in phase equilibrium calculations and modeling. Fluid Phase Equilib 427:104–125.

    Article  Google Scholar 

  • Foley AM, Ó Gallachóir BP, Hur J et al (2010) A strategic review of electricity systems models. Energy 35:4522–4530.

    Article  Google Scholar 

  • Kennedy J, Eberhart R (1995) Particle swarm optimization. Neural Networks, 1995. Proc IEEE Int Conf 4:1942–1948

    Google Scholar 

  • Lezama F, De Cote EM, Sucar LE et al (2017a, 2017) Evolutionary framework for multi-dimensional signaling method applied to energy dispatch problems in smart grids. In: 2017 19th international conference on intelligent system application to power systems. ISAP. IEEE, pp 1–6

  • Lezama F, Soares J, Munoz de Cote E et al (2017b) Differential evolution strategies for large-scale energy resource Management in Smart Grids. In: Proceeding GECCO '17 Proceedings of the Genetic and Evolutionary Computation Conference Companion. Berlin, pp 1279–1286.

  • Markowitz H (1952) Portfolio selection. J Finance 7:77.

    Article  Google Scholar 

  • Meeus L, Belmans R (2008) Electricity market integration in Europe. Revue-E 124:5–10

    Google Scholar 

  • Mehdi M (1981) Parallel Hybrid Optimization Methods for Permutation Based Problems, pp 179–180

    Google Scholar 

  • MIBEL (2007) Mercado Iberico de Eletrecidade. Accessed 27 Feb 2017

  • Olivella-Rosell P, Bullich-Massagué E, Aragüés-Peñalba M et al (2018) Optimization problem for meeting distribution system operator requests in local flexibility markets with distributed energy resources. Appl Energy 210:881–895.

    Article  Google Scholar 

  • Palensky P, Dietrich D (2011) Demand Side Management: Demand Response, Intelligent Energy Systems, and Smart Loads. IEEE Trans Ind Informatics 7:381–388

    Article  Google Scholar 

  • Pinheiro Neto D, Domingues EG, Coimbra AP et al (2017) Portfolio optimization of renewable energy assets: hydro, wind, and photovoltaic energy in the regulated market in Brazil. Energy Econ 64:238–250.

    Article  Google Scholar 

  • Pinto T, Morais H, Sousa TM, Sousa T, Vale Z, Praça I, Faia R, Solteiro Pires EJS (2015) Adaptive Portfolio Optimization for Multiple Electricity Markets Participation. ‎IEEE Trans Neural Netw Learn Syst 27(8):1720–1733.

  • Pinto T, Sousa TM, Vale Z (2012) Dynamic artificial neural network for electricity market prices forecast. IEEE 16th International Conference on Intelligent Engineering Systems (INES 2012), Costa de Caparica, Portugal, 13-15 June, 2012. pp 311–316

  • Pinto T, Vale Z, Sousa TM et al (2014) Particle swarm optimization of electricity market negotiating players portfolio. Highlights Pract Appl Heterog Multi-Agent Syst 430:273–284

    Google Scholar 

  • PJM (2018) PJM Energy Market.

    Google Scholar 

  • Vale Z, Pinto T, Morais H et al (2011a) VPP’s multi-level negotiation in smart grids and competitive electricity markets. IEEE Power Energy Soc Gen Meet:1–8

  • Vale Z, Pinto T, Praça I, Morais H (2011b) MASCEM: electricity markets simulation with strategic agents. IEEE Intell Syst 26:9–17

    Article  Google Scholar 

  • Yoo TH, Ko W, Rhee CH, Park JK (2017) The incentive announcement effect of demand response on market power mitigation in the electricity market. Renew Sust Energ Rev 76:545–554.

    Article  Google Scholar 

  • Yusta SC (2009) Different metaheuristic strategies to solve the feature selection problem. Pattern Recogn Lett 30:525–534.

    Article  Google Scholar 

Download references


Not applicable.


This work has received funding from the European Union's Horizon 2020 research and innovation programme under project DOMINOES (grant agreement No 771066) and from FEDER Funds through COMPETE program and from National Funds through FCT under the project UID/EEA/00760/2019 and Ricardo Faia is supported by FCT Funds through and SFRH/BD/133086/2017 PhD scholarship.

Availability of data and materials

The datasets generated during and/or analysed during the current study are available from the corresponding author on reasonable request. A part of the results presented here are available in the following reference (Faia et al. 2017).

Author information

Authors and Affiliations



RF conceived and developed the proposed methodology, implemented them in the MATLAB® software, conducted the experiments and wrote the paper. TP contributed in the conception of the methodology, design of the experiments, analysis of results and writing of the manuscript. ZV helped conceiving of the study, participated in its design, coordination and helped to draft the manuscript. JM Corchado contributed in the overall design of the system, design of the experiments and review of manuscript. All authors read and approved the final manuscript.

Corresponding author

Correspondence to Tiago Pinto.

Ethics declarations

Competing interests

The authors declare that they have no competing interests.

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (, which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Faia, R., Pinto, T., Vale, Z. et al. Hybrid approach based on particle swarm optimization for electricity markets participation. Energy Inform 2, 1 (2019).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: