<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/aiplatform/v1/study.proto

namespace Google\Cloud\AIPlatform\V1\StudySpec;

use UnexpectedValueException;

/**
 * The available search algorithms for the Study.
 *
 * Protobuf type <code>google.cloud.aiplatform.v1.StudySpec.Algorithm</code>
 */
class Algorithm
{
    /**
     * The default algorithm used by Vertex AI for [hyperparameter
     * tuning](https://cloud.google.com/vertex-ai/docs/training/hyperparameter-tuning-overview)
     * and [Vertex AI Vizier](https://cloud.google.com/vertex-ai/docs/vizier).
     *
     * Generated from protobuf enum <code>ALGORITHM_UNSPECIFIED = 0;</code>
     */
    const ALGORITHM_UNSPECIFIED = 0;
    /**
     * Simple grid search within the feasible space. To use grid search,
     * all parameters must be `INTEGER`, `CATEGORICAL`, or `DISCRETE`.
     *
     * Generated from protobuf enum <code>GRID_SEARCH = 2;</code>
     */
    const GRID_SEARCH = 2;
    /**
     * Simple random search within the feasible space.
     *
     * Generated from protobuf enum <code>RANDOM_SEARCH = 3;</code>
     */
    const RANDOM_SEARCH = 3;

    private static $valueToName = [
        self::ALGORITHM_UNSPECIFIED => 'ALGORITHM_UNSPECIFIED',
        self::GRID_SEARCH => 'GRID_SEARCH',
        self::RANDOM_SEARCH => 'RANDOM_SEARCH',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}


