O'ZBЕKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYALARI VA
KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI
TOSHKЕNT AXBOROT TЕXNOLOGIYALARI UNIVЕRSITЕTI
ALGORITMLARNI LOYIHALASH
MAVZU: Chiziqli dasturlash masalalari va ularni yechish algoritmlari
Bajardi: Asomiddinov Sardor
Tekshirdi: Begimov Oybek
TOSHKENT 2022
2-labaratoriya ishi
1.Chiziqli dasturlash masalasi matematik modeli ko’rinishi.
2. 2-Variant berilishi
3.Matematik model tuzilsin!
4.Mumkin bo’lgan yechimlar sohasi geometrik usulda topilsin!
5-6.Tayanch yechimlar orasidan optimal yechimi ajratilsin va Egizak masalasi topilsin.
7.Variant bo’yicha tuzilgan matematik model kanonik ko’rinishiga keltirilsinva unga mos simpleks jadval tuzildi. –
8.Masala simpleks usulda excelda yechildi.
9. Simplex usulni umumiy algoritmi keltirilsin (qo’lda)
10.Masalani simplex usulda yechish dasturi yozilsin va natija (yechim) olinsin.
#include
using namespace std;
int main()
{
int a,b,d,stl,str,baz[10],f,g=0,i,j,l=0,q=0,z=0,y=0,xx,z1[10];
float m,tab[10][10],min=1000,c[10],tab1[10][10],x=1000;
cout<<"Qatorlar va ustunlar sonini kiriting"<cin>>a>>b;
//boshlang'ich matritsani tuldirish
for (i=0;i{
for (j=0;j{
cout<<"Jadvalni ["<cin>>tab[i][j];
}
}
cout<<"Birinchi iteratsiya"<for (i=0;i{
for (j=0;j{
cout<}
cout<}
//Optimallika tekshirish
k:
l=0;
for (i=0;iif (tab[a-1][i]<0) {l=l+1;}}
if (l==0){
for (j=1;jint kol=0,nol=0,ind;
for (i=0;iif (tab[i][j]==1) {kol++;ind=i;}
else nol++;
}
if ((kol==1) && (a-nol==2))
cout<<"x="<}cout<<"Yechim optimal"<for (i=0;i{ for (j=0;j{cout<cout<<"F(x)="<return 0;}
x=1000;
//Kalit ustinni qidirish
for (i=1;i{
if (tab[a-1][i]<=x)
{x=tab[a-1][i];
stl=i;
}
}
//Kalit qatorni qidirish
for (j=0;j{ if (tab[j][stl]>0)
c[j]=tab[j][0]/tab[j][stl];
else
c[j]=1000;}
cout<cout<<"Kalit qatorni topish uchun massiv"<for (j=0;jcout<}
cout<for (i=0;i<(a-1);i++)
if (c[i]min=c[i];
str=i;
}
cout<cout<<"Kalit ustin va kalit qator"<cout<cout<cout<<"Kalit element:"<cout<//Yangi jadval qayta hisoblash
for (i=0;i{ for (j=0;j{tab1[i][j]=tab[i][j]-(tab[i][stl]*tab[str][j]/tab[str][stl]);
tab1[i][stl]=0;
tab1[str][stl]=1;
tab1[str][j]=tab[str][j]/tab[str][stl];
}}
//Hosil bo’lgan matritsa va uni ekranga chiqarish
for (i=0;i{
for (j=0;j{ tab[i][j]=tab1[i][j];
}
}
goto k;
return 0;
}
11.Variant bo’yicha tuzilgan matematik modelga mos iqtisodiy masala tuzilsin va izohlansin.
Do'stlaringiz bilan baham: |