idaholab / raven

RAVEN is a flexible and multi-purpose probabilistic risk analysis, validation and uncertainty quantification, parameter optimization, model reduction and data knowledge-discovering framework.
https://raven.inl.gov/
Apache License 2.0
217 stars 133 forks source link

Vector inputs to Optimization Routines #2207

Open cbroman-usnctech opened 10 months ago

cbroman-usnctech commented 10 months ago

Issue Description

I am looking to run an Optimization routine such as Gradient Descent or Genetic Algorithm on a vector of values.

For example: I have a building of 80 stories, I want to optimize the number of tenants on each floor to maximize profit. (More people means smaller rooms = less $ per room, Fewer people bigger rooms = more $ per room, higher up = $ more money). I would like to initialize a vector named tenantSize of length 80, with a range of 1-100.

To take this one step further could I run this Optimization concurrently on 20 buildings of differing height (different number of floors). Where the fitness is based on the collective fitness of the 20 buildings?

Is your feature request related to a problem? Please describe. The issue is I have multiple, nearly identical variables, I would like to update in my model all at one time, but they do need to remain unique in that their placement within the model matters to the fitness.

Describe the solution you'd like Optimization routines can handle vectors of inputs rather than scalers.

Describe alternatives you've considered Writing a script that generates 20 X 80 unique scalers and plugs them into the input xml, then map them back to their respective places in our interface.


For Change Control Board: Issue Review

This review should occur before any development is performed as a response to this issue.


For Change Control Board: Issue Closure

This review should occur when the issue is imminently going to be closed.

alfoa commented 9 months ago

@cbroman-usnctech hope everything is going great. can you attach an input (with "masked" variables) that show what/how you envision the modification to work? (I might have a need to something similar and I probably implement a common approach)

cbroman-usnctech commented 9 months ago

Hi @alfoa! Swimmingly 🏊. Hoping the same to you!

For the above building analogy, my proposed input would look something like the following:

 <Optimizers>
    <GeneticAlgorithm name="GAoptimizer">
      <samplerInit>
        <limit>5</limit>
        <initialSeed>42</initialSeed>
        <writeSteps>final</writeSteps>
      </samplerInit>

      <GAparams>
        <populationSize>17</populationSize>
        <reproduction>
          <crossover type="onePointCrossover">
            <crossoverProb>0.9</crossoverProb>
          </crossover>
          <mutation type="swapMutator">
            <mutationProb>0.1</mutationProb>
          </mutation>
        </reproduction>
        <fitness type="logistic">
          <a>0.2</a>
          <b>13.0</b>
        </fitness>
        <parentSelection>rouletteWheel</parentSelection>
        <survivorSelection>fitnessBased</survivorSelection>
      </GAparams>

      <convergence>
        <objective>-1</objective>
      </convergence>

      <constant name="buildingNum">10.0</constant>      <!--  defines the number of buildings (assemblies) -->

      <variable type=vector name="FloorNums">                  <!-- initializes the number of floors (blocks) in a building -->
        <distribution>unif_dist</distribution>
        <initial>80,30,20,2,50,60,23,80, 45,67</initial>
      </variable>

      <variable type=vector name="tenantNum">            <!-- check what happens with vector of tenants (list of concentrations) -->
        <distribution>unif_dist</distribution>
      </variable>

    </UniformDiscrete>
        <UniformDiscrete name='uniform_dist'>
      <lowerBound>1</lowerBound>
      <upperBound>100</upperBound>
      <strategy>withOutReplacement</strategy>
    </UniformDiscrete>

The function will optimize on all buildings (assemblies), of various heights, and different tenant concentrations.

The final fitness ($) will be a function of its FloorNums (axial-Z-height), tenantNum (components), and building size. Let me know if this needs some clarification.