[2023 Huashu Cup National College Student Mathematical Contest in Modeling] Question B Optimal color scheme design for opaque products 39-page paper and python code

[2023 Huashu Cup National College Student Mathematical Contest in Modeling] Question B Optimal color scheme design for opaque products 39-page paper and python code

insert image description here

1 topic

Problem B Optimal color scheme design for opaque products

The colorful opaque colored products in daily life are dyed by colorants. Therefore, the color matching of opaque products plays an important role in its appearance and market competitiveness. However, traditional artificial color matching has certain limitations, such as strong subjectivity and low efficiency. Therefore, it is of great significance to study how to realize the color matching of opaque products by computer methods.

Light propagates through objects in three ways: absorption, reflection, and transmission. For opaque articles, most of the light is absorbed or reflected by the surface. The absorbed and reflected light is decomposed into different color components according to wavelength after correction such as transparency, forming a spectral map. This spectrum usually consists of the colors of light in the 400–700nm band. To simplify the calculation, the reflectance of the color after the final color matching is represented by the spectral data at intervals of 20nm. For opaque materials, there is a certain relationship between the ratio of the absorption coefficient K/scattering coefficient S and the reflectivity R. For details, please refer to the KM optical model in [1] "Research on Computer Color Matching Theory and Algorithms".

The color parameters obtained based on the optical model can be applied to the calculation of color difference. Usually, the color difference (no more than 1) is used as the standard for the color matching effect. Color difference calculation method references [2] The total color difference calculation method of CIELAB color space in "Research on Blended Fabric Color Measurement Based on CIELAB Uniform Color Space and Clustering Algorithm". The calculation method of the tristimulus value XYZ appearing in the calculation of the color parameters L* (lightness), a* (red-green degree) and b* (yellow-blue degree) is as follows: X = k ∫ 400 700 S ( λ ) x
( λ ) R ( λ ) d ( λ ) Y = k ∫ 400 700 S ( λ ) y ( λ ) R ( λ ) d ( λ ) Z = k ∫ 400 700 S ( λ ) z ( λ ) R ( λ ) d ( λ ) X = k \int_{400}^{700} S(\lambda) x(\lambda)R(\lambda)d(\lambda)\\ Y = k \int_{400}^{700} S(\lambda) y(\lambda)R(\lambda)d(\lambda)\\ Z = k \int_{400}^{700} S(\lambda) z(\lambda)R(\lambda)d (\lambda)\X=k400700S ( λ ) x ( λ ) R ( λ ) d ( λ )Y=k400700S ( λ ) y ( λ ) R ( λ ) d ( λ )Z=k400700S ( λ ) z ( λ ) R ( λ ) d ( λ ) 

Among them, S (l) is the spectral energy distribution, x ( λ ) x(\lambda)x ( λ ) ,y ( λ ) y(\lambda)y ( λ ) ,z ( λ ) z(\lambda)z ( λ ) is the spectrum tristimulus value of the observer,S ( λ ) S(\lambda)S ( λ ) andx ( λ ) x(\lambda)x ( λ ) ,y ( λ ) y(\lambda)y ( λ ) ,z ( λ ) z(\lambda)See Appendix 1 for multiplying z ( λ ) to a fixed value. R ( λ ) R(\lambda)R ( λ ) is the spectral reflectance, the value of k is about 0.1,d ( λ ) d(\lambda)d ( λ ) is the wavelength interval of the reflectance of the measured object, this questiond ( λ ) d(\lambda)d(λ) =20nm。

The problem of color matching of opaque products is to design the color matching model of opaque products based on the optical model. Compared with manual color matching, it saves a lot of manpower, material resources and financial resources, which is of great significance to reduce energy consumption.

For an opaque product, the K/S values ​​of the red, yellow and blue colorants at different concentrations and different wavelengths and the K/S values ​​of the base material at different wavelengths are known, see Annex 2. Wherein, concentration=colorant gram weight/substrate weight. The ratio of the absorption coefficient K/scattering coefficient S of each colorant is additive, please refer to the KM single constant theory in [1] "Research on Computer Color Matching Theory and Algorithm" for details. See Appendix 3 for the R values ​​of 10 target samples (made by mixing two to three colorants). Please keep 4 decimal places for the result display.

Please build a mathematical model to solve the following problems:

Question 1: Please calculate the relationship between K/S and concentration of the three colorants in Annex 2 at different wavelengths, and fill in the relationship formula and fitting coefficient in the table.

Table 1 Question 1 related result data

wavelength red yellow blue
Function relation fit coefficient Function relation fit coefficient Function relation fit coefficient
400nm
420nm
440nm
……
700nm

