2023 mathorcup question A application ideas of quantum computer in combination optimization of credit score cards

2023mathorcup Question A Application Ideas of Quantum Computer in Credit Score Card Combination Optimization Produced by "gzh Digital Model Incubation Park"

Let me talk about the difficulty of this question first, mainly in calculation, calculation, calculation, and calculation of optimization algorithm. The three questions are all about this, and they are transformed into QUBO form and solved

Question 1 requires to find 1 credit card and its corresponding threshold among 100 credit score cards, so that the final income is the most. We can use the traversal method to solve this problem. First, the problem needs to be converted into a QUBO (Quadratic Unconstrained Binary Optimization) form so that it can be solved using quantum computing or other optimization algorithms.

The title gives a form, and a lot of information can be read in that form! It must be noted that when doing digital modeling, the information revealed by the form is the direction of your action. This kind of given will be easier to do than that kind of openness, and everyone who understands can understand.

Let me analyze the table first. In the table, we can analyze the loan interest income and bad debt losses brought by each credit score card under different thresholds. For banks, the key is to find an appropriate threshold to balance the pass rate and bad debt rate, so as to maximize the final income. Now we can calculate the income of each credit scorecard at each threshold and find the optimal solution.

Assuming that the average amount of each loan is A and the loan interest rate is r, we can calculate the loan interest income and bad debt loss under each threshold, and then get the final income:

Final Income = Loan Interest Income - Bad Debt Loss

= A × pass rate × r - A × pass rate × bad debt rate

In order to simplify the calculation, we can cancel A to get a simplified income formula:

Simplified income = pass rate × r - pass rate × bad debt rate

By computing the simplified income for each scorecard at each threshold, we can find the optimal threshold and scorecard.

This is the information read from the form.

Start text:

To model this problem as a QUBO (Quadratic Unconstrained Binary Optimization) problem, we first need to convert it into a quadratic unconstrained optimization problem. For this problem, we can adopt the following strategies:

It must be converted into a binary variable here, and it must be. The following questions are all based on this question.

Use binary variables to represent credit scorecard choices. For each credit scorecard i (1 <= i <= 100), we introduce 10 binary variables x_i1, x_i2, ..., x_i10, where x_ij represents whether the threshold j of credit scorecard i is selected or not. If threshold j is chosen, then x_ij = 1, otherwise x_ij = 0.

Since we need to select 1 credit scorecard and its corresponding threshold, we need to add a constraint to ensure that only one threshold is selected for each credit scorecard, that is, there is one and only one x_ij = 1 for all i. To convert this constraint into QUBO form, we can express it as a quadratic penalty term. For each i, we can add a penalty term λ * (Σ_j x_ij - 1)^2, where λ is a penalty coefficient large enough to ensure that the constraints are satisfied.

Next, we need to define the objective function, which is to maximize the final income. According to the problem description, final income = loan interest income - bad debt loss. To simplify the calculation, we can first calculate the simplified income of each credit scorecard at each threshold (pass rate × interest income rate - pass rate × bad debt rate), and then find the credit scorecard and threshold that maximize the simplified income.

Our goal is to maximize the simplified income, so the objective function can be expressed as:

Objective function = Σ_i Σ_j (pass rate_ij × interest income rate - pass rate_ij × bad debt rate_ij) × x_ij

Adding the constraints to the objective function, we get:

QUBO objective function = Σ_i Σ_j (pass rate_ij × interest income rate - pass rate_ij × bad debt rate_ij) × x_ij + Σ_i λ * (Σ_j x_ij - 1)^2

Now, we have transformed the problem into a QUBO problem, followed by the optimization algorithm for calculation:

One of the more classic ones is casually used here, and you can change it. There are actually many optimization algorithms.

By the way, let me popularize common optimization algorithms and scenarios for everyone. After all, everyone wants to learn something, not for the water competition, right? (manual dog head)

Gradient descent algorithm: It is mainly used to solve the minimum value of the continuously derivable objective function. By computing the gradient (derivative) of the objective function, the variable values ​​are updated along the negative direction of the gradient until a local minimum is found.

