Move general matrix to simplex and fix bugs

This commit is contained in:
Ilya Grigorev
2024-09-22 23:17:49 +05:00
parent 9cf37ec9e4
commit 98d5fc9da9
7 changed files with 101 additions and 46 deletions
+4 -2
View File
@@ -4,7 +4,8 @@
#include "simplex.h"
int main() {
Vector C = {5, 4, 0, 0};
// TODO: Initially should be positive
Vector C = {-5, -4, 0, 0, 0, 0};
Matrix A = {{6, 4, 1, 0, 0, 0}, {1, 2, 0, 1, 0, 0}, {-1, 1, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 1}};
Vector b = {24, 6, 1, 2};
@@ -12,11 +13,12 @@ int main() {
if(result.state == bounded) {
if(result.solution == nullptr) {
std::cout << "HUYN: Khong tim duoc nghiem" << std::endl;
// TODO: error
}
std::cout << *result.solution << std::endl;
std::cout << result.objective_fucntion_value << std::endl;
delete result.solution;
}
return 0;