+ Reply to Thread
Results 1 to 8 of 8

Trying to minimize a non-continuous function that depends on data-validation lists

  1. #1
    Registered User
    Join Date
    09-25-2018
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    4

    Trying to minimize a non-continuous function that depends on data-validation lists

    So, I built a big model to optimize the renewable energy system in a planned community. It calculates building loads based on local weather data, models how those loads would be satisfied by a slew of different technologies, estimates the capital and operation costs of those systems, and outputs a simple payback for the community energy system. I've made a central control sheet where you can choose which configuration of technologies are currently being modeled and the operating parameters of the respective technology. Each decision is made by selecting an option in a cell with data-validation accepting some list, usually, strings containing the name of each technology but sometimes they're numerical operating temperatures or capacity factors. Based on the options selected, the back end of the model considers different spec sheets and gives a different performance output. I'd like to minimize the payback period. As it stands, I could run through all the options manually, but given the number of options, I'd be doing this for a while. I was hoping there's some way that Excel can monitor the payback cell while running through the valid options for these decision cells. Ideally, I'd like to find the lowest 10 configurations, but I'd settle for not having to run through every option manually. I'm really just hoping I won't have to completely retool the model.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Trying to minimize a non-continuous function that depends on data-validation lists

    I see two options.

    The first one is a long-shot. But it might be possible to model it in such a way that Solver can be used. Based on your description of having string inputs, I doubt that this may be possible.

    The other is brute-force VBA. Run though every option, record the parameters, record the results and report it with a pivot table.

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    09-25-2018
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    4

    Re: Trying to minimize a non-continuous function that depends on data-validation lists

    Hi, thanks for the reply. I can't upload the whole thing, or even a working version, it's too big. Here's a copy of the control panel that I've used, but obviously it doesn't have any referencing to the other sheets. Hopefully you can get an idea of what is going on. The blue cells are the system configuration decision cells, while the red cells are outputs or parameters that are not intended to be changed during an optimization run.

    I've considered recording a macro and just slogging through all the options, but there are quite a few. The problem is I'm quite a neophyte when it comes to VBA. That said, I'm by no means averse to learning more.
    Attached Files Attached Files

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Trying to minimize a non-continuous function that depends on data-validation lists

    I can mount a brute force attack on the problem. You will have to add another sheet with some tables that hold parameters but I'll tell you how to do that. Then you can "re-attach" the missing sheets.

    Basically, I am going to loop through all possible settings (everywhere you have a drop down). However I need to know where to look for the "answer." Would that be cell P47? If you think it worthwhile I could capture the data in P25:P47.

    You could compress the file and attach it as a ZIP file.

  5. #5
    Registered User
    Join Date
    09-25-2018
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    4

    Re: Trying to minimize a non-continuous function that depends on data-validation lists

    Hmm, I've trimmed the size down so that it's less than 9 Mb and used WinRAR to convert it into a zip file, but I'm still not able to upload it. I get a file(s) are too large to process error. Any ideas?

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Trying to minimize a non-continuous function that depends on data-validation lists

    It probably doesn't matter. I just pried in under the hood and came up with the following: I have no idea how long it takes to do a calculation. There are 7 dropdowns for Storage with a combination of 7,200 ways. There are 4 for electrical with 40,000 ways. There are 3 for thermal with 16 ways.

    Taken all together, there are 4,608,000,000 combinations.

    Assuming one complete computation a second (very optimistic), that's 4,608,000,000 seconds or 76,800,000 minutes or 1,280 hours or 53,333 days or a tad over 146 years . I'm an old fart. I don't have 146 years.

    So brute force is out. Here is a thought.

    You have 24 different scenarios: 3 storage types with 2 temperature types and 2 thermal technologies, centralized of distributed and on demand or ASHP electric tanks. You will have to run a study for each of these.

    All the rest of the dropdown are numeric data and could be modeled by Solver (theoretically).

    Take "samples:" 3 low temp from (A), 3 low temp to (B), 3 high temp from (C) and so on.

    Record these in columns A, B, C ... and in the last column the observed value for this combination. Then make assumptions for the values of A, B, C... Make another column that computes a predicted value = A*low-temp-from + B*low-temp-to + C*high-temp-from ...

    Take the difference between the observed and predicted. Square it. Get the sum of the squares and minimize it using solver allowing solver to vary A, B, C ...

    I can show you how to set this up with a small example.

    Populating the variables (assuming one answer a second) would take about 2.5 hours per scenario. Figure on an 8 hour day at least.

    Even at that, a linear model may not work. Some factors may be non-linear.

    In theory: it's possible. In practice it's difficult and not really a task for a PC to tackle.

  7. #7
    Registered User
    Join Date
    09-25-2018
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    4

    Re: Trying to minimize a non-continuous function that depends on data-validation lists

    Do you think it's worth it? I'm thinking I might just run through the broad stroke scenarios manually and leave some of the lesser variables like roof angle proportions and number of rooftops unchanged. Collecting the outputs on a separate sheet so that I can analyse how the performance changes.

    Also, you kind of lost me on the sample taking end of things. An example would be helpful.

    Thanks again for your help, I'm pretty new to working with so much data.

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Trying to minimize a non-continuous function that depends on data-validation lists

    It is theoretically possible but rather intractable.

    My apologies for the sampling explanation Basically it's s somewhat less than random trail and error. Record all the settings for a particular trial, and then record the results. Repeat this as many times as you can bear. I suggest holding two of the areas "constant" while you vary the parameters on the other. I wouldn't do every 5% but may take samples at 0%, 35%, 65% and 100%. Then switch what two you hold constant.

    Then when you build up a database, you might be able to do some interpolation. Even if it is less than optimal. For example, you may know that the answer is somewhere between two values even if you don't know exactly what it is.

    Attached is a very short Solver example.

    I am making a BIG assumption here in that the equation that defines the results is A*(Low From) + B*(Low To) + C*(High From) + D*(High To). I dummied up the data not so randomly and this made the results come out too good.

    Columns A:D is what got set. Column E is what was observed. Column F is the results using the coefficients, A, B, C and D. Initially I set these in the range K2:N2 as 1, -1, 1, -1 respectively. Obviously this produced different results in Column F than what is shown there now.

    Column G is simply the difference between the observed and the predicted and it does not matter which order the subtraction goes since Column H is this value squared and will be a positive number unless for some reason you are using imaginary numbers.

    Cell M4 contains the sum of the squares of the differences.

    We now have all we need for Solver. We want to minimize cell M4 by varying the range K2:N2. Click the button on solver and you'll get these results. Since I picked my data poorly (not random enough), the coefficients yield exceptionally close results.

    Now for some more bad news. I'm betting that the relationship is not linear like I assumed above. When in doubt, I go with a cubic (third order polynomial) equation. So it becomes:

    A1*(Low From)^3+A2*(Low From)^2+A3*(Low From)+A4 + B1*(Low To)^3+B2*(Low To)^2+B3*(Low To)+B4 ... Oh yes, for every thing that has a numerical value and then for each scenario that doesn't have a numerical value.

    And this will only get you the curve. To get the maximum or minimum, you'll need to use calculus to differentiate it and then then solve that equation for zero.

    Yeah, right! In theory possible. In practice: Record what you set, record what you got as an answer for a number of combinations and make a best interpolation your eyeballs and brain can come up with. You may find some factors less important than others, so maximize them and hold them constant.

    I'm sorry I can't give you a better answer, but when I first looked at this, I did not realize how many combinations there were and that a brute force method was impractical.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Ms access Vba Save Data to xl depends upon 1 table pick & Depends 2 Upon fiterDate
    By breadwinner in forum Access Programming / VBA / Macros
    Replies: 14
    Last Post: 05-29-2014, 10:59 PM
  2. Need help on Drop down list from data validation depends upon first value select
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-20-2013, 06:09 PM
  3. Replies: 5
    Last Post: 03-12-2010, 10:56 AM
  4. Data validation function and drop-down lists
    By Colleen in forum Excel General
    Replies: 3
    Last Post: 03-05-2006, 08:50 PM
  5. [SOLVED] Data validation function and drop-down lists
    By Colleen in forum Excel General
    Replies: 3
    Last Post: 03-05-2006, 08:50 PM
  6. [SOLVED] Data validation function and drop-down lists
    By Colleen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2006, 08:50 PM
  7. [SOLVED] Data validation function and drop-down lists
    By Colleen in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-05-2006, 08:50 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1