it kinda works

This commit is contained in:
emil28092005
2024-09-22 19:33:24 +03:00
parent 36b4250ad3
commit 9cf37ec9e4
2 changed files with 41 additions and 17 deletions
+14 -10
View File
@@ -4,16 +4,20 @@
#include "simplex.h"
int main() {
Vector C(6);
Matrix A(6, 4);
int Carr[C.size()] = {-5, -4, 0, 0, 0, 0};
for (int i = 0; i < C.size(); ++i) {
C[i] = Carr[i];
Vector C = {5, 4, 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};
Result result = Simplex(C, A, b);
if(result.state == bounded) {
if(result.solution == nullptr) {
std::cout << "HUYN: Khong tim duoc nghiem" << std::endl;
}
std::cout << *result.solution << std::endl;
std::cout << result.objective_fucntion_value << std::endl;
}
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(A.getRows());
b = {24, 6, 1, 2};
std::cout << A << std::endl;
std::cout << C << std::endl;
return 0;
}