Abstract
 Top of page
 Abstract
 1. Prologue
 2. Introduction
 3. Our MIP model
 4. A greedy algorithm
 5. Computational results
 6. Conclusions
 Acknowledgments
 References
In the past years, we have witnessed an increasing interest in smart buildings, in particular for optimal energy management, renewable energy sources, and smart appliances. In this paper, we investigate the problem of scheduling smart appliance operation in a given time horizon with a set of energy sources and accumulators. Appliance operation is modeled in terms of uninterruptible sequential phases with a given power demand, with the goal of minimizing the energy bill fulfilling duration, energy, and user preference constraints. A mixedinteger linear programming (MIP) model and greedy heuristic algorithm are given, which are used in a synergic way. We show how a general purpose (offtheshelf) MIPrefining procedure can be effectively used for improving, in short computing time, the quality of the solutions provided by the initial greedy heuristic. Computational results confirm the viability of the overall approach, in terms of both solution quality and speed.
1. Prologue
 Top of page
 Abstract
 1. Prologue
 2. Introduction
 3. Our MIP model
 4. A greedy algorithm
 5. Computational results
 6. Conclusions
 Acknowledgments
 References
Many successful matheuristic schemes use a blackbox mixed integer linear programming (MIP) solver to generate highquality heuristic solutions for difficult optimization problems. The hallmark of this approach is the availability of an (possibly incomplete) MIP model, and an external metascheme that iteratively solves subMIPs obtained by introducing invalid constraints (e.g., variable fixings) defining “interesting” neighborhoods of certain solutions. The goal of the approach is to iteratively refine the incumbent solution, producing a sequence of improved feasible solutions in short (or, at least, acceptable) computing times. The above solutionrefinement approach is completely general, that is, it can in principle be applied to the original MIP without the need of ad hoc adaptations.
The evolutionary “polishing method” of Rothberg (2007) is an example of a general MIPrefinement procedure. This method implements an evolutionary metaheuristic to be applied at selected nodes of a branchandbound tree. A fixedsize population of feasible solutions is maintained. Iteratively, two or more “parent” solutions are combined with the aim of creating a new “son” member of the population. This is done by fixing all variables whose value coincides in the parent solutions and heuristically solving the resulting subMIP by invoking an external MIP solver for a limited number of branchandbound nodes. Diversification is guaranteed by performing a classical mutation operation that consists in (i) selecting at random a seed solution in the population, (ii) fixing at random some of its variables, and (iii) heuristically solving the resulting subMIP.
Interesting enough for practitioners, an offtheshelf implementation of the polishing heuristic is available in some commercial MIP solvers, hence it can be readily used. In very difficult cases, however, the approach based on general MIP refinement is not successful, and one tends to design ad hoc matheuristics that exploit the structure of the problem. As a matter of fact, the main issue with the general approach is the lack of good (or even feasible) solutions to refine. In this context, one can argue that ad hoc heuristics and general MIPrefinement procedures are complementary to each other; the former being typically able to find feasible solutions very quickly, whereas the latter can exploit the underlying MIP model to improve them by reaching a quality degree that is difficult to attain otherwise.
In this paper, we show how the application of above scheme can lead to a very effective overall heuristic even in case a very simple greedy is used to feed an offtheshelf general MIPrefinement module. The resulting “MIPandrefine” approach is exemplified and tested in the context of smart grid energy management whose underlying MIP models turn out to be very difficult to solve without the hints provided by an external heuristic.
Although we cannot claim deep theoretical contributions, we hope that this paper can be used as a case study by researchers and practitioners working in the field of matheuristics, and the simplicity of the MIPandrefine approach will make it one of the first options to be tried when approaching a new problem.
2. Introduction
 Top of page
 Abstract
 1. Prologue
 2. Introduction
 3. Our MIP model
 4. A greedy algorithm
 5. Computational results
 6. Conclusions
 Acknowledgments
 References