Question 2: Please establish an optimization model for the color matching of opaque products. On the premise of knowing the R value of the target sample (Appendix 3), based on the spectral tristimulus value weighting table (Appendix 1) and the colorant K/S basic database (Appendix 2), use the optimization model to calculate the color difference with the target sample The closest 10 different formulations require a color difference of less than 1.

Question 3: On the basis of question 2, consider cost control and batch color matching, and improve the color matching model. Match 2kg of the base material, and find 10 different formulas with the closest color difference to the target sample (Appendix 3), and the color difference is required to be less than 1. See Appendix 4 for the price per gram of masterbatch.

Question 4: In actual production, the less coloring agent required for color matching, the better. Based on this, on the basis of Question 3, find the optimal color scheme for the first 5 samples in Appendix 3, and require each sample to be formulated 5 different formulas with color difference less than 1.

Data and information provided:

  1. Attachment 1 (Spectral tristimulus value weighting table)

  2. Attachment 2 (K/S values ​​of different concentrations and different wavelengths)

  3. Annex 3 (R values ​​of 10 samples)

  4. Attachment 4 (Dye Prices)

  5. References [1] Jiang Pengfei. Research on computer color matching theory and algorithm [D/OL]. Zhongyuan Institute of Technology, 2016

  6. Reference [2] Wang Linji. Research on color measurement of blended fabrics based on CIELAB uniform color space and clustering algorithm [D]. Zhejiang Sci-Tech University, 2011.

2 Problem Analysis

2.1 Question 1

This is a linear regression problem. The fitting model was used to analyze the relationship between K/S and concentration of red, yellow and blue colorants at different wavelengths. Firstly, see the red in the data in appendix 2, when the concentration is 0.05, 0.1, 0.5, 1, 2, 3, 4 and 5, the K/S value increases with the concentration. Therefore, it is assumed that the K/S value of the red colorant has a linear relationship with the concentration at different concentrations. A linear regression is then used to fit a model to represent this relationship. Use a simple least squares method to fit a linear regression model, find the best coefficients a and b, and minimize the deviation between the fitted curve and the actual data.

2.2 Question 2

This is an optimization problem, translated into a nonlinear program solver:

Step 1: Combine the spectral tristimulus value weighting table in Table 1 with the basic database table in Table 2, calculate the K/S value of the material, and save the result as a new Table 4.

The second step is to calculate the color difference: according to the target sample R value table Annex 3 and the newly generated table 4, calculate the color difference between each formula and the target sample. Choose to use common color difference formulas, such as CIEDE2000 color difference formula.

The third step is to establish an optimization model: the formula is used as an optimization variable, and the color difference is used as an objective function to establish an optimization model that minimizes the color difference. into a nonlinear programming problem.

The fourth step is to determine the constraint: set the constraint condition that the color difference is less than 1 to ensure that the color difference between the selected formula and the target sample is less than 1.

The fifth step is to solve the optimization problem: use mathematical optimization algorithms, such as gradient descent method, genetic algorithm, etc., to solve the established optimization problem, and obtain 10 different formulas with the color difference closest to the target sample.

2.3 Question 3

On the basis of the above problems, the color matching problem is transformed into a linear programming problem, that is, the total cost of the formula is minimized under the condition that the color difference is less than 1. The specific modeling process is as follows:

Step 1: Combine the spectral tristimulus value weighting table in Table 1 with the basic database table in Table 2, calculate the K/S value of each color material, and save the result as a new Table 4. Step 2: Calculate the total amount of formula for each color: distribute 2kg of base material according to the proportion required for each color, and distribute the corresponding amount of ingredients to obtain the total amount of formula for each color. The third step is to establish an optimization model: since the total amount of the formula is a continuous variable, the total amount of the formula of each color is used as an optimization variable, and a linear programming model including cost and constraints is established, so that on the basis of minimizing the cost, the color difference is less than The constraints of 1 are as follows:
min ⁡ x , y , z 60 x + 65 y + 63 z \begin{equation} \min_{x,y,z} 60x+65y+63z \end{equation}x,y,zmin60x+65 y.o+63 z

where xxxyyy z z z represent the total amount of the formula of red, yellow and blue masterbatch respectively, the unit is gram. In order to satisfy the constraints that the color difference is less than 1, constraints need to be added:

∣ R i − R t ∣ + ∣ G i − G t ∣ + ∣ B i − B t ∣ ⩽ 1 \begin{equation} \left|R_{i}-R_{t}\right|+\left|G_{i}-G_{t}\right|+\left|B_{i}-B_{t}\right| \leqslant 1 \end{equation} RiRt+GiGt+BiBt1

x , y , z ≥ 0 x,y,z \ge 0 x,y,z0

