-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLinearProgram.h
57 lines (34 loc) · 1.2 KB
/
LinearProgram.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// Created by jgier on 25.05.2022.
//
#ifndef SIMPLEX_LINEARPROGRAM_H
#define SIMPLEX_LINEARPROGRAM_H
#include "linear_algebra.h"
#include "Solver.h"
#include "typedef.h"
#include <istream>
class LinearProgram {
public:
explicit LinearProgram(std::basic_istream<char> & file);
[[maybe_unused]] LinearProgram(Column target_vector, Matrix constraints_matrix, Column constraints_vector);
void maximize();
void make_constraints_vector_non_negative();
[[nodiscard]] Row const& target_vector() const;
[[nodiscard]] Column const& constraints_vector() const;
[[nodiscard]] Matrix const& constraints_matrix() const;
[[nodiscard]] size_t num_variables() const;
[[nodiscard]] size_t num_equations() const;
void set_solution(Column soluiton);
[[nodiscard]] bool is_solution(Column const& solution) const;
[[nodiscard]] Column get_solution() const;
[[nodiscard]] Value get_solution_value() const;
[[nodiscard]] State state() const;
void print();
private:
Row _target_vector; // c
Column _constraints_vector; // b
Matrix _constraints_matrix; // A
Column _solution;
State _state;
};
#endif //SIMPLEX_LINEARPROGRAM_H