diff --git a/main.py b/main.py index 289c573ac7977576f0ec193b85b9db3162dc24bf..725a6fe3a075db8acf5e0da3f48c7d4321b90cb8 100644 --- a/main.py +++ b/main.py @@ -22,15 +22,26 @@ logger = init_logging.get_logger(__name__) def test_simplex(): simplex = Simplex() - simplex._a = [ - [1,3,1,0,0], - [2,2,0,1,0], - [3,1,0,0,1] - ] - simplex._b = [1, 1, 1, 1, 0] - simplex._c = [1, 1, 1, 0, 0] + # Read and display ex_1.json. + logger.info('') + logger.info('Reading in resources/ex_1.json.') + simplex.read_data_from_json('./resources/json_files/ex_1.json') + simplex.display_tableau() + logger.info('') + + # Read and display ex_2.json. + logger.info('') + logger.info('Reading in resources/ex_2.json.') + simplex.read_data_from_json('./resources/json_files/ex_2.json') + simplex.display_tableau() + logger.info('') + # Read and display ex_3.json. + logger.info('') + logger.info('Reading in resources/ex_3.json.') + simplex.read_data_from_json('./resources/json_files/ex_3.json') simplex.display_tableau() + logger.info('') diff --git a/resources/json_files/ex_1.json b/resources/json_files/ex_1.json new file mode 100644 index 0000000000000000000000000000000000000000..68ce157595942c88b7d54f8f388ecbb7c6df90c1 --- /dev/null +++ b/resources/json_files/ex_1.json @@ -0,0 +1,9 @@ +{ + "Description": "A basic simplex, consisting of only 1's and 0's for coefficients.", + "constraints": [ + [1, 1, 1, 0], + [1, 1, 0, 1] + ], + "constants": [1, 1], + "objective": [1, 1, 0, 0] +} diff --git a/resources/json_files/ex_2.json b/resources/json_files/ex_2.json new file mode 100644 index 0000000000000000000000000000000000000000..bc75e9bade183897ae954998553a2a7df17b5a8b --- /dev/null +++ b/resources/json_files/ex_2.json @@ -0,0 +1,10 @@ +{ + "Description": "A 3x3 simplex, with basic variables provided.", + "constraints": [ + [1, 1, 1, 1, 0, 0], + [2, -1, 2, 0, 1, 0], + [2, 1, 0, 0, 0, 1] + ], + "constants": [5, 3, 4], + "objective": [2, 3, 1, 0, 0, 0] +} diff --git a/resources/json_files/ex_3.json b/resources/json_files/ex_3.json new file mode 100644 index 0000000000000000000000000000000000000000..40631a68a347af5bb2cd57b2b554f5429916b19a --- /dev/null +++ b/resources/json_files/ex_3.json @@ -0,0 +1,10 @@ +{ + "Description": "Same as ex_2.json, but with basic variables not provided.", + "constraints": [ + [1, 1, 1], + [2, -1, 2], + [2, 1, 0] + ], + "constants": [5, 3, 4], + "objective": [2, 3, 1] +}