亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? simplex.bak

?? It give the solution for polynomial equations using simplex method. It is a method for optimization
?? BAK
字號:
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
#include<graphics.h>
#include<dos.h>
float mini_ratio,min_cj_zj,min_ratio[10],max_cj_zj;
float pre_res,key_row,key_element,dv[10],res[10],cb[10];
int slack[10],art[5],k,flag,i,j,key_col,tot_dv,tot_cons,var_num;
char cas[5],sym[10],ch[5],var[10][3],number[5],bv[10][3];
float cons[10][10],zj[10],cj_zj[10],sum,key_rows[10],fixed_element;
void main()
{

flag=0; // for -ve resource purpose
 // graphics driver intialzing
 int driver=DETECT,mode;
 initgraph(&driver,&mode,"c:\\bc\\bgi");
 void erase_screen();
void end();
void display();
void iteration_fun();
void display_final_result();
clrscr();
cleardevice();
 int x,y;
     int col=0;
     for(int i=0;i<200;i++)
     {
      putpixel(random(640),random(480),col);
      col++;
      if(col==15){col=0;}
      }
gotoxy(110,60);
settextstyle(7, HORIZ_DIR, 12);
outtext("SIMPLEX");
moveto(80,160);
settextstyle(7, 0, 12);
outtext("METHOD");
moveto(140,380);
settextstyle(5, 0, 4);
outtext("Developed by : Parminder Singh");
getch();
clrscr();
cleardevice();
  col=0;
     for(i=0;i<200;i++)
     {
      putpixel(random(640),random(480),col);
      col++;
      if(col==15){col=0;}
      }
printf("Enter Case (MAX/MIN)");
fflush(stdin);
gets(cas);
strupr(cas);
printf("\n\nEnter total number of decision variables");
scanf("%d",&tot_dv);
printf("Enter the Coefficient of Objective function (Z =)");
for(j=0;j<tot_dv;j++)
	scanf("%f",&dv[j]);

printf("Enter total number of Constraints");
scanf("%d",&tot_cons);

	for(i=0;i<tot_cons;i++)
	{
		for(j=0;j<tot_dv;j++)
		{
			printf("Enter %d constraint",i+1);
			printf(" (For Skip Enter zero)");
			scanf("%f",&cons[i][j]);
		}
		printf("Enter Symbol ( >,=,< )");
		fflush(stdin);
		scanf("%c",&sym[i]);
		printf("Enter the Resource of %d Constraint",i+1);
		scanf("%f",&res[i]);
		printf("\n\n");
	}
clrscr();
cleardevice();
//For Assigning X
for(i=0;i<tot_dv;i++)
{
	strcpy(var[i],"x");
	itoa(i+1,number,10);
	strcat(var[i],number);
}

//Display L.P Problem

printf("\n\nThe L.P Problem is \n\n");
display();

//If the resource is -ve then multiply whole of the constraint by -1
//And change the Symbol
for(i=0;i<tot_cons;i++)
{
	if(res[i]<0)
	{
		flag=1;
		res[i]*=-1;
		if(sym[i]=='>')
			sym[i]='<';
		else
			sym[i]='>';
		for(j=0;j<tot_dv;j++)
		{
			cons[i][j]*=-1;
		}

	}
}
//if resources were -ve then print again otherwise no need to print again
if(flag==1)
{
//Display L.P Problem
printf("\n\nNow The L.P Problem is \n\n");
display();
}

//Change the < & > to =
k=tot_dv;
var_num=1;
for(i=0;i<tot_cons;i++)
{
	if(sym[i]=='>')
	{
		cons[i][k]=-1;
		dv[k]=0;
		strcpy(var[k],"s");
		itoa(i+1,number,10);
		strcat(var[k],number);

		k++;
		cons[i][k]=1;
		if(strcmp(cas,"MAX")==0)
			cb[i]=dv[k]=-100000;
		else
			cb[i]=dv[k]=100000;
		sym[i]='=';

		strcpy(var[k],"A");
		itoa(var_num,number,10);
		strcat(var[k],number);
		strcpy(bv[i],var[k]);
		var_num++;
	}
	else if(sym[i]=='<')
	{
		cons[i][k]=1;
		cb[i]=dv[k]=0;
		sym[i]='=';
		strcpy(var[k],"s");
		itoa(i+1,number,10);
		strcat(var[k],number);
		strcpy(bv[i],var[k]);
	}
	else
	{
		cons[i][k]=1;
		if(strcmp(cas,"MAX")==0)
			cb[i]=dv[k]=-100000;
		else
			cb[i]=dv[k]=100000;
		strcpy(var[k],"A");
		itoa(var_num,number,10);
		strcat(var[k],number);
		strcpy(bv[i],var[k]);
		var_num++;
	}
	k++;
}

printf("\n\nStandard Form is: \n\n");
printf("%s Z= ",cas);
for(i=0;i<k;i++)
{
	if(i!=0)
		printf("+ %.1f%s ",dv[i],var[i]);
	else
		printf("%.1f%s ",dv[i],var[i]);
}

printf("\n\nSub to :\n");

for(i=0;i<tot_cons;i++)
{
		printf("\n\t");
	for(j=0;j<k;j++)
	{
		if(cons[i][j]!=0)
		{
			if(j!=0)
				printf("+ %.1f%s ",cons[i][j],var[j]);
			else
				printf("%.1f%s ",cons[i][j],var[j]);
		}

	}
	printf("%c",sym[i]);
	printf(" %.1f",res[i]);

}
//Display Non-Negativity Resrtiction
printf("\n");
for(j=0;j<k;j++)
{
	printf("%s ",var[j]);
}
printf("> 0");

printf("\n\n\nPress any key to continue...");
getch();
clrscr();
cleardevice();
label:

printf("\n\n\n");
printf("\n----------------------------------------------------------------------------\n");
printf("\t\tCj\t");
for(i=0;i<k;i++)
	printf("%.1f\t",dv[i]);
//printf("\n----------------------------------------------------------------------------\n");

printf("\nCb\tBv\tSv");
for(i=0;i<k;i++)
printf("\t%s ",var[i]);

printf("\n----------------------------------------------------------------------------\n");
for(i=0;i<tot_cons;i++)
{
	printf("%.1f\t",cb[i]);
	printf("%s\t",bv[i]);
	printf("%.1f\t",res[i]);
	for(j=0;j<k;j++)
	{
		printf("%.1f\t",cons[i][j]);
	}

	printf("\n");
}

//print & Calculate the value of Zj & Zj - Cj
printf("\n----------------------------------------------------------------------------\n");
printf("    Zj = \t\t");

for(j=0;j<k;j++)
{
	sum=0;
	for(i=0;i<tot_cons;i++)
	{
		sum=sum+(cb[i]*cons[i][j]);
	}
	zj[j]=sum;
	printf("%.1f\t",zj[j]);
	cj_zj[j]=dv[j]-zj[j];
}

printf("\n----------------------------------------------------------------------------\n");
printf(" Cj - Zj = \t\t");

key_col=0;
if(strcmp(cas,"MAX")==0)
{
	max_cj_zj=cj_zj[0];
	for(i=0;i<k;i++)
	{
		printf("%.1f\t",cj_zj[i]);
		if(max_cj_zj<=cj_zj[i+1])
		{
			max_cj_zj=cj_zj[i+1];
			key_col=i+1;
		}
	}
	if(max_cj_zj>0)
	{
		iteration_fun();
		goto label;
	}
	else
	{
	   display_final_result();
	}
}
else
{
	min_cj_zj=cj_zj[0];
	for(i=0;i<k;i++)
	{
		printf("%.1f\t",cj_zj[i]);
		if(min_cj_zj>=cj_zj[i+1])
		{
			min_cj_zj=cj_zj[i+1];
			key_col=i+1;
		}
	}
	if(min_cj_zj<0)
	{
		iteration_fun();
		goto label;
	}
	else
	{
		display_final_result();
	}
}
clrscr();
end();
erase_screen();
//getch();
}
void display_final_result()
{
	printf("\n\nSolution is over");
	printf("\nPress any key to see the final Result\n");
	getch();
	printf("\n\t\t----------------------------\n");
	printf("\n\t\tCb\tBv\tSv\n");
	printf("\n\t\t----------------------------\n\t\t");
	for(i=0;i<tot_cons;i++)
	{
		printf("%.1f\t",cb[i]);
		printf("%s\t",bv[i]);
		printf("%.1f\t",res[i]);
		printf("\n\t\t");
	}
	printf("\n\t\t----------------------------\n");
//Calculate & print the value of Zj
	printf("\t\t    Z = \t");
	sum=0;
	for(i=0;i<tot_cons;i++)
		sum+=(cb[i]*res[i]);
	printf("%.1f\t",sum);
	getch();
}



