Product Documentation
Virtuoso Variation Option User Guide
Product Version IC23.1, November 2023

Example of Custom Optimization Algorithm

You can create a custom optimization algorithm either in C++ or Python.

The following piece of code shows an example of the custom optimization algorithm written in Python.

# ***************************************************************************
#                Copyright 2023 Cadence Design Systems, Inc.
#                           All Rights Reserved.
#
# This work cannot be republished or copied in its original form
# without prior written permission from Cadence Design Systems, Inc.
#
# Permission is granted to modify this code for the purpose of
# developing new optimizers to run within Virtuoso Studio.
# ***************************************************************************
import dso 
import numpy as np
import random
random.seed(1)
class RakOptimizer(dso.BaseOptimizer):
    def __init__(self):
        super().__init__()
        self.optimizer_info.set_optimizer_name(name='RAK Optimizer')
        self.optimizer_info.set_hyperparameter_property_range(
            hp='batchSize',
            hp_default=2,
            hp_min=2,
            hp_step=1,
            hp_max=1000,
            hp_description='Controls Batch Size')
    # def pre_processing(self):
    #     pass
    def get_points(self):
        point_dic = self.domain.sample(size=self.hyper_params['batchSize'])
        point_array = point_dic.parse_into_object(out_type=np.ndarray)
        ret = dso.GetPointsReturnType()
        ret.parse_from_object(domain=self.domain, samples=point_array)
        return ret 
    def record_evaluations(self, evaluation_result):
        pass
if __name__ == '__main__':
    RakOptimizer().run()

Methods Used in the Custom Optimization Algorithm Example

In the example of custom optimization algorithm, following methods are used:

Related Topics

Advanced Optimization

Advantages of Advanced Optimization

AOP Options Form

Running Advanced Optimization

Integrating a Custom Optimizer into ADE Assembler


Return to top
 ⠀
X