39 lines
848 B
C++
39 lines
848 B
C++
|
#ifndef KNAPSACK_HPP
|
||
|
#define KNAPSACK_HPP
|
||
|
|
||
|
#include <vector>
|
||
|
|
||
|
namespace knapsack
|
||
|
{
|
||
|
void CheckArgumentAmount(int argc);
|
||
|
|
||
|
struct PossibleObject
|
||
|
{
|
||
|
PossibleObject(int inputWeight, int inputValue, int i);
|
||
|
int itemNumber;
|
||
|
int weight;
|
||
|
int value;
|
||
|
};
|
||
|
|
||
|
bool SortByItemNumber(PossibleObject* lhs, PossibleObject* rhs);
|
||
|
|
||
|
class User
|
||
|
{
|
||
|
public:
|
||
|
void ReadNewFile(const char* inputFilePath);
|
||
|
void InputSafety(void);
|
||
|
void RunKnapsack(void);
|
||
|
void PrintResult(void);
|
||
|
int GetSolutionValue(void);
|
||
|
void _TestFileReadIn(std::vector<PossibleObject> testChoices);
|
||
|
void _TestKnapsack(void);
|
||
|
private:
|
||
|
std::vector<PossibleObject> choices;
|
||
|
std::vector<PossibleObject*> solution;
|
||
|
int limit;
|
||
|
int itemCount;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
#endif
|