Newton's Method: Newton's method is an optimization algorithm based on the second-order derivative (Hessian matrix). By calculating the gradient and Hessian matrix of the objective function, the second-order Taylor expansion is used to approximate the objective function to find a local minimum.

Stochastic Gradient Descent (SGD): SGD is a variant of the gradient descent method, suitable for large-scale data sets. During each iteration, SGD randomly selects a sample or a small batch of samples from the data set to calculate the gradient, thereby reducing the computational complexity.

Particle Swarm Optimization (PSO): PSO is an optimization algorithm based on swarm intelligence, which simulates the foraging behavior of birds. Each particle in the particle swarm represents a potential solution, and the global optimal solution is found by continuously updating the particle position and velocity.

Genetic Algorithm (GA): Genetic Algorithm is an optimization algorithm that simulates the process of biological evolution. Through operations such as encoding, crossover, mutation and selection of solutions, the retention and reproduction of excellent solutions can be realized, so as to find the global optimal solution. .

Simulated Annealing algorithm (Simulated Annealing, SA): Simulated annealing algorithm is a heuristic search algorithm that simulates the annealing process of substances at high temperatures. By randomly searching for neighborhood solutions and accepting inferior solutions with a certain probability, it avoids falling into local optimal solutions.

import numpy as np

# 假设我们有以下模拟数据

num_cards = 100

num_thresholds = 10

loan_amount = 1000000

interest_rate = 0.08

penalty_lambda = 1000



# 随机生成通过率和坏账率数据

np.random.seed(42)

pass_rates = np.random.rand(num_cards, num_thresholds)

bad_debt_rates = np.random.rand(num_cards, num_thresholds) * 0.1



# 计算每个信用评分卡在每个阈值下的简化收入

simplified_incomes = pass_rates * interest_rate - pass_rates * bad_debt_rates



# 暴力搜索最优解

best_income = -np.inf

best_card = -1

best_threshold = -1



for i in range(num_cards):

    for j in range(num_thresholds):

        # 计算当前信用评分卡和阈值下的最终收入

        income = loan_amount * simplified_incomes[i, j]



        # 如果当前收入大于已找到的最佳收入,更新最佳收入、信用评分卡和阈值

        if income > best_income:

            best_income = income

            best_card = i

            best_threshold = j



print(f"最佳信用评分卡: {best_card + 1}")

print(f"最佳阈值: {best_threshold + 1}")

print(f"最大最终收入: {best_income:.2f} 元")

Question 2 : Assuming that the three rules of credit scorecard 1 , credit scorecard 2 and credit scorecard 3 given in the data set have been selected in the description 3 of the competition, how to set their corresponding thresholds to maximize the final income, please To model this problem, convert the model to QUBO form and solve it.

We first need to convert the problem into QUBO (Quadratic Unconstrained Binary Optimization) form. We represent the thresholds of the three credit scorecards as binary variables and construct a quadratic objective function on these variables. Next, we use an optimization algorithm to find the minimum of this objective function.

First, to simplify the problem, we divide each threshold into 10 bits. For credit scorecard i (i = 1, 2, 3), we define a 10-bit binary number x_i = x_{i1}...x_{i10}, where x_{ij} = 1 if and only if the threshold j is choose. Therefore, we have the following constraints:

Σ(x_{ij}) = 1, for i = 1, 2, 3

Next, we calculate the final income. According to the description of the competition topic, the final income can be expressed as:

Final income = loan interest income - bad debt loss = loan funds x interest income rate x total pass rate x (1 - total bad debt rate) - loan funds x total pass rate x total bad debt rate

Our goal is to maximize final revenue. Since QUBO is a minimization problem, we can minimize negative final income.

We need to construct a quadratic objective function on binary variables x_{ij}. To this end, we can express the total pass rate and the total bad debt rate as quadratic functions on binary variables. For example, the overall pass rate can be expressed as:

