日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > 循环神经网络 >内容正文

循环神经网络

运筹学_单纯形表法_0(matlab实现)

發布時間:2024/4/18 循环神经网络 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 运筹学_单纯形表法_0(matlab实现) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

文章目錄

  • 一、輸入形式要求
  • 二、例題 & 效果
  • 三、待優化
  • 四、代碼
    • 1、mian
    • 2、simplex_method_0
    • 3、Find

一、輸入形式要求

二、例題 & 效果


三、待優化

1、雖解出最值,但給出的解的形式有待調整
2、對于無解/無窮解未做細致的處理

四、代碼

1、mian

tableau=[0 0 2 3 0 0 0 00 8 1 2 1 0 0 00 16 4 0 0 1 0 00 12 0 4 0 0 1 00 0 2 3 0 0 0 0]; dim_x=5; num_equ=3; [Max_Z,B] = simplex_method_0(dim_x,num_equ,tableau); disp("解為:"); disp(B); disp("最大值為:"); disp(Max_Z);

2、simplex_method_0

function [Max_Z,B] = simplex_method_0(dim_x,num_equ,tableau) %tableau矩陣:(num_equ+2)*(dim_x+3) %行:z系數 基變量 檢驗數 %列:C(B) X(B) b x1->x(dim_x) Ct%Z計算 Max_Z=tableau(2:num_equ+1,1)'*tableau(2:num_equ+1,2);%最大檢驗數獲取 [Max_c_z,Index]=max(tableau(num_equ+2,3:dim_x+2));%Ct計算 for i=1:num_equif(tableau(i+1,Index+2)~=0)tableau(i+1,dim_x+3)=tableau(i+1,2)/tableau(i+1,Index+2);elsetableau(i+1,dim_x+3)=-1;end end%最小的正Ct下標獲取 Index_Ct=Find(tableau(2:num_equ+1,dim_x+3));while(Max_c_z>0 && Index_Ct~=-1)%交換基Index=[Index_Ct+1,Index+2];%C(B)價值系數更新tableau(Index_Ct+1,1)=tableau(1,Index+2);%開始交換tableau(Index_Ct+1,2:dim_x+2)=tableau(Index_Ct+1,2:dim_x+2)./tableau(Index_Ct+1,Index+2);for i=2:num_equ+1if(i~=Index_Ct+1)tableau(i,2:dim_x+2)=tableau(i,2:dim_x+2)-tableau(i,Index+2).*tableau(Index_Ct+1,2:dim_x+2);endend%檢驗數更新tableau(num_equ+2,3:dim_x+2)=tableau(num_equ+2,3:dim_x+2)-tableau(num_equ+2,Index+2).*tableau(Index_Ct+1,3:dim_x+2);%Z更新Max_Z=tableau(2:num_equ+1,1)'*tableau(2:num_equ+1,2);%最大檢驗數獲取[Max_c_z,Index]=max(tableau(num_equ+2,3:dim_x+2));%Ct計算for i=1:num_equif(tableau(i+1,Index+2)~=0)tableau(i+1,dim_x+3)=tableau(i+1,2)/tableau(i+1,Index+2);elsetableau(i+1,dim_x+3)=-1;endend%最小的正Ct下標獲取Index_Ct=Find(tableau(2:num_equ+1,dim_x+3)); end %解返回 B=tableau(2:num_equ+1,2); end

3、Find

function [Index_Ct] = Find(Ct) size_Ct=size(Ct); Index_Ct=-1; if(~isempty(find(Ct>0)))Min_Ct=max(Ct);for i=1:size_Ct(1)if(Ct(i,1)>0 && Ct(i,1)<Min_Ct)Min_Ct=Ct(i,1);Index_Ct=i;endend end end

總結

以上是生活随笔為你收集整理的运筹学_单纯形表法_0(matlab实现)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。