Форум программистов «Весельчак У»
  *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

  • Рекомендуем проверить настройки временной зоны в вашем профиле (страница "Внешний вид форума", пункт "Часовой пояс:").
  • У нас больше нет рассылок. Если вам приходят письма от наших бывших рассылок mail.ru и subscribe.ru, то знайте, что это не мы рассылаем.
   Начало  
Наши сайты
Помощь Поиск Календарь Почта Войти Регистрация  
 
Страниц: [1]   Вниз
  Печать  
Автор Тема: Нужна помощь по Симплекс-методу  (Прочитано 3481 раз)
0 Пользователей и 1 Гость смотрят эту тему.
bodya_lp
Гость
« : 13-05-2009 15:06 » new

Не могу разобраца  в одной  процедуре  исходного кода программы. Где здесь исполняется  критерий оптимума. Кто может опишите  эту процедуру.
Код:
procedure SimplexMetod(n:boolean);
var Count,Count2,MinC,MinR:integer;
    MinEl,zna4,zna4TMP,zna4TMP2:double;
    boo,reshil:boolean;
begin
reshil:=false;
repeat
 boo:=false;
    for count:=1 to form1.StringGrid4.ColCount -1 do
     if strtofloat(form1.StringGrid4.Cells [count,1])<0 then boo:=true;
 if boo then
 begin
    MinC:=2;
    zna4:=strtofloat(form1.StringGrid4.Cells [2,1]);
    for count:=2 to form1.StringGrid4.ColCount -1 do
       if strtofloat(form1.StringGrid4.Cells [count,1])<zna4 then
        begin
            zna4:=strtofloat(form1.StringGrid4.Cells [count,1]);
            MinC:=count;
        end;
    zna4TMP:=strtofloat(form1.StringGrid4.Cells [1,2]);
    zna4TMP2:=strtofloat(form1.StringGrid4.Cells [MinC,2]);
    MinEl:=zna4TMP/zna4TMP2;
    MinR:=2;
    for Count:=2 to form1.StringGrid4.RowCount -1 do
    begin
        zna4TMP:=strtofloat(form1.StringGrid4.Cells [1,count]);
        zna4TMP2:=strtofloat(form1.StringGrid4.Cells [MinC,count]);
        if zna4TMP2>0 then
        begin
            zna4:=zna4TMP/zna4TMP2;
            if zna4<MinEl then
            begin
                MinEl:=zna4;
                MinR:=Count;
            end;
        end;
    end;
    MinEl:=strtofloat(form1.StringGrid4.Cells[MinC,MinR]);
    for count:=1 to form1.StringGrid4.ColCount -1 do
       form1.StringGrid4.Cells[count,MinR]:=floattostr(strtofloat(form1.StringGrid4.Cells[count,MinR])/MinEl);
    for count:=1 to form1.StringGrid4.ColCount -1 do
        for Count2:=1 to form1.StringGrid4.RowCount -1 do
            if (count<>MinC)and(count2<>MinR) then
                form1.StringGrid4.Cells [count,count2]:=floattostr(strtofloat(form1.StringGrid4.Cells [count,count2])-strtofloat(form1.StringGrid4.Cells [count,MinR])*strtofloat(form1.StringGrid4.Cells [MinC,count2]));
    form1.StringGrid4.Cells[0,MinR]:=form1.StringGrid4.Cells[MinC,0];
    for count:=1 to form1.StringGrid4.RowCount - 1 do
        if form1.StringGrid4.Cells [MinC,0]= form1.StringGrid4.Cells [0,count] then
            form1.StringGrid4.Cells [MinC,count]:='1'
        else
            form1.StringGrid4.Cells [MinC,count]:='0';
 end
 else
 begin
    form1.Label5.Caption :='Рішення найдене!!!';
    reshil:=true;
 end;
until reshil or n;
end;
« Последнее редактирование: 13-05-2009 18:42 от Finch » Записан
Страниц: [1]   Вверх
  Печать  
 

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines