aboutsummaryrefslogtreecommitdiffstats
path: root/include/simplex.h
blob: 22bf1e3c0e006270333a30f9c9e96edcdf5b45b7 (plain)
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
#ifndef SIMPLEX_H
#define SIMPLEX_H

#include <vector>

typedef std::vector<std::vector<double>> BasicRep;

class Simplex
{
public:
    Simplex(int m, int n);
    Simplex(BasicRep basic_rep);

    void initialize(BasicRep basic_rep);
    void solve();
    double getMin() const;
private:
    BasicRep basic_rep_;

    bool isDone() const;
    int inputBasicVar() const;
    int outputBasicVar(int column) const;
    void rotate(int input, int output);
};

extern void printBR(const BasicRep &basic_rep);

#endif