Energy optimization is attracting a great interest among researchers as long as new “smarter” infrastructures and devices are going to replace the traditional ones. The most popular scenario involves a new concept of electrical grid, the “smart grid” that allows to convey a twoway flow of electricity and information between central generators and customers (Fang et al., 2012). Smart grid benefits are fully exploited only if the grid endpoints, home appliances for example, are smart as well. Smart appliances are able to exchange data with the grid, such as dynamic energy prices and grid status. Along with user preferences, this information can be used to optimally manage the energy demand in order to reduce the customer energy bill and prevent major blackouts. A common way of addressing the demand side energy management problem is by solving a scheduling problem involving multiple appliances with different operational constraints, user preferences, renewable energy sources, and batteries.
MIP models from the literature allow an effective mathematical formulation of the appliance scheduling problem. Barbato et al. (2011) also consider photovoltaic (PV) energy, and a linearized description of battery charge states is presented. Sou et al. (2011) provide a detailed MIP formulation of appliance power profiles and operations, and model appliance operations as a set of sequential uninterruptible phases with variable interphase delays. Other authors have investigated variants of the appliance scheduling problem—Hatami and Pedram (2010) by considering the interaction among different users, Zhang et al. (2011) by considering a socalled microgrid, and Agnetis et al. (2011) by addressing additional thermal comfort constraints.
As far as the solution of appliance scheduling problem is concerned, Carpentieri et al. (2012) propose a Linear Programming (LP) rounding heuristic for solving the appliance scheduling problem with the goal of minimizing the maximum peak energy of multiple houses. Taking into account the real parameters, Barbato and Carpentieri (2012) use different heuristics to address the problem of online schedule recovering an offline schedule.
The rest of the paper is organized as follows. In Sections 'Our MIP model' and 'A greedy algorithm', we describe only two ingredients of our recipe: the MIP model and a simple greedy heuristic, respectively. Computational results are then presented in Section 'Computational results', while some conclusions are drawn in Section 'Conclusions'. The present work is based on the dissertation of the second author (Sartor, 2012).
3. Our MIP model
 Top of page
 Abstract
 1. Prologue
 2. Introduction
 3. Our MIP model
 4. A greedy algorithm
 5. Computational results
 6. Conclusions
 Acknowledgments
 References
Following Sou et al. (2011), we model appliance operations as a set of sequential uninterruptible energy phases, each of which uses a total amount of given electric energy. For example, typical washing machine phases are prewash, wash, rinse, and spinning. The set of phases is also called the “power profile” of the appliance.
Depending on the appliance, phase duration may vary, as long as there is an interphase delay (e.g., the spinning of the washing machine must start within 10 minutes of the rinsing being finished). The total energy given for a phase can be evenly distributed over time, or it may vary. We model the latter case with perphase bounds on the instantaneous power consumption. Besides the intrinsic operational constraints, we allow the user to specify preferences for the time interval in which an appliance should run (e.g., start the washing machine between 4:00 p.m. and 6:00 p.m.).
Following Barbato et al. (2011), we have modeled three classes of energy sources: power grid, domestic renewable energy, and accumulators (batteries). The power grid advertises the maximum amount of available energy (peak power) for each time instant. Note that this peak power can be different from the actual user contract maximum power. In fact, a common feature in the smart grid paradigm is to dynamically advertise (i.e., broadcast) the peak power depending on the grid state, in order to let users adjust their demands for preventing more dangerous power outages. Along with the peak power, the cost of energy also changes with time. For example, in the Italian market it can vary between two values depending on the time of the day and day of the week. More dynamic power grids allow for a finer grain price adjustment (hourly or less).
Domestic renewable energy sources provide free energy but with a limited availability. For example, the performance of a PV plant depends on geographical position, weather conditions, and time. Accumulators allow to store energy (from grid or other sources) when energy price is low, and use it later when energy price is higher. This feature represents an important degree of freedom as far as optimization is concerned. Our model only deals with batteries, viewed as direct electric energy accumulators; however, it can trivially be extended to other types of energy accumulators (e.g., boilers for thermic energy). Finally, the optimization goal is to minimize the total energy cost by finding a proper allocation of all appliance phases.
Instead, is 1 iff there is an interphase delay between phase and j in time slot k, and is defined as
Figure 1 illustrates the meaning of the above variables in a simple case of an appliance with two phases: the first phase is allocated between 2 and 6 hours, and the second between 14 and 16 hours (the day being divided into 12 time slots).
subject to the following constraints.
Phase energy: It ensures that the energy allocated during phase j of appliance i meets the given phase total energy
 (3)
Energy bounds: It ensures that the energy allocated in phase j for appliance i in any time slot k belongs to the allowed range
 (4)
Power safety: It guarantees that the total energy assigned in time slot k does not exceed the peak power limit
 (5)
where is the peak limit of slot k; this constraint can also be used to model additional unscheduled power demands that reduce the available grid energy in time slot k.
Energy phase duration:
 (6)