void display()
{
printf("%s Z= ",cas);
for(i=0;i<tot_dv;i++)
{
	if(i!=0)
	printf("+ %.1f%s ",dv[i],var[i]);
	else
	printf("%.1f%s ",dv[i],var[i]);
}
printf("\n\nSub to :\n");
for(i=0;i<tot_cons;i++)
{
		printf("\n\t");
	for(j=0;j<tot_dv;j++)
	{
		if(cons[i][j]!=0)
		{
			if(j!=0)     // For Printing +
			printf("+ %.1f%s ",cons[i][j],var[j]);
			else
			printf("%.1f%s ",cons[i][j],var[j]);
		}

	}
	printf("%c",sym[i]);
	printf(" %.1f",res[i]);

}
printf("\n");

//Display Non-Negativity Resrtiction
for(j=0;j<tot_dv;j++)
{
	printf("%s ",var[j]);
}
printf("> 0");
}


void iteration_fun()
{
	printf("\n\nSolution is not optimise. We have to optimise");
	printf("\nPress any key to continue");
	getch();

//For Minimum Ratio & Key Row
	mini_ratio = 40000; //assumed minimum ratio
	printf("\n\n-------------------");
	printf("\n\nMinimum Ratio");
	printf("\n\n-------------------\n");
	for(i=0;i<tot_cons;i++)
	{
		if(cons[i][key_col]<=0)
		{
			min_ratio[i]=40000;
			printf("\nCan't Divide by 0 or -ve So assume ratio is ");
		}
		else
		{
			min_ratio[i]=res[i]/cons[i][key_col];
		}
		printf("%.1f\n",min_ratio[i]);
		if(mini_ratio>min_ratio[i])
		{
			mini_ratio=min_ratio[i];
			key_row=i;
		 }
	}


//Display Key Column, Key Row & Key Element
	printf("\n\n-------------------\n\n");
	printf("Key Column is %s",var[key_col]);
	printf("\nKey Row is %s",bv[key_row]);
	key_element=cons[key_row][key_col];
	printf("\nKey Element is %.1f",key_element);

	printf("\nEntering Variable is %s",var[key_col]);
	printf("\nDeparting Variable is %s",bv[key_row]);
	strcpy(bv[key_row],var[key_col]);

//Store the key row element in key_rows array
	pre_res=res[key_row]; //for resources
	for(i=0;i<k;i++)
		key_rows[i]=cons[key_row][i];

//Change Key Row & Generate new rows
	cb[key_row]=dv[key_col]; //Entering variable
	res[key_row]/=key_element;
	for(i=0;i<k;i++)
	{
		if(cons[key_row][i]!=0)
		cons[key_row][i]/=key_element;
	}

	for(i=0;i<tot_cons;i++)
	{

		if(i!=key_row)
		{

			fixed_element=cons[i][key_col]/key_element;
			res[i]-=(pre_res * fixed_element);
			for(j=0;j<k;j++)
			{
				cons[i][j]=cons[i][j]-(key_rows[j]*fixed_element);
			}
		}
	}
printf("\n\nPress any key to continue...");
getch();
}

