PHAY0020 THE PROCESS OF DRUG DISCOVERY 2023Processing

Java Python PHAY0020

THE PROCESS OF DRUG DISCOVERY (TPODD 1)

MAY 2023

1.       Answer BOTH parts of the question.

The use of computational based tools for successful drug discovery relies on the use of a complete high-quality structural model of the target molecule, typically downloaded from the protein data bank (PDB).

a)       Discuss the processes you would use to ensure the initial coordinate model of an enzyme from the PDB, containing a ligand in the protein active site, is made suitable to run computational  based  docking experiments. Highlight the challenges and the methods available to help validate your starting model.  (50% of marks)

b)       Given the aim to design a novel inhibitor to modulate the enzyme’s function: describe the computational approaches you might undertake to characterise and understand the target receptor binding pocket and its molecular properties, and ONE structure-based experimental approach you would utilise to generate a viable hit compound.          (50% of marks)

2.       Answer ALL parts of the question.

PT-1 was recently identified from high-throughput screening campaign to be active against the RNA methyltransferase  NSUN2. To identify more potent NSUN2 inhibitors, a small library of compounds  (PT-2 to PT-16) was synthesised using PT-1 as the lead compound, and their inhibitory activities are presented in the table below. Answer the following questions based on the chemical structures and data provided.

a)       Which drug/lead discovery strategy was used in the above approach? Provide a brief description of this method.  (25% of marks)

b)       Based on the observed IC50 values of compounds PT-1 to PT-7, what information can be deduced about the active site of NSUN2?   (20% of marks)

c)        Based on the observed IC50 values of compounds PT1 and PT-8 to PT-13, what information can be deduced about the active site of NSUN2?   (30% of marks)

d)       The most potent NSUN2 inhibitor identified is PT-13 (IC50  = 0.21 µM). Suggest an analogue of PT-13 which is likely to be more potent. Provide the chemical structure of this analogue.   (25% of marks)

3.       Answer ALL parts of the question.

You are working in a team developing drugs to treat central nervous system condit PHAY0020 THE PROCESS OF DRUG DISCOVERY 2023Processing ions. You have a hit compound which is currently undergoing development. The structure of the hit compound and some of its properties are given below.

a)       You suspect that the hit compound is a substrate of an ATP-dependent efflux pump in the blood-brain barrier. Describe THREE different approaches you could use to determine whether this is the case. Provide examples of tools/techniques you would employ in each approach.   (20%  of  marks)

b)        Discuss whether the hit compound is likely to be passively permeable across the blood-brain barrier. Your discussion should include the provided properties (cLogP and PSA) and any other relevant properties which can be derived from the chemical structure.               (50%  of  marks)

c)        Chemical approaches can be used to improve the permeability of compounds across the blood-brain barrier. For the hit compound above:

i.    Describe ONE chemical approach which could be used to improve the hit compound’s blood-brain barrier permeability.         (10%   of  marks)

ii.    Suggest ONE way in which the structure of the hit compound might be modified in the approach you suggested in part i. Explain why this modification is likely to improve blood-brain barrier permeability. (Note that no details of how to conduct the required chemical transformation  are needed).                        (10%   of  marks)

iii.    What are the potential drawback(s) which might be encountered when employing the approach you suggested in part i?       (10%   of  marks)

4.       Answer BOTH parts of the question.

Large-scale mapping of the proteome identified 11 cardiovascular proteins with causal evidence of involvement in human disease that can potentially act as drug targets. As a scientist in a small bioinformatics company with excellent resources, you are tasked with identifying one protein that can be validated as a drug target.

a)       Describe the  use of bioinformatics tools to select only one  protein for target validation by a contract research organization (CRO). To support your answer, suggest which resources could be utilized and discuss the properties that a protein should possess to be a good drug target.                     (70%   of  marks)

b)       Suggest ONE genomic method that a CRO can conduct to validate the potential of the selected protein as a drug target. Briefly describe this method and justify the selection of your chosen method         