where and represent, respectively, the lower and upper bounds on the number of time slots to allocate for phase j of appliance i.
Uninterruptible phase: These constraints ensure that all time slots of phase j are allocated contiguously (i.e., when an energy phase starts, it must finish without interruptions).
 (7)
Recall that is 0 before the last time slot allocated for phase j and appliance i, and becomes 1 afterwards (1a) until the end (1b). Thus, constraint (7) prevents the variable to be 1 after the lastphase time slot.
User time preferences: Disable phase allocation of appliance i in the given time slots
 (10)
where is equal to 0 iff phase j of appliance i cannot be allocated in time slot k.
Battery usage constraint: The battery cannot charge and discharge at the same time.
 (11)
Battery charge/discharge rate bounds:
 (12a)
 (12b)
where and denote the maximum charge and discharge rates, respectively.
Battery energy function: This is linearization of the actual charge/discharge curves
 (13)
where and are, respectively, the charging and discharging efficiency.
Battery capacity bounds: These are used to limit the energy stored in the battery
 (14)
where and represent the maximum capacity and minimum energy safety value (required, e.g., by lithium batteries).
Balancing constraint: It balances between produced and consumed energy
 (15)
where is the sum of the renewable domestic power sources contribution in time slot k.
4. A greedy algorithm
 Top of page
 Abstract
 1. Prologue
 2. Introduction
 3. Our MIP model
 4. A greedy algorithm
 5. Computational results
 6. Conclusions
 Acknowledgments
 References
In this section, we describe a heuristic greedy algorithm for finding good feasible solutions of the described problem, which we apply in a multistart fashion. According to a greedy policy, the algorithm schedule appliances in decreasing priority—once an appliance has been scheduled, it cannot be changed, and all other appliances are allocated on top of the current partial solution. In the first application of the greedy, we use energy requirements as appliance priorities. In the subsequent runs, the priority vector is shifted to generate different solutions. For each appliance, we look for a feasible allocation of its phases according to the following rules. We consider a simplified (more restricted) version of the problem, where the duration (say) of each phase is minimum between and , and bounds (4) become for all k.
A pseudocode of our heuristic is given in Algorithm 1. We have an external loop (starting after line 1) where appliances i are scheduled one after the other. For each appliance i, we consider all possible “shifts” t for the starting slot of the first phase (line 3), and then consider a straightforward greedy (lines 8–19) to find the best starting slot of all other phases j. Variable gives the first slot k currently available for allocation: it is initialized at line 7 after the allocation of the first phase, then it is updated at line 18 after the allocation of each new phase.
When all possible shifts t have been tried, gives the cost of the (heuristically) best assignment for all phases of i, the corresponding solution being stored in the incumbent x. At line 27, if no feasible phase allocation was found for appliance i (case ), the overall problem is heuristically considered to be infeasible and the greedy is aborted—although this situation can occur if the constraints are very tight, it never occurred in our tests.
5. Computational results
 Top of page
 Abstract
 1. Prologue
 2. Introduction
 3. Our MIP model
 4. A greedy algorithm
 5. Computational results
 6. Conclusions
 Acknowledgments
 References
In our tests, we considered a time horizon of 24 hours, subdivided in 96 time slots of 15 minutes each. Experiments were grouped into four sets according to two main parameters. The first parameter is the “flexibility” of the “user time preference” constraint. We considered two levels of flexibility, namely, “high flexibility” (HF), which means that the appliance can be scheduled at any time during the day, and “medium flexibility” (MF), which means that appliances can run inside a 12hour randomly generated time window within the day. The second parameter is electricity cost: it can vary either every 2 hours (BC), or every time slot (TC). For each of the four resulting sets, namely HFBC, HFTC, MFBC, and MFTC, we considered 10, 20, or 30 appliances, respectively, and solved five random instances for each of the 12 combinations—60 instances in total.
A constant price of the sold PV energy was considered, which was equal to half of the minimum cost of the bought energy. All the other model parameters were taken from uniform random distributions: , , , , , , , and . For all appliances i, we set for all j, and (if ) or (if ).
We compared four different solution approaches, all run in singlethread mode:
 Greedyalone: Our standalone greedy algorithm without multistart enhancement.
 Greedy: Our greedy algorithm applied N times by starting from the N possible shifts of the initial priority vector, taking the best solution found and storing the others.
 CPLEX: The stateoftheart IBM ILOG CPLEX MIP 12.4 solver used as a black box, with its default setting, stopped as soon as the first feasible solution is found.
 CPLEX + Polish: CPLEX's polishing refining heuristic (Rothberg, 2007) applied immediately after the root node and for a total of 10 nodes (all cuts disabled), when starting from the feasible solution found by the previous CPLEX algorithm.
 Greedy + Polish: Our proposed MIPandrefine scheme, that is, the previous CPLEX + Polish algorithm but starting from the list of all feasible solutions found by Greedy.
Note that the last three methods also return a lower bound on the optimal value hence, as a byproduct, they can provide a proof of optimality in some (easy) cases. This is true, in particular, when the root–node lower bound is very tight and the method starts with an (almost) optimal Greedy solution, meaning that just few branching nodes need to be explored.
According to Table 1, Greedy + Polish outperforms its competitors. As expected, Greedyalone is always able to provide feasible solutions in very short computing times. In spite of its greedy nature, the solution quality is fair in many cases, in particular in the easiest scenarios where the greedy solution often turns out to be optimal. Nevertheless, for more difficult scenarios, there is room for big improvements—also because of the contribution of batteries that are exploited by the MIP model but not by the greedy.
Table 1. Percentage cost increase (% Incr) with respect to the Greedyalone algorithm, and computing time (in CPU seconds); a negative increase corresponds to a better solution w.r.t. Greedyalone  Greedy  CPLEX  CPLEX + Polish  Greedy + Polish 

Set  % Incr  % STD  Time  % Incr  % STD  Time  % Incr  % STD  Time  % Incr  % STD  Time 


HFBC 10  0.0 ^{5}  0.0  0.5  252.9  193.4  56.8  72.7 ^{2}  95.6  94.9  0.0 ^{5}  0.0  0.6 
HFBC 20  −0.5  0.5  2.4  50.2  80.4  3,054.4  13.4  41.2  3,223.2  −9.4  4.8  262.0 
HFBC 30  −0.6  0.5  6.4  1.8  4.7  9,585.8  −5.1  3.4  9,966.5  −6.1 ^{1}  3.2  310.2 
HFTC 10  0.0 ^{5}  0.0  0.4  94.0  129.2  49.0  47.0 ^{4}  94.1  83.4  0.0 ^{5}  0.0  0.6 
HFTC 20  −1.7  1.2  2.3  58.0  49.9  2,213.0  −1.4  21.3  2,387.4  −22.2 ^{1}  1.8  154.7 
HFTC 30  −0.6  0.3  6.6  −12.3  1.4  46,439.1  −19.0  2.6  46,904.7  −21.2 ^{1}  2.5  617.7 
MFBC 10  0.0 ^{5}  0.0  0.3  157.3 ^{1}  146.7  5.2  38.8 ^{2}  51.4  15.4  0.0 ^{5}  0.0  1.3 
MFBC 20  −3.0  2.2  1.5  160.1  45.9  35.2  24.4  24.2  90.0  −13.8  7.8  100.8 
MFBC 30  −0.8  0.5  3.7  44.4  11.5  65.1  0.7  8.3  164.5  −11.7 ^{1}  4.5  67.4 
MFTC 10  0.0 ^{5}  0.0  0.3  159.9  89.5  5.6  33.5 ^{1}  24.8  18.8  0.0 ^{5}  0.0  1.5 
MFTC 20  −1.2  1.2  1.5  54.8  21.8  52.5  −8.4  13.6  114.2  −23.5 ^{1}  2.6  54.6 
MFTC 30  −1.0  0.3  3.7  16.2  24.8  117.8  −14.0  6.1  232.7  −22.0  1.6  112.0 
As to CPLEX, it has a great difficulty even in finding its first feasible solution—a task that takes a huge amount of time in the difficult cases. Significantly improved solutions are found by CPLEX + Polish, thus confirming the effectiveness of this heuristic. However, the full power of MIP refinement is only exploited when Greedy + Polish comes into play. This is due to two main factors: the speed of the greedy and the fact that several diversified solutions are passed to the polishing method.
Of course, we cannot claim that Greedy + Polish would outperform more sophisticated heuristic approaches from the literature on similar problems—for that, much more extensive computational comparisons would be needed. However, we believe our computational results support the message of this paper—sound matheuristics can be built around a simple greedy and an offtheshelf MIPrefinement procedure.