void end()
   {
     cleardevice();
     int x,y;
     int col=0;
     for(int i=0;i<200;i++)
     {
      putpixel(random(640),random(480),col);
      col++;
      if(col==15){col=0;}
      }
      printf("\n\n\n\n Programmer : Parminder Singh MCA IV Sem");
      printf("\n\nMail in Your Suggestions And Queries At :");
      printf("\n  < inder_923 @ yahoo.co.uk > ");
      printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n ^ Press Any Key To Exit ^" );
      getch();
   }
void erase_screen()
{
 int x1=0,y1=0,x2=639,y2=479;
 setcolor(0);
  for(;x1<x2;)
  {
  delay(10);
  rectangle(x1,y1,x2,y2);
  x1++;y1++;x2--;y2--;
  }
  cleardevice();
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久国产精品免费| 欧美一区二区在线视频| 色综合一区二区三区| 日本韩国欧美一区| 欧美精三区欧美精三区| 久久综合色婷婷| 日韩毛片视频在线看| 一区二区三区在线播| 日韩av网站在线观看| 国产不卡免费视频| 99国产精品国产精品久久| 欧美挠脚心视频网站| 国产性天天综合网| 亚洲一区二区欧美日韩| 国产传媒欧美日韩成人| 欧美三级资源在线| 久久久一区二区三区| 一级精品视频在线观看宜春院| 伦理电影国产精品| 99国产精品一区| 日韩女同互慰一区二区| 亚洲丝袜另类动漫二区| 久久精品国产精品青草| 色婷婷综合中文久久一本| 日韩欧美国产综合一区| 一区二区在线电影| 国产精品99久久久久久久女警| 在线中文字幕一区| 国产日韩欧美麻豆| 日韩中文欧美在线| 91日韩在线专区| 久久精品一区二区三区不卡牛牛| 亚洲国产日韩a在线播放| 成人精品小蝌蚪| 日韩精品一区二区在线观看| 亚洲无线码一区二区三区| 国产精品1024| 欧美sm美女调教| 婷婷综合在线观看| 色婷婷综合久久久久中文 | 亚洲乱码中文字幕| 国模套图日韩精品一区二区| 欧美日韩激情一区| 亚洲精品免费视频| 99久久亚洲一区二区三区青草| 精品国产露脸精彩对白| 婷婷综合五月天| 欧美日韩三级一区二区| 亚洲卡通欧美制服中文| 国产91精品久久久久久久网曝门 | 日本在线不卡视频| 97久久精品人人做人人爽| 亚洲国产精品99久久久久久久久 | 久久久久久亚洲综合| 日本视频一区二区三区| 欧美色爱综合网| 亚洲私人黄色宅男| 成人午夜电影久久影院| 久久久精品黄色| 国产麻豆一精品一av一免费| 精品毛片乱码1区2区3区| 日韩不卡一区二区三区| 91精品国产色综合久久不卡蜜臀| 亚洲一区二区三区小说| 日本久久一区二区| 亚洲另类在线制服丝袜| 91九色最新地址| 亚洲激情自拍视频| 一本色道久久综合亚洲91| 国产精品国产三级国产| 日韩一区二区精品葵司在线| 亚洲成a人片在线观看中文| 一本久久a久久免费精品不卡| 亚洲精选免费视频| 91黄色免费看| 亚洲午夜精品久久久久久久久| 欧美三级日本三级少妇99| 亚洲第一福利一区| 欧美片网站yy| 麻豆免费看一区二区三区| 日韩欧美中文字幕精品| 久久99精品久久久久婷婷| xnxx国产精品| 国产成人在线视频播放| 亚洲欧美综合网| 日本高清不卡视频| 天堂久久久久va久久久久| 91精品国产乱码久久蜜臀| 老司机午夜精品| 久久久不卡网国产精品一区| 国产成人免费在线观看| 亚洲欧洲精品一区二区三区不卡| 色老汉av一区二区三区| 亚洲午夜一区二区| 日韩亚洲欧美一区二区三区| 精品一区二区三区免费观看| 国产农村妇女毛片精品久久麻豆| a4yy欧美一区二区三区| 亚洲综合免费观看高清完整版| 欧美日韩一区二区三区四区| 久久激五月天综合精品| 国产欧美一区在线| 在线观看国产日韩| 麻豆国产91在线播放| 国产清纯在线一区二区www| 色综合中文字幕国产| 亚洲综合色视频| 精品国产自在久精品国产| 成人福利视频在线| 无吗不卡中文字幕| 久久久亚洲高清| 色狠狠一区二区| 久久精品国产一区二区三| 亚洲国产成人一区二区三区| 欧美三级一区二区| 国产又黄又大久久| 一级精品视频在线观看宜春院 | 91视频免费观看| 日韩精彩视频在线观看| 久久九九全国免费| 欧洲中文字幕精品| 国产一区二三区| 一区二区三区加勒比av| 欧美xxxxxxxx| 91在线免费播放| 另类中文字幕网| 伊人夜夜躁av伊人久久| wwww国产精品欧美| 欧美伊人久久大香线蕉综合69 | 亚洲精品在线电影| 色婷婷av一区| 国产综合色精品一区二区三区| 一区二区在线观看不卡| 久久久噜噜噜久久人人看 | 蜜桃视频在线一区| 亚洲精品国产成人久久av盗摄| 精品va天堂亚洲国产| 在线免费观看日本欧美| 国产成人亚洲综合a∨婷婷| 午夜亚洲国产au精品一区二区| 欧美激情在线一区二区三区| 正在播放亚洲一区| 91在线porny国产在线看| 国模少妇一区二区三区| 日韩国产欧美在线播放| 18成人在线观看| 久久久www免费人成精品| 欧美日本免费一区二区三区| 99久久777色| 国产成人综合在线| 日本午夜精品一区二区三区电影| 一区二区三区不卡视频在线观看 | 成人99免费视频| 国产伦精品一区二区三区免费迷| 午夜精品福利久久久| 亚洲日本免费电影| 国产日韩成人精品| 精品理论电影在线观看| 欧美日韩dvd在线观看| 91一区一区三区| 成人毛片视频在线观看| 高清在线观看日韩| 国产最新精品精品你懂的| 日本强好片久久久久久aaa| 亚洲国产日韩在线一区模特| 亚洲另类在线视频| 亚洲视频中文字幕| 国产精品视频九色porn| 久久久久97国产精华液好用吗| 91精品国产乱码久久蜜臀| 7777精品伊人久久久大香线蕉| 在线观看日韩电影| 色综合久久六月婷婷中文字幕| 99精品视频一区二区三区| 成人av电影在线播放| 成人av网址在线观看| 福利一区二区在线| 国产成人免费av在线| 国产成人精品免费看| 国产91综合网| 成人丝袜18视频在线观看| 成人午夜在线免费| 懂色av中文一区二区三区| 丁香婷婷综合网| 成人免费黄色在线| 成人看片黄a免费看在线| 不卡高清视频专区| 99精品欧美一区| 91丨porny丨首页| 色噜噜久久综合| 欧美群妇大交群的观看方式| 69堂成人精品免费视频| 日韩一区二区不卡| 日韩欧美国产wwwww| 欧美成人女星排行榜| 久久精品视频网| 国产精品一区二区91| 国产成人精品影视| 国产精品视频第一区| 欧美午夜一区二区|