Заранее спасибо за помощь. Не работает программа для Симплекс Метода. Сам visual studio выдает ошибку с " Ошибка CS1501 Ни одна из перегрузок метода "this" не принимает 2 аргументов.Строка 137" Github:https://github.com/Nikolinc/Simplex-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp5
{
public partial class Form1 : Form
{
int col; int r = 0;
int row; int c = 0;
DataTable dt = new DataTable();
DataTable basis = new DataTable();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
table();
initialization();
}
private void table()
{
col = Convert.ToInt32(textBox1.Text);
row = Convert.ToInt32(textBox2.Text);
dt.Columns.Add("Basis");
for (int i=1;i <col+row+1; i++)
{
dt.Columns.Add("X"+Convert.ToString(i));
}
dt.Columns.Add("Solving");
dt.Rows.Add("F");
for (int i = col+1; i< col + row + 1; i++)
{
dt.Rows.Add("X"+Convert.ToString(i));
}
dataGridView1.DataSource = dt;
}
private void initialization()
{
for (int i = 0; i <row+1; i++)
{
for (int j = 0; j < col + row +1; j++)
{
if(j > col)
{
if ((i != 0)& (i == j - col))
{
dt.Rows[i][j] = "1";
}
else
{
dt.Rows[i][j] = "0";
}
}
}
}
}
private void BasisTable()
{
col = Convert.ToInt32(textBox1.Text);
row = Convert.ToInt32(textBox2.Text);
basis.Columns.Add("Basis");
for (int i=1;i <col+row+1; i++)
{
basis.Columns.Add("X"+Convert.ToString(i));
}
basis.Columns.Add("Solving");
basis.Rows.Add("F");
basis.Rows.Add("X"+Convert.ToString(r));
for (int i = col+2; i< col + row+2; i++)
{
basis.Rows.Add("X"+Convert.ToString(i));
}
}
private void Solvig(int max = int.MinValue, int min=int.MaxValue)
{
for (int i = 0; i < row + 1; i++)
{
for (int j = 0; j < col + row + 1; j++)
{
if ((j < col)&(i == 0))
{
if (Math.Abs(Convert.ToInt32(dt.Rows[i][j])) > max)
{
max = Convert.ToInt32(dt.Rows[i][j]);
c = i;
}
}
if(i == (row + 2))
{
if (Convert.ToInt32(dt.Rows[i][j]) < min)
{
min = Convert.ToInt32(dt.Rows[i][j]);
r = j; }
}
}
}
for(int i = 0; i < row+1; i++)
{
for(int j = 0; j < col + row+2; j++)
{
basis.Rows[i,j] = Convert.ToString((Convert.ToInt32(dt.Rows[i][j]) * Convert.ToInt32(dt.Rows[c][r])) - Convert.ToInt32(dt.Rows[i][r])* Convert.ToInt32(dt.Rows[c][j])/ Convert.ToInt32(dt.Rows[c][r]));
}
}
}
private void button2_Click(object sender, EventArgs e)
{
BasisTable();
dataGridView1.DataSource = basis;
Solvig();
}
private void button3_Click(object sender, EventArgs e)
{
dt.Clear();
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
}
}
basis.Rows[i, j]
наbasis.Rows[i][j]
. Ошибки в скобках не было, но лучше конечно сократить эту строчку и сделать её более читабельной.