{"id":613,"date":"2017-04-24T16:49:02","date_gmt":"2017-04-24T21:49:02","guid":{"rendered":"http:\/\/inova8.com\/bg_inova8.com\/?p=613"},"modified":"2017-11-15T17:42:15","modified_gmt":"2017-11-15T22:42:15","slug":"is-excel-solver-suitable-for-production-data-reconciliation","status":"publish","type":"post","link":"https:\/\/inova8.com\/bg_inova8.com\/is-excel-solver-suitable-for-production-data-reconciliation\/","title":{"rendered":"Is Excel Solver suitable for Production Data Reconciliation?"},"content":{"rendered":"<div class=\"boldgrid-section\">\n<div class=\"container\">\n<div class=\"row\">\n<div class=\"col-md-12 col-xs-12 col-sm-12\">\n<p><em><br \/>\nExcel is the application platform of choice for many process manufacturing applications. Conversely, data reconciliation is not as widely used as it should be despite demonstrable benefits. Can we use Excel Solver to provide production-ready data reconciliation within Excel? This article describes an Excel template that uses Solver for data reconciliation. And the conclusions are \u2026?<\/em><\/p>\n<h1>Why is data reconciliation not ubiquitous?<\/h1>\n<p>Excel is ubiquitous in process manufacturing as the end-user development and reporting platform of choice. It is used for data collection, end of shift reporting, accounting, modeling, scheduling, planning and (too?) much more, often frustrating the efforts of corporate IT who want more formal analysis tools and applications. Conversely over the last 25 years data reconciliation has not achieved the same ubiquitous status although it is an application that provides proven benefits of reduced accounting losses, better yield management, unreported material movement detection, and improved meter management amongst many other operational improvements. Why?<\/p>\n<p>There are many aspects to the answer, but perhaps if data reconciliation were part of Excel rather than Excel just being a host for the raw data and reconciled results it could be used more easily in conjunction with the many data collection, reporting, accounting, modeling, scheduling and planning spreadsheet applications already in use.<\/p>\n<p>The core computational engine of data reconciliation is the solver. Excel has an excellent built-in solver called, not surprisingly, Solver!&nbsp; Since Solver uses the <em>\u201cGeneralized Reduced Gradient (GRG2) nonlinear optimization code , which was developed by Leon Lasdon, University of Texas at Austin, and Alan Waren, Cleveland State University\u2026\u201d<\/em> it should be well suited for data reconciliation. Is it?<\/p>\n<p>The best way to answer this question is to setup Excel using Solver to reconcile a typical reconciliation problem. Below is a description of my use of Solver which is contained in the attached Excel template, Reconciliation Example.xslm<\/p>\n<h1>Reconciliation model constraints<\/h1>\n<p>Although we use Excel to prepare reconciliation data or host the results of reconciliation, the reconciliation application will formulate its own model using its own syntax. I based this evaluation on this simple material balance:<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-616 aligncenter\" src=\"http:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.flowsheet.png\" alt=\"\" width=\"833\" height=\"541\" srcset=\"https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.flowsheet.png 833w, https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.flowsheet-300x195.png 300w, https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.flowsheet-768x499.png 768w\" sizes=\"(max-width: 833px) 100vw, 833px\" \/><\/p>\n<p>By using Solver we can express the reconciliation model constraints as Excel formula within cells using the familiar Excel syntax. As usual Excel will display the numeric result of these formulae as shown below (extracted from the attached Reconciliation Example.xslm). I chose to organize the formula to show the total feed and total product in adjacent cells, but other formulations are possible.<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-617 aligncenter\" src=\"http:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.constraints.png\" alt=\"\" width=\"452\" height=\"224\" srcset=\"https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.constraints.png 452w, https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.constraints-300x149.png 300w\" sizes=\"(max-width: 452px) 100vw, 452px\" \/><\/p>\n<p>However Excel also allows us to \u2018Show Formulae\u2019, offering the best of both worlds. Since I chose to use named ranges, the constraint formulae are very readable. Not only that, we can use \u2018Trace Precedents\u2019, and \u2018Trace Dependents\u2019 to track the relationship between constraints, a level of user interaction that is difficult to duplicate in dedicated reconciliation applications.<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-618 aligncenter\" src=\"http:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.constraint-equations.png\" alt=\"\" width=\"701\" height=\"224\" srcset=\"https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.constraint-equations.png 701w, https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.constraint-equations-300x96.png 300w\" sizes=\"(max-width: 701px) 100vw, 701px\" \/><\/p>\n<p>Also, of course, there is nothing to limit you to linear reconciliation problems in Excel.<\/p>\n<h1>Reconciled variables<\/h1>\n<p>I organized the reconciled variables as named cells so that the constraint equations are more readable. These will be the variables adjusted by Solver. In principle these variables could be distributed throughout the spreadsheet. However I chose to group them with the tolerances and estimates (measurements) in adjacent cells:<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-619 aligncenter\" src=\"http:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.variables-and-results.png\" alt=\"\" width=\"368\" height=\"301\" srcset=\"https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.variables-and-results.png 368w, https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.variables-and-results-300x245.png 300w\" sizes=\"(max-width: 368px) 100vw, 368px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Furthermore the named ranges in the Labeled Variable column were in fact \u2018arrays\u2019 pointing to the Solution, Tolerance, and Estimates;&nbsp; this is a convenient way of grouping the solutions with the corresponding tolerances and estimates.<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-620 aligncenter\" src=\"http:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.variables-and-results-expanded.png\" alt=\"\" width=\"482\" height=\"320\" srcset=\"https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.variables-and-results-expanded.png 482w, https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.variables-and-results-expanded-300x199.png 300w\" sizes=\"(max-width: 482px) 100vw, 482px\" \/><\/p>\n<h1>Reconciliation objective functions<\/h1>\n<p>Solver minimizes (or maximizes or drives to a value) a target cell which contains the value of the objective function. Most reconciliation systems will use a straight-forward sum-of-weighted-squares (Gaussian) formulation for this function. It can be argued that the measurement errors are drawn from a Gaussian distribution. Aside from this fact the Gaussian formulation is popular mainly because, in the case of linear constraints such as mass balances, the objective function can be solved without the need for an iterative search. However Solver uses a numeric search algorithm so we are not restricted to this Gaussian formulation. For this reason I created 4 alternative objective functions as VBA functions that can be called from within Excel. This avoids having to duplicate complex cell formulae, and thus reduces the risk of those pesky cell formula mistakes! The objective functions I chose were as follows, all taking one or more ranges of variables as arguments. The Fair and ContaminatedGaussian functions have additional parameters.<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-621 aligncenter\" src=\"http:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.function.png\" alt=\"\" width=\"425\" height=\"366\" srcset=\"https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.function.png 425w, https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.function-300x258.png 300w\" sizes=\"(max-width: 425px) 100vw, 425px\" \/><\/p>\n<p>These functions are described below:<\/p>\n<p style=\"padding-left: 30px;\"><strong>Gaussian<\/strong><\/p>\n<p style=\"padding-left: 30px;\">The \u2018normal\u2019 reconciliation objective function<\/p>\n<p style=\"padding-left: 30px;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e = (measurement-estimate)\/tolerance<\/p>\n<p style=\"padding-left: 30px;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Gaussian= minimize sum{ e^2 }<\/p>\n<p style=\"padding-left: 30px;\"><strong>Fair<\/strong><\/p>\n<p style=\"padding-left: 30px;\">A \u2018robust\u2019 estimator which is a generalization of the maximum-likelihood estimator:<\/p>\n<p style=\"padding-left: 60px;\">Fair = minimize sum{ c^2 ( abs(e)\/c \u2013 log( 1 + abs(e)\/c)) }<\/p>\n<p style=\"padding-left: 30px;\">Where c is a tuning parameter with approximate values in the range 10~20<\/p>\n<p style=\"padding-left: 30px;\"><strong>Lorentzian<\/strong><\/p>\n<p style=\"padding-left: 30px;\">This objective function tries to avoid weighting gross errors unduly so they do not distort the overall result<\/p>\n<p style=\"padding-left: 60px;\">Lorentzian = maximize sum{ 1\/(1 + e^2\/2) }<\/p>\n<p style=\"padding-left: 30px;\"><strong>ContaminatedGaussian or Tjoa-Biegler<\/strong><\/p>\n<p style=\"padding-left: 30px;\">This objective function attempts a balance between the probability of a gross and Gaussian error; \u2018nu\u2019 is the probability of gross errors, and \u2018b\u2019 is the ratio defining the larger variance of gross errors with respect to the normal errors. Thus a value of b=10 means that the variance of gross errors is 100 (10*10) that of the normal errors. A value of nu=0.05 means there is a 5% probability of a gross error.<\/p>\n<p style=\"padding-left: 60px;\">ContaminatedGaussian = minimize sum{ &#8211; log((1-nu) * exp(-e^2\/2)<\/p>\n<p style=\"padding-left: 240px;\">+ nu\/b * exp(-e^2\/(2*b)) )<\/p>\n<p style=\"padding-left: 240px;\">+ log(sqrt(2*pi) * tolerance) }<\/p>\n<p style=\"padding-left: 30px;\"><strong>ErrorCriticalLevel<\/strong><\/p>\n<p style=\"padding-left: 30px;\">A helper function that calculates critical error (global, constraint, or measurement) level given the degrees of freedom (number of constraints or measurements), and confidence level required, typically ~ 0.05, or 5%.<\/p>\n<h1>Using Solver<\/h1>\n<p>To solve, select Solver to display the dialog in which you can define the target cell containing the objective function, the range of cells containing the variables to be adjusted, and the range of cells containing the constraints. This setup can be conveniently saved into a range of cells for re-use.<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-622 aligncenter\" src=\"http:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.solver-parameters.png\" alt=\"\" width=\"633\" height=\"263\" srcset=\"https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.solver-parameters.png 633w, https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.solver-parameters-300x125.png 300w\" sizes=\"(max-width: 633px) 100vw, 633px\" \/><\/p>\n<p>Options allow various Solver properties to be tuned to optimize solving. However I found that the default setting of Solver would not converge to the actual solution and would drift off to an entirely different solution! I eventually found that the following parameters would usually converge to the expected solution irrespective of starting conditions, which I set to the measurements where available.<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-623 aligncenter\" src=\"http:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.solver-options.png\" alt=\"\" width=\"352\" height=\"297\" srcset=\"https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.solver-options.png 352w, https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.solver-options-300x253.png 300w\" sizes=\"(max-width: 352px) 100vw, 352px\" \/><\/p>\n<h1>Comments on Objective Functions<\/h1>\n<p>The objective of this evaluation was the feasibility of using Solver for production data reconciliation, but since I tested different objective functions I want to share my observations, admittedly from a very small sample.<\/p>\n<ol>\n<li>Each objective function was given the same starting point (the measurements where available) and Solver options.<\/li>\n<li>I knew that the recycle was in gross error; it should have been 1505.<\/li>\n<li>Gaussian, Fair, and ContaminatedGaussian all produce approximately the same estimates with the Recycle at 1485.<\/li>\n<li>Lorentzian was far better at ignoring this gross error on the Recycle measurement, but is this what we wanted because it simply produced erroneous estimates for the unmeasured variables?<\/li>\n<li>All took about 25~75 iterations to converge which was not an issue given the size of this reconciliation but could be significant for larger problems.<\/li>\n<li>Given the similarity of results between the Gaussian, Fair, and ContaminatedGaussian objective functions, is it worth the complexity of moving away from the Gaussian?<\/li>\n<\/ol>\n<p><img loading=\"lazy\" class=\"size-full wp-image-625 aligncenter\" src=\"http:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.results.png\" alt=\"\" width=\"707\" height=\"301\" srcset=\"https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.results.png 707w, https:\/\/inova8.com\/bg_inova8.com\/wp-content\/uploads\/2017\/04\/Is-Excel-Solver-suitable-for-Production-Data-Reconciliation.results-300x128.png 300w\" sizes=\"(max-width: 707px) 100vw, 707px\" \/><\/p>\n<h1>Advantages of Solver-based Data Reconciliation<\/h1>\n<ul>\n<li>Very easy to prepare data within Excel and to post process the results for presentation.<\/li>\n<li>Solver is not limited to linear-only constraints, thus component balance (bi-linear) reconciliation problems can be handled, although they were not tested here.<\/li>\n<li>Solver is not limited to equality constraints, thus for example all estimates can be forced to be positive.<\/li>\n<\/ul>\n<h1>Limitations of Solver-based Data Reconciliation<\/h1>\n<ul>\n<li>The built-in Solver allows only for a maximum of 200 variables, although one can upgrade to the full version<\/li>\n<li>Solver uses a generic solver but is not optimized for the characteristics of a data reconciliation problem, such as linear or bi-linear problems, and quadratic cost functions.<\/li>\n<li>It is easy to define a problem that becomes unstable. In the example, adding the redundant constraint of the \u2018world\u2019 causes solution instability.<\/li>\n<li>The Solver was very sensitive to the estimates and derivative estimation methods when applied to the example problem and objective functions. Unfortunately it still indicated converged solution even though the results were way off. In the example we know the \u2018correct\u2019 answer allowing us to tune the solver until it gets the \u2018right\u2019 answer; in a real problem we do not.<\/li>\n<li>Irrespective of objective function, Solver took 25~75 iterations to converge. This could be an issue for realistically sized (100~1000\u2019s of variables) reconciliation problems.<\/li>\n<li>There is no access to such intermediate products such as the covariance matrix with which to perform more sophisticated gross error detection.<\/li>\n<\/ul>\n<h1>Recommendations<\/h1>\n<p>Despite loving the ability to define non-standard objective functions and the use of Excel formula and pre-and post processing, the unreliability of the convergence to the known \u2018correct\u2019 solution means that I could not recommend it for production use especially when an \u2018expert\u2019 is not on hand to scrutinize the results.<\/p>\n<p>However if we could use the Solver problem formulation within Excel but use a different optimization engine tuned for reconciliation then we would have the perfect production data reconciliation application\u2026 watch this blog!<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Excel is the application platform of choice for many process manufacturing applications. Conversely, data reconciliation is not as widely used as it should be despite demonstrable benefits. Can we use Excel Solver to provide production-ready data reconciliation within Excel? This article describes an Excel template that uses Solver for data reconciliation. And the conclusions are [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"bgseo_title":"Is Excel Solver suitable for Production Data Reconciliation?","bgseo_description":"Excel is the application platform of choice for many process manufacturing applications. Conversely, data reconciliation is not as widely used as it should be despite demonstrable benefits. Can we use Excel Solver to provide production-ready data reconciliation within Excel? This article describes an Excel template that uses Solver for data reconciliation. And the conclusions are \u2026?","bgseo_robots_index":"index","bgseo_robots_follow":"follow","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[22],"tags":[],"_links":{"self":[{"href":"https:\/\/inova8.com\/bg_inova8.com\/wp-json\/wp\/v2\/posts\/613"}],"collection":[{"href":"https:\/\/inova8.com\/bg_inova8.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/inova8.com\/bg_inova8.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/inova8.com\/bg_inova8.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/inova8.com\/bg_inova8.com\/wp-json\/wp\/v2\/comments?post=613"}],"version-history":[{"count":6,"href":"https:\/\/inova8.com\/bg_inova8.com\/wp-json\/wp\/v2\/posts\/613\/revisions"}],"predecessor-version":[{"id":1419,"href":"https:\/\/inova8.com\/bg_inova8.com\/wp-json\/wp\/v2\/posts\/613\/revisions\/1419"}],"wp:attachment":[{"href":"https:\/\/inova8.com\/bg_inova8.com\/wp-json\/wp\/v2\/media?parent=613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/inova8.com\/bg_inova8.com\/wp-json\/wp\/v2\/categories?post=613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/inova8.com\/bg_inova8.com\/wp-json\/wp\/v2\/tags?post=613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}