Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a source model clustering selection method for large-scale problem agent optimization of a cloud computing environment. The technical problems to be solved by the invention are realized by the following technical scheme:
a source model cluster selection method for large-scale problem agent optimization of a cloud computing environment is applied to a cloud, and comprises the following steps:
S1, acquiring a multi-objective optimization problem of a client;
S2, an input matrix is established, and a plurality of relevant source models corresponding to the multi-objective optimization problem are obtained from a cloud database;
S3, obtaining a source model output matrix by utilizing the input matrix and the plurality of related source models, and constructing a source model feature set;
S4, clustering the plurality of related source models according to the source model feature set to obtain a target number of source models which are respectively used as primary selection source models;
S5, aggregating the multi-objective optimization problem into a real function corresponding to the single-objective optimization problem, and evaluating the input matrix by using the real function to obtain an objective output matrix;
s6, performing model training by using the input matrix and the target output matrix to obtain an initial target model;
S7, constructing a final agent model by using all the initial source models, the target output matrix and the initial target model;
S8, optimizing the final agent model to obtain optimal output;
s9, judging whether an iteration termination condition is met;
If not, executing S10, changing the weight vector for aggregating the multi-objective optimization problem, and returning to S5;
if yes, executing S11, obtaining a pareto front surface comprising a plurality of optimal outputs, and returning the pareto front surface as an optimization result to the client.
In one embodiment of the invention, the creating the input matrix includes:
Extracting n T samples in a specified interval by using a Latin hypercube sampling method, wherein each sample has d decision variables, and constructing an n T multiplied by d-dimensional input matrix by using the n T samples; wherein d is the same as the number of variables of the multi-objective optimization problem.
In one embodiment of the present invention, the obtaining a source model output matrix by using the input matrix and the plurality of related source models includes:
For each sample in the input matrix, respectively inputting the sample into each of the plurality of related source models to obtain a corresponding output result;
and the output results obtained by all samples in the input matrix form a source model output matrix.
In one embodiment of the present invention, the constructing a source model feature set includes:
Transposing the source model output matrix, and determining the transposed matrix as a source model feature set; wherein the source model feature set represents feature vectors of the plurality of related source models, each feature vector having n T features.
In one embodiment of the present invention, clustering the plurality of related source models according to the source model feature set to obtain a target number of source models as primary selected source models, respectively, includes:
according to the feature vector of each source model in the source model feature set, a k-means clustering method is adopted to gather the related source models into a target number of categories;
for each category, determining the mass center of the source model group under the category, and determining the source model corresponding to the feature vector closest to the mass center as the primary source model of the category.
In one embodiment of the present invention, for each class, determining a centroid of a source model group under the class, and determining a source model corresponding to a feature vector closest to the centroid as a primary source model of the class includes:
for each category, determining the centroid of the source model group under the category by utilizing the Euclidean distance formula;
Calculating Euclidean distances between all feature vectors in the category and the centroid;
And determining the source model corresponding to the feature vector with the minimum Euclidean distance as the primary selected source model of the category.
In one embodiment of the present invention, the aggregating the multi-objective optimization problem into a real function corresponding to a single-objective optimization problem includes:
And polymerizing the multi-objective optimization problem into a real function corresponding to the single-objective optimization problem by using a Chebyshev method.
In one embodiment of the present invention, the training of the model by using the input matrix and the target output matrix to obtain an initial target model includes:
Model training is carried out by utilizing the input matrix and the target output matrix and utilizing a leave-one-out method to obtain n T models;
And averaging the n T models to obtain an initial target model.
In one embodiment of the present invention, said constructing a final proxy model using all of the initially selected source models, the target output matrix, and the initial target model includes:
constructing a final agent model by all the initially selected source models, the target output matrix and the initial target model, and solving a group of regression coefficients by using a first preset formula;
Constructing a final agent model by using the set of regression coefficients and a second preset formula;
The first preset formula includes:
Minimize:
Subject to:
The second preset formula includes:
Wherein each of α j and α T represents a regression coefficient; Representing a j-th primary source model; /(I) Representing the initial target model; y (i) represents an element in the target output matrix; k represents a target number; x (*) represents an input variable.
In one embodiment of the present invention, the optimizing the final proxy model to obtain an optimal output includes:
and carrying out evolution search on the final agent model to obtain an optimal solution, and substituting the optimal solution into the real function to obtain optimal output.
When meeting the optimization task with very high calculation cost, the embodiment of the invention provides a better source model selection scheme according to the clustering of the source model feature sets by using the method for constructing the source model feature sets by using the output matrix of the source model under the technical background of the cloud computing platform, so that reasonable and reliable selection basis and selection scheme can be provided for a client on the source model selection in the multi-problem agent field, the diversity of agent models can be ensured, the model is closer to a real target model, and the precision and the accuracy of an optimization result can be improved. Compared with the source model of the related task selected by the client at random, the method and the device can fully search the related source model of the cloud database and conduct classification selection, so that a better effect can be obtained.
The present invention will be described in further detail with reference to the accompanying drawings and examples.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The optimization task submitted to the cloud by the client is solved by selecting a group of models which are more diverse and closer to the real function at the cloud as agent models of the current task according to the source model selection when Multi-problem agent (Multi-problem Surrogates) optimization is used for evaluating more expensive problems. The embodiment of the invention provides a source model cluster selection method for large-scale problem agent optimization of a cloud computing environment, which is applied to a cloud. Referring to fig. 1, the method includes the steps of:
s1, acquiring a multi-objective optimization problem of a client.
The multi-objective optimization problem is an optimization problem that the client wants to solve and contains multiple objectives. And the cloud acquires the multi-objective optimization problem as an own optimization task.
It will be appreciated that the multi-objective optimization problem is represented as a plurality of functions to be optimized simultaneously, which contain a plurality of variables, and the optimal output of the functions is achieved by seeking optimal solutions of the variables.
S2, an input matrix is created, and a plurality of relevant source models corresponding to the multi-objective optimization problem are obtained from a cloud database.
The input matrix represents a matrix of a plurality of input variables of the multi-objective optimization problem. In the embodiment of the invention, a plurality of input variables matched with the multi-objective optimization problem can be generated by utilizing any existing sampling method to form an input matrix.
In an alternative embodiment, the creating the input matrix may include:
n T samples are extracted in a specified interval by using a Latin hypercube sampling method, each sample has d decision variables, and an n T Xd-dimensional input matrix is constructed by the n T samples.
Each sample represents an input variable, and the ith sample can be expressed as:
Wherein d is the same as the number of variables of the multi-objective optimization problem. n T and d are natural numbers greater than 0. The input matrix may be denoted by X.
The specified interval may be a [0,1] interval, etc., and the specific process of the latin hypercube sampling method is referred to the prior art, and will not be described herein.
The cloud database contains a large number of source models, the cloud can search and find the source models related to the multi-target optimization problem in the cloud database by utilizing the multi-target optimization problem, and therefore a plurality of related source models can be obtained. The specific process belongs to the prior art and is not described in detail here. For convenience of the following description, the number of several source models is denoted by B.
S3, obtaining a source model output matrix by utilizing the input matrix and the plurality of related source models, and constructing a source model feature set.
The source model output matrix is obtained by utilizing the input matrix and the plurality of related source models, and comprises the following steps:
And for each sample in the input matrix, respectively inputting the sample into each of the plurality of related source models to obtain a corresponding output result.
And the output results obtained by all samples in the input matrix form a source model output matrix.
Through the above processing, the B related source models obtain an n T ×b-dimensional source model output matrix, which can be represented by Y source, under the condition that the input matrix is taken as an input.
Wherein the constructing the source model feature set includes:
And transposing the source model output matrix, and determining the transposed matrix as a source model feature set.
Specifically, each column of the output matrix of the source model obtained currently is an output result of a related source model under different input variables, and each row is an output result of a different related source model under the same input. The criteria for selecting the source model in the embodiment of the invention is that the model which can better express the real function is expected to be found, so that the result of each column is more proper and accurate as the characteristic of the source model in a specified sample interval. Therefore, the embodiment of the invention thinks that the source models are selected in a clustering way, the clustering algorithm needs individual feature vectors, the column vector containing n T output results obtained by one relevant source model is the available feature of the relevant source model, each column vector is represented by a row vector, so that the source model output matrix Y source needs to be transposed, each row represents the feature vector of one relevant source model, and B multiplied by n T dimension is obtainedThe matrix serves as a source model feature set. The source model feature set represents feature vectors of the number of related source models, each feature vector having n T features. Clustering the feature sets represented by such feature matrices is used to pick out more desirable source models.
Because the source model (namely the related source model) obtained from the cloud database lacks some characteristic information of the source model, the embodiment of the invention skillfully uses the output matrix of the source model under the given input to construct the source model characteristic set, and the obtained source model characteristic set can better express the specific characteristics of the source model in solving the multi-objective optimization task proposed by the client, and the source model selected according to the characteristics has higher rationality and diversity.
For easy understanding of the source model feature set, please refer to fig. 2, fig. 2 is a schematic diagram of the source model feature set according to an embodiment of the present invention.
And S4, clustering the plurality of related source models according to the source model feature set to obtain a target number of source models which are respectively used as primary selection source models.
In an alternative embodiment, this step may include the steps of:
A1, according to the feature vector of each source model in the source model feature set, adopting a k-means clustering method to gather the related source models into a target number of categories.
For convenience of the following description, the target number may be represented by K, which is a natural number greater than 0.
For the k-means clustering method, please refer to the prior art, and detailed description is not given here.
A2, determining the mass center of the source model group under each category, and determining the source model corresponding to the feature vector closest to the mass center as the primary source model of the category.
In this step, the similarity between the feature vector and the centroid is measured by using a distance, and the distance calculation method can be implemented by using euclidean distance (euclidean distance), chebyshev distance, cosine distance, and the like.
In an alternative embodiment, this step may include:
for each category, determining the centroid of the source model group under the category by utilizing the Euclidean distance formula;
Calculating Euclidean distances between all feature vectors in the category and the centroid;
And determining the source model corresponding to the feature vector with the minimum Euclidean distance as the primary selected source model of the category.
Through the steps, K primary source models can be selected.
For easy understanding of S4, please refer to fig. 3 and 4. FIG. 3 is a schematic diagram of a result of clustering a plurality of related source models in a source model feature set according to an embodiment of the present invention; taking k=3 as an example in the implementation of fig. 3, 3 source model groups obtained after clustering are respectively represented by rectangles, crosses and stars. FIG. 4 is a schematic diagram of a target number of primary source models according to an embodiment of the present invention. Wherein, the coordinates of the 3 primary source models are shown in the numerical values of the graphic X and Y.
By clustering the plurality of related source models, extracting feature vectors close to a clustering center to serve as primary selection source models, the obtained primary selection source models can cover various features of the plurality of related source models, and therefore feature diversity and feature accuracy are achieved.
S5, the multi-objective optimization problem is aggregated into a real function corresponding to the single-objective optimization problem, and the input matrix is evaluated by using the real function to obtain an objective output matrix.
In an alternative embodiment, this step may be to aggregate the multi-objective optimization problem into a real function corresponding to the single-objective optimization problem using chebyshev method.
The dimension of the target output matrix is n T ×1, which can be represented by Y target.
For specific processing procedures, reference is made to the prior art, and details are not described herein, however, the method used in the embodiments of the present invention is not limited to chebyshev method, but may be linear weighted combination method, etc.
And the process of evaluating the input matrix by using the real function to obtain a target output matrix is that each sample in the input matrix is respectively input into the real function, and all the obtained outputs form the target output matrix. The target output matrix represents the true output result.
S6, performing model training by using the input matrix and the target output matrix to obtain an initial target model.
Specifically, the step may include the steps of:
b1, performing model training by using the input matrix and the target output matrix and using a leave-one-out method to obtain n T models.
It will be appreciated that the input matrix and the target output matrix each contain n T samples, the corresponding samples of both constituting one sample pair, and therefore a total of n T sample pairs. The leave-one method means: in each training, the current sample pair is taken as an excluded sample pair, and model training is carried out by using the remaining n T -1 sample pairs to obtain a model after training, so that n T models after training are obtained by sequentially changing the excluded sample pairs.
And B2, averaging the n T models to obtain an initial target model.
The embodiment of the invention can average the n T models obtained by training to obtain an initial target model which can be expressed as。
The obtained initial target model has higher accuracy through model training and model averaging.
S7, constructing a final agent model by using all the initial source models, the target output matrix and the initial target model.
In an alternative embodiment, this step may include the steps of:
C1, constructing a final agent model by using all initially selected source models, the target output matrix and the initial target model, and solving a group of regression coefficients by using a first preset formula; wherein the regression coefficients are obtained by minimizing the square error of the out-of-sample prediction.
And C2, constructing a final agent model by using the set of regression coefficients and a second preset formula. Wherein optimization of the plurality of primary source models is achieved by transfer stacking.
The first preset formula includes:
Minimize:
Subject to:
The second preset formula includes:
Wherein each of α j and α T represents a regression coefficient; Representing a predicted value of the jth primary source model under the input of the ith sample; /(I) Representing a predicted value of the initial target model at an ith sample input; y (i) represents the true value at the i-th sample input; k represents the number of targets, namely the number of primary source models; x (*) represents an unknown input variable.
And S8, optimizing the final agent model to obtain the optimal output.
The optimal solution represents the value of a corresponding variable when the multi-objective optimization problem achieves an extremum (optimal state). Specifically, the step may include:
and carrying out evolution search on the final agent model to obtain an optimal solution, and substituting the optimal solution into the real function to obtain optimal output.
Wherein an optimal solution of the final proxy model may be iteratively sought using a genetic algorithm. The genetic algorithm can adopt a multi-target genetic algorithm NSGA (Non-dominated Sorting Genetic Algorithm), NSGA-II and the like.
For a specific evolutionary search process for the optimal solution, please refer to related existing algorithms for understanding, and detailed description thereof is omitted herein.
It will be appreciated that this step results in an optimum output at the end of each iteration.
S9, judging whether the iteration termination condition is met.
The iteration termination condition may be that the number of iterations reaches a preset maximum number of iterations, such as 50 times. The number of accumulated evaluations may be up to a predetermined number of times, such as 100 times, 200 times, or 300 times.
If not, executing S10, changing the weight vector for aggregating the multi-objective optimization problem, and returning to S5.
It will be appreciated that a new iteration is started after returning to S5.
Wherein the manner of changing the weight vector that aggregates the multi-objective optimization problem may be a random manner of changing.
If yes, executing S11, obtaining a pareto front surface comprising a plurality of optimal outputs, and returning the pareto front surface as an optimization result to the client.
It will be appreciated by those skilled in the art that multi-objective optimization results in a set of non-dominant solutions where multiple objectives are best possible at the same time, which set may also be referred to as pareto (pareto) fronts. In the embodiment of the invention, the non-dominant solution is the optimal output.
As an example, please refer to fig. 5, fig. 5 is a schematic diagram of an optimization result according to an embodiment of the present invention. The black point is the optimal output, and f 1,f2,f3 represents a first optimization target, a second optimization target and a third optimization target provided by the client respectively.
To illustrate the performance of the method of the present invention, an experimental comparison was made with existing methods. The comparison results are shown in Table 1.
Table 1 comparison of the prior art method with the experimental results of the present invention (index IGD)
Number of evaluations |
Existing methods |
The method of the invention |
100 |
7.34e-2 |
6.84e-2 |
200 |
6.63e-2 |
6.43e-2 |
300 |
6.49e-2 |
6.23e-2 |
The reverse generation distance evaluation index (Inverted Generational Distance, abbreviated as IGD) is an evaluation index for comparing comprehensive performances. IGD mainly employs a method of calculating the minimum sum of distances between each point on the real pareto front to the individual set obtained by the algorithm. The smaller the IGD value, the better the convergence and distribution performance of the algorithm, i.e., the better the overall performance. From the experimental results, it can be concluded that: under the condition that the evaluation times are the same, the optimization results obtained by the method of the embodiment of the invention are better than those obtained by the existing method.
Therefore, when meeting the optimization task with very high calculation cost, the method for constructing the source model feature set by using the output matrix of the source model in the technical background of the cloud computing platform provides a better source model selection scheme according to the source model feature set clustering, so that reasonable and reliable selection basis and selection scheme can be provided for a client on the source model selection in the multi-problem agent field, the diversity of the agent model can be ensured, the method is closer to a real target model, and the precision and the accuracy of the optimization result can be improved. Compared with the source model of the related task selected by the client at random, the method and the device can fully search the related source model of the cloud database and conduct classification selection, so that a better effect can be obtained.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
The foregoing is merely illustrative of the preferred embodiments of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.