Optimization Tag

Optimizers

Only one optimization block is allowed; however, multiple optimization routines may be specified. Mason will run each optimizer in sequence. Each optimizer allows a set number of arguments; generally the number of iterations is considered a maximum. The optimizer works to minimize the goals. The “power” argument defaults to 2, and refers to how the goal functions are summed:

The optimizer can be run from the GUI.

The goal block includes a muParser-style calculation, with a minimum and maximum desired range. If multiple goals are given, the evaluations are summed. The S-Parameters for the goals follow the pattern [{S_reflected_driven}], as below.

<optimization>

<random iterations="100”></random>

<simplex iterations=”100” power=”2”></simplex>

<goal calculation=”20*log10(abs(S_1_1))”

min=”-200”

max=”-20”

weight=”1”></goal>

</optimization>

The goals can be tailored to only apply for certain frequencies. See the the goals section for more information.

Look at the device section to see how to embed optimization limits for particular parameters.

TinyCAD

The optimization block looks as follows in the GUI, essentially everything in the TinyCAD component is pasted into the Mason file and follows a fairly logical progression. Do not include more than one optimization block, I've put a few to show a couple of different strategies.

Genetic has the most options. Generally you can get away with not putting values in quotes, but if a space is involved in the value (like "5 %"), then quotes are needed. Technically, you could use 5% and not have a space...

When you click on the optimization component, the following window pop-ups (click to enlarge). Initially only one Optimizer and one Argument are defined. Below, a second optimizer has been added using the Add button in the bottom left.

Turning Goals Temporarily Off

In TinyCAD, goals (and specific optimizer steps) can be turned off by clicking on the "Show?" field for that goal (or optimization step).

Details

Each frequency is evaluated for the goals, and the deviations from the goal at each frequency is squared, summed, and rooted. This sum is the Figure of Merit (expect when the ranking algorithm is used in the Genetic Algorithm).

After each optimizer is run, the best values (based on the figure of merit) is propagated to the next optimization.

See also: Goals for optimizations and statistical analysis, and Sets

The following are valid optimization routines:

    1. single

        1. Description: performs a single run on the current values

          1. If no optimizations are defined, a single run will be performed by default

          2. If optimizations are defined, a single run is performed at the beginning and at the end of the optimization sets, to ensure the output data corresponds with what's in the files

        2. Inputs

            1. None

    2. random

        1. Description: uses random numbers to guess at a solution

          1. Fills the device values with a random uniform distribution

          2. Uses the minimums, maximums and steps defined in each variable or device's parameter

        2. Inputs

            1. iterations: number of circuits that will be evaluated with randomized values

    1. simplex

        1. Description: simplex is a non-linear gradient search

            1. Able to optimize over both linear and discrete values simultaneously

            2. Deterministic solution- not random

        2. Inputs

            1. iterations: number of times the simplex algorithm is called; generally speaking one is enough

            2. tolerance (default 1e-6): when the difference between the gradient steps of the normalized FOM drops below this value, stop the optimizer. The value is compared against the current gradient step divided by the allowable spread: delta/(opt_max-opt_min)

    1. step (see validation18.txt)

      1. Description: sweep through the first two valid optimization parameters

        1. Sweeps an <opt> tag from a variable or an <opt> tag embedded in a device argument

        2. Steps from opt_min to opt_max, step must be non-zero

        3. Outputs two or three MATLAB compatible files

          1. If only one parameter swept, a *.x and a *.z file

          2. If two parameters swept, a *.x, *.y, and *.z file (can be used in mesh/ surf command)

      2. Inputs

        1. none

  1. genetic (see validation23.txt)

      1. Description: genetic algorithm

        1. ensures that every member evaluated is unique by forcing mutations if a member has already been tried.

        2. uses proportional selection. Eventually I'll add the option for other selection schemes like tournament or flat.

        3. uses elitism: the number of best people kept to the next generation is controlled with a flag.

        4. uses two types of mutation. One is a traditional mutation, a random generation on an individual gene (somewhere between the defined max and min). The seconds is a creep, a mutation with a smaller variance centered on the current value (allows for searching the space close to an established solution).

        5. Rank selection/ weak Pareto-optimization is coded in, use the "rank" flag

        6. I don't have a micro GA coded in yet, but running multiple GAs during a run is advised and has a similar effect.

      2. Comment: To be honest, random + simplex will very often be more efficient that a genetic algorithm. Genetic algorithms are useful at solving problems that have no gradient; most circuit problems actually are amenable to gradient type searches.

      3. Inputs

        1. iterations: number of generations

        2. population (default 100): size of the population

        3. rank (default false): if true, use the ranking algorithm (aka weak pareto) for the GA

          1. Note that number_of_best_kept behaves a little differently between ranking and not

        4. first_generation_multiplier (default 4): the first generation will contain a number of citizens equal to "population" times "first_generation_multiplier". Subsequent generations will contain "population" citizens.

        5. mutation_rate (default 0.1%): mutation rate, can be entered as "0.001" or "0.1 %" (you can use percent sign as a unit) ; probability cast against each gene that the gene will be re-rolled (completely new, random value which still falls in the valid range).

      1. number_of_best_kept (default 1): relevant after a population has been evaluated. If ranking used: citizens with this rank or lower will be passed on to the next generation. If ranking not used: this many citizens will be passed on to the next generation.

        1. Note that for ranking, a value of 1 will still keep a bunch of citizens. Be careful not to set this too high when switching to ranking.

      1. creep_rate (default 0.1 %): creep rate, can be entered as "0.001" or "0.1 %"; probability cast against each gene that the value will be modified. Value will be multiplied against a random uniform distribution with a mean about the current value and a range that is (creep_amount * current_value).

      2. creep_amount (default 10 %): percent of the range for the value (opt_max - opt_min) that will make up the range for a random change in value.

      3. selection (default proportional): One of three types of selection algorithms for choosing mates for crossover

        1. "flat": each element has equal weighting

        2. "proportional": elements have weighting proportional to their normalized figure of merit (note: if ranking used, proportional to rank)

        3. "tourney": use the tourney algorithm

      1. tourney_size (default 1): size of the tournament used in selection (if tourney used).

      2. A reasonable starting place for your GA is:

        1. genetic iterations=100 population=100 first_generation_multiplier=4 selection=tourney tourney_size=5

        2. Feel free to experiment, I have good luck starting with this

Copyright 2010, Gregory Kiesel