Total pass rate = Π(Σ(t_{ij} × x_{ij})), for i = 1, 2, 3 and j = 1,...,10

where t_{ij} represents the pass rate of threshold j for credit scorecard i. Similarly, the total bad debt ratio can be expressed as:

Total bad debt ratio = Σ(Σ(h_{ij} × x_{ij}) / 3), for i = 1, 2, 3 and j = 1,...,10

Where h_{ij} represents the bad debt rate of threshold j of credit scorecard i.

Then, the final income is expressed as a quadratic function on binary variables, and the QUBO problem is solved. The solution process here is actually the same as the first question, and the optimization algorithm can be used. Examples have already been given, so I won't repeat them here.

Question 3: Choose 3 types of credit score cards from the 100 credit score cards in the appendix , and set a reasonable threshold to maximize the final income. Please model this problem and convert the model to QUBO form and solve.

We still need to represent the credit scorecard choices and thresholds as binary variables and construct a quadratic objective function on these variables. Next, we use an optimization algorithm to find the minimum of this objective function.

First, we divide the choice of credit scorecard into 100 bins: y_i = 1 if and only if credit scorecard i is chosen. We have the following constraints:

Σ(y_i) = 3, for i = 1,...,100

Next, to simplify matters, we divide each threshold into 10 bits. For credit scorecard i (i = 1,...,100), we define a 10-bit binary number x_i = x_{i1}...x_{i10}, where x_{ij} = 1 if and only if the threshold j is selected. Therefore, we have the following constraints:

Σ(x_{ij}) = 1, for i = 1,...,100

We need to incorporate these constraints into the objective function. We can achieve this using the penalty function method. First, we define a penalty function on the binary variable y_i:

P_y(y) = (Σ(y_i) - 3)^2

Then, we define a penalty function on the binary variable x_{ij}:

P_x(x) = Σ((Σ(x_{ij}) - 1)^2), for i = 1,...,100

Now, we calculate the final income. According to the description of the competition topic, the final income can be expressed as:

Final income = loan interest income - bad debt loss = loan funds x interest income rate x total pass rate x (1 - total bad debt rate) - loan funds x total pass rate x total bad debt rate

Our goal is to maximize final revenue. Since QUBO is a minimization problem, we can minimize negative final income.

We need to construct a quadratic objective function on the binary variables x_{ij} and y_i. To this end, we can express the total pass rate and the total bad debt rate as quadratic functions on binary variables. For example, the overall pass rate can be expressed as:

Total pass rate = Π(Σ(t_{ij} × x_{ij} × y_i)), for i = 1,...,100 and j = 1,...,10

where t_{ij} represents the pass rate of threshold j for credit scorecard i. Similarly, the total bad debt ratio can be expressed as:

Total bad debt ratio = Σ(Σ(h_{ij} × x_{ij} × y_i) / 3), for i = 1,...,100 and j = 1,...,10

Where h_{ij} represents the bad debt rate of threshold j of credit scorecard i.

We can express final income as a quadratic function on binary variables. Substituting the expressions for gross pass rate and gross bad debt rate into the formula for negative final revenue, we get:

Negative Final Income = Loan Funds x Total Pass Rate x Total Bad Debt Rate - Loan Funds x Interest Income Rate x Total Pass Rate x (1 - Total Bad Debt Rate)

Our goal is to minimize the negative final revenue and satisfy the constraints. Therefore, we construct a weighted quadratic objective function on the binary variables x_{ij} and y_i:

Q(x, y) = negative final income + α × P_y(y) + β × P_x(x)

where α and β are hyperparameters that adjust the weights of constraint penalties.

Then convert the problem into QUBO form. To solve, we can use optimization algorithms such as simulated annealing and genetic algorithm.

After obtaining the optimal solution, we can extract the selected credit scorecard and the corresponding threshold from the result, so as to achieve the goal of maximizing the final income.

Question C ideas https://mp.weixin.qq.com/s/ujcVcKiCsp12r_FjNpPTaA

Guess you like

Origin blog.csdn.net/shumofuhuayuan/article/details/130153547