close all; clc; clear; tic; %% 01 参数配置 W = 1280; H = 720; save_folder = "data/project"; mkdir(save_folder); save_file_csv = strcat(save_folder, "/","patterns.csv"); % 用于写入到投影仪 n = 4; % 格雷码位数 % 相移参数 N = 12; % 相移步数 A = 130; B = 90; TW = W / (2 ^ n); TH = H / (2 ^ n); %% 02 生成相移法图像 [~, patterns_phaseshift_X] = m_make_phase_shift_patterns(A, B, TW, N, W, H); [~, temp_Y] = m_make_phase_shift_patterns(A, B, TH, N, H, W); patterns_phaseshift_Y = zeros(N, H, W); for i = 1: N patterns_phaseshift_Y(i, :, :) = squeeze(temp_Y(i, :, :))'; end %% 03 生成格雷码图像:X方向 patterns_graycode_X = m_make_gray_code_patterns(n, W, H); temp_Y = m_make_gray_code_patterns(n, H, W); [num, H, W] = size(patterns_graycode_X); patterns_graycode_Y = zeros(num, H, W); for i = 1: num patterns_graycode_Y(i, :, :) = squeeze(temp_Y(i, :, :))'; end %% 04 写入图像 idx = 0; file = fopen(save_file_csv, "w+"); % 写入相移图案 X for i = 1: N idx = idx + 1; % 写入图片 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("写入文件到:" + save_file_img); img = squeeze(patterns_phaseshift_X(i, :, :)); imwrite(img, save_file_img); % 写入csv文件 img_row = squeeze(img(1, :)) * 255.; for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ",")); end fprintf(file, "\n"); end % 写入格雷码程序 X for i = 1: num idx = idx + 1; % 写入图像 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("写入文件到:" + save_file_img); img = squeeze(patterns_graycode_X(i, :, :)); imwrite(img, save_file_img); % 写入图像 img_row = squeeze(img(1, :)); for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ",")); end fprintf(file, "\n"); end % 写入相移图案 Y for i = 1: N idx = idx + 1; % 写入图片 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("写入文件到:" + save_file_img); img = squeeze(patterns_phaseshift_Y(i, :, :)); imwrite(img, save_file_img); % 写入csv文件 img_row = squeeze(img(1, :)) * 255.; for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ",")); end fprintf(file, "\n"); end % 写入格雷码程序 Y for i = 1: num idx = idx + 1; % 写入图像 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("写入文件到:" + save_file_img); img = squeeze(patterns_graycode_Y(i, :, :)); imwrite(img, save_file_img); % 写入图像 img_row = squeeze(img(1, :)); for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ","));close all; clc; clear; tic; %% 01 参数配置 calib_folder = "data/calib"; N = 12; n = 4; num = n + 2; B_min = 10; % 低于这个调制度的我们就认为它的相位信息不可靠 IT = 0.5; % 格雷码阈值 win_size = 7; % 中值滤波窗口大小 W = 1280; H = 720; points_per_row = 7; points_per_col = 6; w = 2; load("data/calib/camera_imagePoints.mat"); [~, ~, calib_num] = size(imagePoints); prjPoints = zeros(size(imagePoints)); %% 02 标定投影仪、相机 for calib_idx = 1: calib_num disp(calib_idx); data_folder = calib_folder + "/" + num2str(calib_idx); %% 02 近似查看图像圆心 img = 255 - imread(data_folder + "/18.bmp"); for i = 1: points_per_row * points_per_col xy = imagePoints(i, :, calib_idx); x = round(xy(1)); y = round(xy(2)); img(y, x) = 255; end figure(); mesh(img); %% 03 解X\Y相位 files_phaseShiftX = cell(1, N); idx = 1; for i = 1: N files_phaseShiftX{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end files_grayCodeX = cell(1, num); for i = 1: num files_grayCodeX{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end files_phaseShiftY = cell(1, N); for i = 1: N files_phaseShiftY{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end files_grayCodeY = cell(1, num); for i = 1: num files_grayCodeY{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end [phaX, difX] = m_calc_absolute_phase(files_phaseShiftX, files_grayCodeX, IT, B_min, win_size); [phaY, difY] = m_calc_absolute_phase(files_phaseShiftY, files_grayCodeY, IT, B_min, win_size); phaX = phaX * W; phaY = phaY * H; for i = 1: points_per_row * points_per_col xy = imagePoints(i, :, calib_idx); x = xy(1); y = xy(2); x_round = round(x); y_round = round(y); % 对x、y附近对相位进行样条曲线插值 xs = zeros(1, 2 * w + 1); ys = zeros(1, 2 * w + 1); phas_x = zeros(1, 2 * w + 1); phas_y = zeros(1, 2 * w + 1); ii = 1; for j = - 1 * w: w es,'X (mm)'); ylabel(player.Axes,'Y (mm)'); zlabel(player.Axes,'Z (mm)'); view(player,ptCloud); pha_y = spline(ys, phas_y, y); prjPoints(i, :, calib_idx) = [pha_x, pha_y]; end end save(calib_folder + "\projector_imagePoints.mat", 'prjPoints'); toc; end fprintf(file, "\n"); end disp("写入完成"); fclose(file); toc;帮我一句一句解释这段代码
09-19
close all; clc; clear; tic; %% 01 鍙傛暟閰嶇疆 W = 1280; H = 720; save_folder = "data/project"; mkdir(save_folder); save_file_csv = strcat(save_folder, "/","patterns.csv"); % 鐢ㄤ簬鍐欏叆鍒版姇褰变华 n = 4; % 鏍奸浄鐮佷綅鏁� % 鐩哥Щ鍙傛暟 N = 12; % 鐩哥Щ姝ユ暟 A = 130; B = 90; TW = W / (2 ^ n); TH = H / (2 ^ n); %% 02 鐢熸垚鐩哥Щ娉曞浘鍍� [~, patterns_phaseshift_X] = m_make_phase_shift_patterns(A, B, TW, N, W, H); [~, temp_Y] = m_make_phase_shift_patterns(A, B, TH, N, H, W); patterns_phaseshift_Y = zeros(N, H, W); for i = 1: N patterns_phaseshift_Y(i, :, :) = squeeze(temp_Y(i, :, :))'; end %% 03 鐢熸垚鏍奸浄鐮佸浘鍍忥細X鏂瑰悜 patterns_graycode_X = m_make_gray_code_patterns(n, W, H); temp_Y = m_make_gray_code_patterns(n, H, W); [num, H, W] = size(patterns_graycode_X); patterns_graycode_Y = zeros(num, H, W); for i = 1: num patterns_graycode_Y(i, :, :) = squeeze(temp_Y(i, :, :))'; end %% 04 鍐欏叆鍥惧儚 idx = 0; file = fopen(save_file_csv, "w+"); % 鍐欏叆鐩哥Щ鍥炬 X for i = 1: N idx = idx + 1; % 鍐欏叆鍥剧墖 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("鍐欏叆鏂囦欢鍒�:" + save_file_img); img = squeeze(patterns_phaseshift_X(i, :, :)); imwrite(img, save_file_img); % 鍐欏叆csv鏂囦欢 img_row = squeeze(img(1, :)) * 255.; for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ",")); end fprintf(file, "\n"); end % 鍐欏叆鏍奸浄鐮佺▼搴� X for i = 1: num idx = idx + 1; % 鍐欏叆鍥惧儚 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("鍐欏叆鏂囦欢鍒�:" + save_file_img); img = squeeze(patterns_graycode_X(i, :, :)); imwrite(img, save_file_img); % 鍐欏叆鍥惧儚 img_row = squeeze(img(1, :)); for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ",")); end fprintf(file, "\n"); end % 鍐欏叆鐩哥Щ鍥炬 Y for i = 1: N idx = idx + 1; % 鍐欏叆鍥剧墖 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("鍐欏叆鏂囦欢鍒�:" + save_file_img); img = squeeze(patterns_phaseshift_Y(i, :, :)); imwrite(img, save_file_img); % 鍐欏叆csv鏂囦欢 img_row = squeeze(img(1, :)) * 255.; for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ",")); end fprintf(file, "\n"); end % 鍐欏叆鏍奸浄鐮佺▼搴� Y for i = 1: num idx = idx + 1; % 鍐欏叆鍥惧儚 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("鍐欏叆鏂囦欢鍒�:" + save_file_img); img = squeeze(patterns_graycode_Y(i, :, :)); imwrite(img, save_file_img); % 鍐欏叆鍥惧儚 img_row = squeeze(img(1, :)); for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ",")); end fprintf(file, "\n"); end disp("鍐欏叆瀹屾垚"); fclose(file); toc;close all; clc; clear; tic; %% 01 鍙傛暟閰嶇疆 calib_folder = "data/calib"; N = 12; n = 4; num = n + 2; B_min = 10; % 浣庝簬杩欎釜璋冨埗搴︾殑鎴戜滑灏辫涓哄畠鐨勭浉浣嶄俊鎭笉鍙潬 IT = 0.5; % 鏍奸浄鐮侀槇鍊� win_size = 7; % 涓�兼护娉㈢獥鍙eぇ灏� W = 1280; H = 720; points_per_row = 7; points_per_col = 6; w = 2; load("data/calib/camera_imagePoints.mat"); [~, ~, calib_num] = size(imagePoints); prjPoints = zeros(size(imagePoints)); %% 02 鏍囧畾鎶曞奖浠�佺浉鏈� for calib_idx = 1: calib_num disp(calib_idx); data_folder = calib_folder + "/" + num2str(calib_idx); %% 02 杩戜技鏌ョ湅鍥惧儚鍦嗗績 img = 255 - imread(data_folder + "/18.bmp"); for i = 1: points_per_row * points_per_col xy = imagePoints(i, :, calib_idx); x = round(xy(1)); y = round(xy(2)); img(y, x) = 255; end figure(); mesh(img); %% 03 瑙\Y鐩镐綅 files_phaseShiftX = cell(1, N); idx = 1; for i = 1: N files_phaseShiftX{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end files_grayCodeX = cell(1, num); for i = 1: num files_grayCodeX{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end files_phaseShiftY = cell(1, N); for i = 1: N files_phaseShiftY{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end files_grayCodeY = cell(1, num); for i = 1: num files_grayCodeY{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end [phaX, difX] = m_calc_absolute_phase(files_phaseShiftX, files_grayCodeX, IT, B_min, win_size); [phaY, difY] = m_calc_absolute_phase(files_phaseShiftY, files_grayCodeY, IT, B_min, win_size); phaX = phaX * W; phaY = phaY * H; for i = 1: points_per_row * points_per_col xy = imagePoints(i, :, calib_idx); x = xy(1); y = xy(2); x_round = round(x); y_round = round(y); % 瀵箈銆亂闄勮繎瀵圭浉浣嶈繘琛屾牱鏉℃洸绾挎彃鍊� xs = zeros(1, 2 * w + 1); ys = zeros(1, 2 * w + 1); phas_x = zeros(1, 2 * w + 1); phas_y = zeros(1, 2 * w + 1); ii = 1; for j = - 1 * w: w xs(1, ii) = x_round + j; ys(1, ii) = y_round + j; phas_x(1, ii) = phaX(y_round, xs(1, ii)); phas_y(1, ii) = phaY(ys(1, ii), x_round); ii = ii + 1; end pha_x = spline(xs, phas_x, x); pha_y = spline(ys, phas_y, y); prjPoints(i, :, calib_idx) = [pha_x, pha_y]; end end save(calib_folder + "\projector_imagePoints.mat", 'prjPoints'); toc;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 3D recosntruction with the calibrated triangular stereo model. % Related Reference: % "Calibration of fringe projection profilometry: A comparative review" % Shijie Feng, Chao Zuo, Liang Zhang, Tianyang Tao, Yan Hu, Wei Yin, Jiaming Qian, and Qian Chen % last modified on 07/27/2020 % by Shijie Feng (Email: shijiefeng@njust.edu.cn) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Clear everything existing. clc; clear; close all; data_folder = "data/model"; N = 12; n = 4; num = n + 2; B_min = 10; % 浣庝簬杩欎釜璋冨埗搴︾殑鎴戜滑灏辫涓哄畠鐨勭浉浣嶄俊鎭笉鍙潬 IT = 0.5; % 鏍奸浄鐮侀槇鍊� win_size = 7; % 涓�兼护娉㈢獥鍙eぇ灏� %% step1: input parameters width = 1280; % camera width height = 1024; % camera height prj_width = 1280; % projector width %camera: Projection matrix Pc load('CamCalibResult.mat'); Kc = KK; % 鐩告満鍐呭弬 Ac = Kc * [Rc_1, Tc_1]; %projector: Projection matrix Pp load('PrjCalibResult.mat'); Kp = KK; % 鎶曞奖浠唴鍙� Ap = Kp * [Rc_1, Tc_1]; %% step2: 璇诲彇娴嬭瘯鍥剧墖骞朵笖璁$畻涓夌淮閲嶅缓 % % 鏉$汗棰戠巼64锛屼篃鏄棿璺濓紙涓�涓懆鏈熺敱64涓儚绱犵粍鎴愶級鐢ㄤ簬璁$畻缁濆鐩镐綅锛岄鐜�1銆�8鐢ㄤ簬鍖呰9鐩镐綅灞曞紑 % f = 64; % 鏉$汗棰戠巼锛堝崟涓懆鏈熸潯绾圭殑鍍忕礌涓暟锛夛紝鍗砅 % load('up_test_obj.mat'); % up_test_obj = up_test_obj / f; % 灏嗙浉浣嶅綊涓�鍖栧埌[0, 2pi]涔嬮棿 % % figure; imshow(up_test_obj / (2 * pi)); colorbar; title("鐩镐綅鍥�, freq=" + num2str(f)); % figure; mesh(up_test_obj); colorbar; title("鐩镐綅鍥�, freq=" + num2str(f)); % % % 璁$畻鎶曞奖浠潗鏍� % x_p = up_test_obj / (2 * pi) * prj_width; idx = 1; files_phaseShiftX = cell(1, N); for i = 1: N files_phaseShiftX{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end files_grayCodeX = cell(1, num); for i = 1: num files_grayCodeX{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end [phaX, difX] = m_calc_absolute_phase(files_phaseShiftX, files_grayCodeX, IT, B_min, win_size); up_test_obj = phaX * 2 * pi; x_p = phaX * prj_width; % 3D閲嶅缓 Xws = nan(height, width); Yws = nan(height, width); Zws = nan(height, width); for y = 1:height for x = 1:width if ~(up_test_obj(y, x) == 0) uc = x - 1; vc = y - 1; up = (x_p(y, x) - 1); % Eq. (32) in the reference paper. A = [Ac(1,1) - Ac(3,1) * uc, Ac(1,2) - Ac(3,2) * uc, Ac(1,3) - Ac(3,3) * uc; Ac(2,1) - Ac(3,1) * vc, Ac(2,2) - Ac(3,2) * vc, Ac(2,3) - Ac(3,3) * vc; Ap(1,1) - Ap(3,1) * up, Ap(1,2) - Ap(3,2) * up, Ap(1,3) - Ap(3,3) * up]; b = [Ac(3,4) * uc - Ac(1,4); Ac(3,4) * vc - Ac(2,4); Ap(3,4) * up - Ap(1,4)]; XYZ_w = inv(A) * b; Xws(y, x) = XYZ_w(1); Yws(y, x) = XYZ_w(2); Zws(y, x) = XYZ_w(3); end end end % 鐐逛簯鏄剧ず xyzPoints(:, 1) = Xws(:); xyzPoints(:, 2) = Yws(:); xyzPoints(:, 3) = Zws(:); ptCloud = pointCloud(xyzPoints); xlimits = [min(Xws(:)), max(Xws(:))]; ylimits = [min(Yws(:)), max(Yws(:))]; zlimits = ptCloud.ZLimits; player = pcplayer(xlimits, ylimits, zlimits); xlabel(player.Axes,'X (mm)'); ylabel(player.Axes,'Y (mm)'); zlabel(player.Axes,'Z (mm)'); view(player,ptCloud); 这是代码主体部分,接下来给出功能函数function [pha_absolute, dif] = m_calc_absolute_phase(files_phaseShift, files_grayCode, IT, B_min, win_size) [~, N] = size(files_phaseShift); [pha_wrapped, B] = m_calc_warppred_phase(files_phaseShift, N); [~, n] = size(files_grayCode); n = n - 2; % 鎶曞奖浜嗕竴榛戜竴鐧戒袱骞呭浘鐗� Ks = m_calc_gray_code(files_grayCode, IT, n); pha_absolute = pha_wrapped + 2 * pi .* Ks; % 璋冨埗搴︽护娉� B_mask = B > B_min; pha_absolute = pha_absolute .* B_mask; % 杈圭紭璺冲彉璇樊 [pha_absolute, dif] = m_filter2d(pha_absolute, win_size); % 褰掍竴鍖� pha_absolute = pha_absolute / (2 * pi * 2^ n); endfunction [Ks] = m_calc_gray_code(files, IT, n) % 01 璇诲彇姣忎竴寮犲浘鐗囪繘Is [~, num] = size(files); img = imread(files{1}); [h, w] = size(img); Is = zeros(num, h, w); for i = 1: num img = imread(files{i}); Is(i, :, :) = double(img); end % 02 璁$畻Is_Max銆両s_Min锛屽姣忎釜鐐硅繘琛岄槇鍊煎垽鏂� Is_max = max(Is); Is_min = min(Is); Is_std = (Is - Is_min) ./ (Is_max - Is_min); gcs = Is_std > IT; % 03 瀵规瘡涓儚绱犵偣锛岃绠楃紪鐮佸�糣 Vs_row = zeros(1, 2 ^ n, 'uint8'); codes = m_gray_code(n); for i = 1: 2 ^ n code = str2mat(codes(i)); %#ok<DSTRMT> V = 0; for j = 1: n V = V + str2num(code(j)) * 2^ (4 - j); %#ok<ST2NM> end Vs_row(1, i) = V; end % 04 寤虹珛 V - > K 鐨勬槧灏勮〃 V2K = containers.Map(); for K = 1: 2 ^ n V = Vs_row(1, K); V2K(int2str(V)) = K - 1; end Ks = zeros(h, w); for v = 1: h %disp(strcat("绗�", int2str(v), "琛�")); for u = 1: w % 涓嶉渶瑕佹渶鍚庨粦銆佺櫧涓ゅ箙鍥剧墖鐨勭紪鐮� gc = gcs(1: n, v, u); V = 0; for i = 1: n V = V + gc(i) * 2 ^ (4 - i); end % 涓昏鐨勬�ц兘鐡堕 Ks(v, u) = V2K(int2str(V)); end end end function [Ks] = m_calc_gray_code(files, IT, n) % 01 璇诲彇姣忎竴寮犲浘鐗囪繘Is [~, num] = size(files); img = imread(files{1}); [h, w] = size(img); Is = zeros(num, h, w); for i = 1: num img = imread(files{i}); Is(i, :, :) = double(img); end % 02 璁$畻Is_Max銆両s_Min锛屽姣忎釜鐐硅繘琛岄槇鍊煎垽鏂� Is_max = max(Is); Is_min = min(Is); Is_std = (Is - Is_min) ./ (Is_max - Is_min); gcs = Is_std > IT; % 03 瀵规瘡涓儚绱犵偣锛岃绠楃紪鐮佸�糣 Vs_row = zeros(1, 2 ^ n, 'uint8'); codes = m_gray_code(n); for i = 1: 2 ^ n code = str2mat(codes(i)); %#ok<DSTRMT> V = 0; for j = 1: n V = V + str2num(code(j)) * 2^ (4 - j); %#ok<ST2NM> end Vs_row(1, i) = V; end % 04 寤虹珛 V - > K 鐨勬槧灏勮〃 V2K = containers.Map(); for K = 1: 2 ^ n V = Vs_row(1, K); V2K(int2str(V)) = K - 1; end Ks = zeros(h, w); for v = 1: h %disp(strcat("绗�", int2str(v), "琛�")); for u = 1: w % 涓嶉渶瑕佹渶鍚庨粦銆佺櫧涓ゅ箙鍥剧墖鐨勭紪鐮� gc = gcs(1: n, v, u); V = 0; for i = 1: n V = V + gc(i) * 2 ^ (4 - i); end % 涓昏鐨勬�ц兘鐡堕 Ks(v, u) = V2K(int2str(V)); end end end %% 计算包裹相位 function [pha, B] = m_calc_warppred_phase(files, N) sin_sum = 0; cos_sum = 0; for k = 0: N - 1 Ik = m_imread(files{k + 1}); % 读取图片 Ik = m_filter2d(Ik); sin_sum = sin_sum + Ik * sin(2 * k * pi / N); cos_sum = cos_sum + Ik * cos(2 * k * pi / N); end % 根据计算相位、调制度 pha = atan2(sin_sum, cos_sum); B = sqrt(sin_sum .^ 2 + cos_sum .^ 2) * 2 / N; %% 尝试注释掉这段,自己从零实现一遍 % 为了将波折相位转为单个周期内单调递增 pha = - pha; pha_low_mask = pha <= 0; pha = pha + pha_low_mask .* 2. * pi; end %% 读取图片 function [img] = m_imread(file) img = imread(file); img = double(((img(:, :, 1)))); % 转换灰度图 end %% 高斯滤波 function [img] = m_filter2d(img) w = 3.; sigma = 1.; kernel = fspecial("gaussian", [w, w], sigma); img = imfilter(img, kernel, "replicate"); end% 滤波 function [pha_new, dif] = m_filter2d(pha, win_size) % 中值滤波(格雷码边缘处计算出现问题) pha_new = medfilt2(pha, [win_size, win_size]); % (剔除未编码区域) dif = pha - pha_new; endfunction [code] = m_gray_code(n) if (n < 1) disp("鏍奸浄鐮佹暟閲忓繀椤诲ぇ浜�0"); return; elseif (n == 1) % 浜х敓0銆�1 涓や釜鏁板瓧 code = ["0", "1"]; % 杩斿洖code else code_pre = m_gray_code(n - 1); [~, num] = size(code_pre); % 鍒濆鍖栦竴涓暟缁� code = repmat("", 1, num * 2); % step1锛氭瘡涓瓧绗︿覆鍓嶉潰閮�+0 idx = 0; for i = 1: num idx = idx + 1; code(idx) = "0" + code_pre(i); end % step2锛氱炕杞涓厓绱狅紝鍏朵綑鍙栧绉� for i = num: -1: 1 idx = idx + 1; code(idx) = "1" + code_pre(i); end end endfunction [patterns] = m_make_gray_code_patterns(n, W, H) codes = m_gray_code(n); % 灏嗗瓧绗︿覆鏍奸浄鐮佽浆鎹负鐭╅樀鏍煎紡 [~, num] = size(codes); codes_mat = zeros(n, num, 'int8'); for col = 1: num code_col = str2mat(codes(col)); %#ok<DSTRMT> for row = 1: n codes_mat(row, col) = str2num(code_col(row)); %#ok<ST2NM> end end W_per = round(W / num); % 姣忓紶鍥剧墖 patterns = zeros(n + 2, H, W, "uint8"); for idx = 1: n % 涓�琛屽浘鐗� row_one = zeros(1, W, "uint8"); % 姣忎釜鏍煎瓙 for i = 1 : num gray = codes_mat(idx, i); % 鏍煎瓙閲屾瘡涓儚绱� for w = 1: W_per row_one(1, (i - 1) * W_per + w) = gray; end end row_one = row_one * 255; pattern = repmat(row_one, H, 1); patterns(idx, :, :) = pattern; end % 鍏ㄩ粦銆佸叏鐧藉浘鐗囷紝鐢ㄤ簬纭畾姣忎釜鍍忕礌闃堝�� patterns(n + 2, :, :) = ones(H, W, 'uint8') * 255; end % 函数:生成相移条纹 function [Is, Is_img] = m_make_phase_shift_patterns(A, B, T, N, W, H) Is = cell(N, 1); Is_img = zeros(N, H, W); xs = 1: W; f_2pi = 1. / double(T) * 2. * pi; for k = 0: N - 1 Is{k + 1} = A + B * cos(f_2pi * xs + 2 * k / N * pi); Is_img(k + 1, :, :) = repmat(Is{k + 1} / 255., H, 1); end end 请一句一句的解释代码,我是小白
09-19
帮我一行一行的解读代码function [pha_absolute, dif] = m_calc_absolute_phase(files_phaseShift, files_grayCode, IT, B_min, win_size) [~, N] = size(files_phaseShift); [pha_wrapped, B] = m_calc_warppred_phase(files_phaseShift, N); [~, n] = size(files_grayCode); n = n - 2; % 鎶曞奖浜嗕竴榛戜竴鐧戒袱骞呭浘鐗� Ks = m_calc_gray_code(files_grayCode, IT, n); pha_absolute = pha_wrapped + 2 * pi .* Ks; % 璋冨埗搴︽护娉� B_mask = B > B_min; pha_absolute = pha_absolute .* B_mask; % 杈圭紭璺冲彉璇樊 [pha_absolute, dif] = m_filter2d(pha_absolute, win_size); % 褰掍竴鍖� pha_absolute = pha_absolute / (2 * pi * 2^ n); endfunction [Ks] = m_calc_gray_code(files, IT, n) % 01 璇诲彇姣忎竴寮犲浘鐗囪繘Is [~, num] = size(files); img = imread(files{1}); [h, w] = size(img); Is = zeros(num, h, w); for i = 1: num img = imread(files{i}); Is(i, :, :) = double(img); end % 02 璁$畻Is_Max銆両s_Min锛屽姣忎釜鐐硅繘琛岄槇鍊煎垽鏂� Is_max = max(Is); Is_min = min(Is); Is_std = (Is - Is_min) ./ (Is_max - Is_min); gcs = Is_std > IT; % 03 瀵规瘡涓儚绱犵偣锛岃绠楃紪鐮佸�糣 Vs_row = zeros(1, 2 ^ n, 'uint8'); codes = m_gray_code(n); for i = 1: 2 ^ n code = str2mat(codes(i)); %#ok<DSTRMT> V = 0; for j = 1: n V = V + str2num(code(j)) * 2^ (4 - j); %#ok<ST2NM> end Vs_row(1, i) = V; end % 04 寤虹珛 V - > K 鐨勬槧灏勮〃 V2K = containers.Map(); for K = 1: 2 ^ n V = Vs_row(1, K); V2K(int2str(V)) = K - 1; end Ks = zeros(h, w); for v = 1: h %disp(strcat("绗�", int2str(v), "琛�")); for u = 1: w % 涓嶉渶瑕佹渶鍚庨粦銆佺櫧涓ゅ箙鍥剧墖鐨勭紪鐮� gc = gcs(1: n, v, u); V = 0; for i = 1: n V = V + gc(i) * 2 ^ (4 - i); end % 涓昏鐨勬�ц兘鐡堕 Ks(v, u) = V2K(int2str(V)); end end end %% 计算包裹相位 function [pha, B] = m_calc_warppred_phase(files, N) sin_sum = 0; cos_sum = 0; for k = 0: N - 1 Ik = m_imread(files{k + 1}); % 读取图片 Ik = m_filter2d(Ik); sin_sum = sin_sum + Ik * sin(2 * k * pi / N); cos_sum = cos_sum + Ik * cos(2 * k * pi / N); end % 根据计算相位、调制度 pha = atan2(sin_sum, cos_sum); B = sqrt(sin_sum .^ 2 + cos_sum .^ 2) * 2 / N; %% 尝试注释掉这段,自己从零实现一遍 % 为了将波折相位转为单个周期内单调递增 pha = - pha; pha_low_mask = pha <= 0; pha = pha + pha_low_mask .* 2. * pi; end %% 读取图片 function [img] = m_imread(file) img = imread(file); img = double(((img(:, :, 1)))); % 转换灰度图 end %% 高斯滤波 function [img] = m_filter2d(img) w = 3.; sigma = 1.; kernel = fspecial("gaussian", [w, w], sigma); img = imfilter(img, kernel, "replicate"); end% 滤波 function [pha_new, dif] = m_filter2d(pha, win_size) % 中值滤波(格雷码边缘处计算出现问题) pha_new = medfilt2(pha, [win_size, win_size]); % (剔除未编码区域) dif = pha - pha_new; endfunction [code] = m_gray_code(n) if (n < 1) disp("鏍奸浄鐮佹暟閲忓繀椤诲ぇ浜�0"); return; elseif (n == 1) % 浜х敓0銆�1 涓や釜鏁板瓧 code = ["0", "1"]; % 杩斿洖code else code_pre = m_gray_code(n - 1); [~, num] = size(code_pre); % 鍒濆鍖栦竴涓暟缁� code = repmat("", 1, num * 2); % step1锛氭瘡涓瓧绗︿覆鍓嶉潰閮�+0 idx = 0; for i = 1: num idx = idx + 1; code(idx) = "0" + code_pre(i); end % step2锛氱炕杞涓厓绱狅紝鍏朵綑鍙栧绉� for i = num: -1: 1 idx = idx + 1; code(idx) = "1" + code_pre(i); end end endfunction [patterns] = m_make_gray_code_patterns(n, W, H) codes = m_gray_code(n); % 灏嗗瓧绗︿覆鏍奸浄鐮佽浆鎹负鐭╅樀鏍煎紡 [~, num] = size(codes); codes_mat = zeros(n, num, 'int8'); for col = 1: num code_col = str2mat(codes(col)); %#ok<DSTRMT> for row = 1: n codes_mat(row, col) = str2num(code_col(row)); %#ok<ST2NM> end end W_per = round(W / num); % 姣忓紶鍥剧墖 patterns = zeros(n + 2, H, W, "uint8"); for idx = 1: n % 涓�琛屽浘鐗� row_one = zeros(1, W, "uint8"); % 姣忎釜鏍煎瓙 for i = 1 : num gray = codes_mat(idx, i); % 鏍煎瓙閲屾瘡涓儚绱� for w = 1: W_per row_one(1, (i - 1) * W_per + w) = gray; end end row_one = row_one * 255; pattern = repmat(row_one, H, 1); patterns(idx, :, :) = pattern; end % 鍏ㄩ粦銆佸叏鐧藉浘鐗囷紝鐢ㄤ簬纭畾姣忎釜鍍忕礌闃堝�� patterns(n + 2, :, :) = ones(H, W, 'uint8') * 255; end% 函数:生成相移条纹 function [Is, Is_img] = m_make_phase_shift_patterns(A, B, T, N, W, H) Is = cell(N, 1); Is_img = zeros(N, H, W); xs = 1: W; f_2pi = 1. / double(T) * 2. * pi; for k = 0: N - 1 Is{k + 1} = A + B * cos(f_2pi * xs + 2 * k / N * pi); Is_img(k + 1, :, :) = repmat(Is{k + 1} / 255., H, 1); end end close all; clc; clear; tic; %% 01 鍙傛暟閰嶇疆 W = 1280; H = 720; save_folder = "data/project"; mkdir(save_folder); save_file_csv = strcat(save_folder, "/","patterns.csv"); % 鐢ㄤ簬鍐欏叆鍒版姇褰变华 n = 4; % 鏍奸浄鐮佷綅鏁� % 鐩哥Щ鍙傛暟 N = 12; % 鐩哥Щ姝ユ暟 A = 130; B = 90; TW = W / (2 ^ n); TH = H / (2 ^ n); %% 02 鐢熸垚鐩哥Щ娉曞浘鍍� [~, patterns_phaseshift_X] = m_make_phase_shift_patterns(A, B, TW, N, W, H); [~, temp_Y] = m_make_phase_shift_patterns(A, B, TH, N, H, W); patterns_phaseshift_Y = zeros(N, H, W); for i = 1: N patterns_phaseshift_Y(i, :, :) = squeeze(temp_Y(i, :, :))'; end %% 03 鐢熸垚鏍奸浄鐮佸浘鍍忥細X鏂瑰悜 patterns_graycode_X = m_make_gray_code_patterns(n, W, H); temp_Y = m_make_gray_code_patterns(n, H, W); [num, H, W] = size(patterns_graycode_X); patterns_graycode_Y = zeros(num, H, W); for i = 1: num patterns_graycode_Y(i, :, :) = squeeze(temp_Y(i, :, :))'; end %% 04 鍐欏叆鍥惧儚 idx = 0; file = fopen(save_file_csv, "w+"); % 鍐欏叆鐩哥Щ鍥炬 X for i = 1: N idx = idx + 1; % 鍐欏叆鍥剧墖 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("鍐欏叆鏂囦欢鍒�:" + save_file_img); img = squeeze(patterns_phaseshift_X(i, :, :)); imwrite(img, save_file_img); % 鍐欏叆csv鏂囦欢 img_row = squeeze(img(1, :)) * 255.; for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ",")); end fprintf(file, "\n"); end % 鍐欏叆鏍奸浄鐮佺▼搴� X for i = 1: num idx = idx + 1; % 鍐欏叆鍥惧儚 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("鍐欏叆鏂囦欢鍒�:" + save_file_img); img = squeeze(patterns_graycode_X(i, :, :)); imwrite(img, save_file_img); % 鍐欏叆鍥惧儚 img_row = squeeze(img(1, :)); for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ",")); end fprintf(file, "\n"); end % 鍐欏叆鐩哥Щ鍥炬 Y for i = 1: N idx = idx + 1; % 鍐欏叆鍥剧墖 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("鍐欏叆鏂囦欢鍒�:" + save_file_img); img = squeeze(patterns_phaseshift_Y(i, :, :)); imwrite(img, save_file_img); % 鍐欏叆csv鏂囦欢 img_row = squeeze(img(1, :)) * 255.; for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ",")); end fprintf(file, "\n"); end % 鍐欏叆鏍奸浄鐮佺▼搴� Y for i = 1: num idx = idx + 1; % 鍐欏叆鍥惧儚 save_file_img = strcat(save_folder, "/", int2str(idx), ".bmp"); disp("鍐欏叆鏂囦欢鍒�:" + save_file_img); img = squeeze(patterns_graycode_Y(i, :, :)); imwrite(img, save_file_img); % 鍐欏叆鍥惧儚 img_row = squeeze(img(1, :)); for w = 1: W fprintf(file, strcat(int2str(round(img_row(w))), ",")); end fprintf(file, "\n"); end disp("鍐欏叆瀹屾垚"); fclose(file); toc;close all; clc; clear; tic; %% 01 鍙傛暟閰嶇疆 calib_folder = "data/calib"; N = 12; n = 4; num = n + 2; B_min = 10; % 浣庝簬杩欎釜璋冨埗搴︾殑鎴戜滑灏辫涓哄畠鐨勭浉浣嶄俊鎭笉鍙潬 IT = 0.5; % 鏍奸浄鐮侀槇鍊� win_size = 7; % 涓�兼护娉㈢獥鍙eぇ灏� W = 1280; H = 720; points_per_row = 7; points_per_col = 6; w = 2; load("data/calib/camera_imagePoints.mat"); [~, ~, calib_num] = size(imagePoints); prjPoints = zeros(size(imagePoints)); %% 02 鏍囧畾鎶曞奖浠�佺浉鏈� for calib_idx = 1: calib_num disp(calib_idx); data_folder = calib_folder + "/" + num2str(calib_idx); %% 02 杩戜技鏌ョ湅鍥惧儚鍦嗗績 img = 255 - imread(data_folder + "/18.bmp"); for i = 1: points_per_row * points_per_col xy = imagePoints(i, :, calib_idx); x = round(xy(1)); y = round(xy(2)); img(y, x) = 255; end figure(); mesh(img); %% 03 瑙\Y鐩镐綅 files_phaseShiftX = cell(1, N); idx = 1; for i = 1: N files_phaseShiftX{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end files_grayCodeX = cell(1, num); for i = 1: num files_grayCodeX{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end files_phaseShiftY = cell(1, N); for i = 1: N files_phaseShiftY{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end files_grayCodeY = cell(1, num); for i = 1: num files_grayCodeY{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end [phaX, difX] = m_calc_absolute_phase(files_phaseShiftX, files_grayCodeX, IT, B_min, win_size); [phaY, difY] = m_calc_absolute_phase(files_phaseShiftY, files_grayCodeY, IT, B_min, win_size); phaX = phaX * W; phaY = phaY * H; for i = 1: points_per_row * points_per_col xy = imagePoints(i, :, calib_idx); x = xy(1); y = xy(2); x_round = round(x); y_round = round(y); % 瀵箈銆亂闄勮繎瀵圭浉浣嶈繘琛屾牱鏉℃洸绾挎彃鍊� xs = zeros(1, 2 * w + 1); ys = zeros(1, 2 * w + 1); phas_x = zeros(1, 2 * w + 1); phas_y = zeros(1, 2 * w + 1); ii = 1; for j = - 1 * w: w xs(1, ii) = x_round + j; ys(1, ii) = y_round + j; phas_x(1, ii) = phaX(y_round, xs(1, ii)); phas_y(1, ii) = phaY(ys(1, ii), x_round); ii = ii + 1; end pha_x = spline(xs, phas_x, x); pha_y = spline(ys, phas_y, y); prjPoints(i, :, calib_idx) = [pha_x, pha_y]; end end save(calib_folder + "\projector_imagePoints.mat", 'prjPoints'); toc;%% Clear everything existing. clc; clear; close all; data_folder = "data/model"; N = 12; n = 4; num = n + 2; B_min = 10; % 浣庝簬杩欎釜璋冨埗搴︾殑鎴戜滑灏辫涓哄畠鐨勭浉浣嶄俊鎭笉鍙潬 IT = 0.5; % 鏍奸浄鐮侀槇鍊� win_size = 7; % 涓�兼护娉㈢獥鍙eぇ灏� %% step1: input parameters width = 1280; % camera width height = 1024; % camera height prj_width = 1280; % projector width %camera: Projection matrix Pc load('CamCalibResult.mat'); Kc = KK; % 鐩告満鍐呭弬 Ac = Kc * [Rc_1, Tc_1]; %projector: Projection matrix Pp load('PrjCalibResult.mat'); Kp = KK; % 鎶曞奖浠唴鍙� Ap = Kp * [Rc_1, Tc_1]; %% step2: 璇诲彇娴嬭瘯鍥剧墖骞朵笖璁$畻涓夌淮閲嶅缓 % % 鏉$汗棰戠巼64锛屼篃鏄棿璺濓紙涓�涓懆鏈熺敱64涓儚绱犵粍鎴愶級鐢ㄤ簬璁$畻缁濆鐩镐綅锛岄鐜�1銆�8鐢ㄤ簬鍖呰9鐩镐綅灞曞紑 % f = 64; % 鏉$汗棰戠巼锛堝崟涓懆鏈熸潯绾圭殑鍍忕礌涓暟锛夛紝鍗砅 % load('up_test_obj.mat'); % up_test_obj = up_test_obj / f; % 灏嗙浉浣嶅綊涓�鍖栧埌[0, 2pi]涔嬮棿 % % figure; imshow(up_test_obj / (2 * pi)); colorbar; title("鐩镐綅鍥�, freq=" + num2str(f)); % figure; mesh(up_test_obj); colorbar; title("鐩镐綅鍥�, freq=" + num2str(f)); % % % 璁$畻鎶曞奖浠潗鏍� % x_p = up_test_obj / (2 * pi) * prj_width; idx = 1; files_phaseShiftX = cell(1, N); for i = 1: N files_phaseShiftX{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end files_grayCodeX = cell(1, num); for i = 1: num files_grayCodeX{i} = strcat(data_folder, "/", int2str(idx), ".bmp"); idx = idx + 1; end [phaX, difX] = m_calc_absolute_phase(files_phaseShiftX, files_grayCodeX, IT, B_min, win_size); up_test_obj = phaX * 2 * pi; x_p = phaX * prj_width; % 3D閲嶅缓 Xws = nan(height, width); Yws = nan(height, width); Zws = nan(height, width); for y = 1:height for x = 1:width if ~(up_test_obj(y, x) == 0) uc = x - 1; vc = y - 1; up = (x_p(y, x) - 1); % Eq. (32) in the reference paper. A = [Ac(1,1) - Ac(3,1) * uc, Ac(1,2) - Ac(3,2) * uc, Ac(1,3) - Ac(3,3) * uc; Ac(2,1) - Ac(3,1) * vc, Ac(2,2) - Ac(3,2) * vc, Ac(2,3) - Ac(3,3) * vc; Ap(1,1) - Ap(3,1) * up, Ap(1,2) - Ap(3,2) * up, Ap(1,3) - Ap(3,3) * up]; b = [Ac(3,4) * uc - Ac(1,4); Ac(3,4) * vc - Ac(2,4); Ap(3,4) * up - Ap(1,4)]; XYZ_w = inv(A) * b; Xws(y, x) = XYZ_w(1); Yws(y, x) = XYZ_w(2); Zws(y, x) = XYZ_w(3); end end end % 鐐逛簯鏄剧ず xyzPoints(:, 1) = Xws(:); xyzPoints(:, 2) = Yws(:); xyzPoints(:, 3) = Zws(:); ptCloud = pointCloud(xyzPoints); xlimits = [min(Xws(:)), max(Xws(:))]; ylimits = [min(Yws(:)), max(Yws(:))]; zlimits = ptCloud.ZLimits; player = pcplayer(xlimits, ylimits, zlimits); xlabel(player.Axes,'X (mm)'); ylabel(player.Axes,'Y (mm)'); zlabel(player.Axes,'Z (mm)'); view(player,ptCloud);
09-19
先展示下效果 https://pan.quark.cn/s/a4b39357ea24 遗传算法 - 简书 遗传算法的理论是根据达尔文进化论而设计出来的算法: 人类是朝着好的方向(最优解)进化,进化过程中,会自动选择优良基因,淘汰劣等基因。 遗传算法(英语:genetic algorithm (GA) )是计算数学中用于解决最佳化的搜索算法,是进化算法的一种。 进化算法最初是借鉴了进化生物学中的一些现象而发展起来的,这些现象包括遗传、突变、自然选择、杂交等。 搜索算法的共同特征为: 首先组成一组候选解 依据某些适应性条件测算这些候选解的适应度 根据适应度保留某些候选解,放弃其他候选解 对保留的候选解进行某些操作,生成新的候选解 遗传算法流程 遗传算法的一般步骤 my_fitness函数 评估每条染色体所对应个体的适应度 升序排列适应度评估值,选出 前 parent_number 个 个体作为 待选 parent 种群(适应度函数的值越小越好) 从 待选 parent 种群 中随机选择 2 个个体作为父方和母方。 抽取父母双方的染色体,进行交叉,产生 2 个子代。 (交叉概率) 对子代(parent + 生成的 child)的染色体进行变异。 (变异概率) 重复3,4,5步骤,直到新种群(parentnumber + childnumber)的产生。 循环以上步骤直至找到满意的解。 名词解释 交叉概率:两个个体进行交配的概率。 例如,交配概率为0.8,则80%的“夫妻”会生育后代。 变异概率:所有的基因中发生变异的占总体的比例。 GA函数 适应度函数 适应度函数由解决的问题决定。 举一个平方和的例子。 简单的平方和问题 求函数的最小值,其中每个变量的取值区间都是 [-1, ...
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值