Among them, R i R_iRi G i G_i Gi B i B_i BiIndicates the iiThe three primary colors of i recipes and target samples,R t R_tRt G t G_t Gt B t B_t BtIndicates the three primary colors of the target sample. The above constraints are used to ensure that the color difference between each formula and the target sample is less than 1. Where the variable is greater than 0, it means that the total amount of the recipe needs to be a positive number.

Step 4: Solve the optimization problem: Use a linear programming solution method, such as the simplex method or interior point method, to solve the established linear programming model, obtain 10 different formulas with the color difference closest to the target sample, and calculate each formula total cost.

2.4 Question 4

This is a mixed integer linear programming problem. Model the problem as a mixed integer programming problem. For each sample, 5 different formulations need to be found, each of which has a color difference of less than 1 and the total colorant usage is minimal. Therefore, the number of recipes is used as an integer variable, and the amount of each color used in each recipe is used as a continuous variable.

According to the modeling in the first step, a mixed integer linear programming model is obtained, in which the goal is to minimize the total colorant usage, while satisfying the constraint that the color difference among the 5 formulations for each sample is less than 1.

The constraints include: each sample requires 5 different recipes, and the amount of each color used in each recipe must be a positive number. For each sample, set a binary variable to indicate whether that sample uses a particular recipe, and use a linear constraint to ensure that no more than 5 recipes are used per sample. For each sample, set a non-negative continuous variable to represent the usage of each color in each recipe, and determine the constraints according to the color difference calculation formula.

Finally, use a mixed integer linear programming solver (such as CPLEX, Gurobi, etc.) to solve the model and obtain the optimal formulation scheme for the first 5 samples.

3 Introduction to the paper

Optimal color scheme design solution for opaque products

Summary

In daily life, the product market of colored opaque products is quite broad, and the efficient use of color matching technology is becoming more and more important. However, the traditional artificial color matching method has certain limitations. Therefore, it is of great significance to study the computer color matching method to realize the color matching of opaque products. In this paper, according to the title and the parameters and processing formulas provided by the paper, the functional relationship between the K/S value and the concentration and the fitting coefficient are obtained, and then the corresponding constraints are set according to the requirements of the title, and the corresponding optimization model is established to obtain the optimal result.

For problem 1, we draw the scatter diagram of K / S value and colorant at different wavelengths based on the relevant data , and use the least square method to linearly fit the K / S value and concentration to obtain the corresponding linear relationship and fitting coefficient. We put the scatter diagram and the linear function image in one graph, and combined with the fitting coefficient obtained from the above steps to test the fitting degree of the function, we can draw a conclusion: the fitting of the linear relational expression based on the least square method The effect is excellent.

For the second question, we determine the objective function of the single-objective model based on the functional relationship obtained from the first question and the color difference calculation formula extracted from the relevant literature, the K / S value and the R value calculation formula, that is, to obtain the color difference The minimum value, and set the constraint condition that the color difference is less than 1. Finally, using the color difference solution formula and the optimization model to get the color matching formula, it can be concluded that the color difference of the optimized formula is very close to the target sample.

For question three, we calculate the total cost of each color matching based on the given base material quality and attachment information, and weight the total cost and color difference to obtain the weighted value. When setting weights, considering that the two constraints will have different weight distributions, in order to analyze more objectively, we have separated three different weight distribution schemes for the two objectives of cost and color difference, namely "cost priority" , "Balanced" and "Color Aberration Priority". Each target sample takes the color scheme corresponding to the minimum weighted value, so as to obtain three groups of different optimal color schemes. It can be seen from the final output results that different weight distributions will have different color schemes, so the classification discussion is relatively objective and reasonable. For question 4, the requirement of "the less coloring agent the better" has been added. We start from two aspects. on the one hand

It starts with the types of colorants, the fewer the types, the better. Consider one type first. If there is no color scheme for one colorant, then choose two colorant schemes, and screen the result data obtained in question 3. The final result is found In the second aspect, considering the total gram weight of the colorant, we added the factor of total gram weight on the basis of the original objective function, and redistributed the weight. When setting different weights for cost, color difference, and total weight, considering objectivity, we also grouped them into "cost priority", "color difference priority", "efficiency priority" and "balanced type". Finally, the weighted algorithm is used to obtain five optimal color schemes for five samples.

Keywords: weighting algorithm K/M single constant theory CIELAB uniform color space color difference calculation multi-objective programming model

insert image description here

4 downloads

Go to the download link at the bottom of the Zhihu article

zhuanlan.zhihu.com/p/649533536

Guess you like

Origin blog.csdn.net/weixin_43935696/article/details/132241071