Elpee Logo

elpee.data_handler

A generalized module for reading & writing LP problem configurations into json or yaml files.

Import

from elpee import data_handler

Methods

read_file(file_path: str) StandardProblem

Read the standardized problem configuration from the given file path

Parameters

  • file_pathstr

    File path to the file containing LP problem to be read

Return

elpee.StandardProblem object of the LP problem in the file

Example Code

from elpee import data_handler

# reading from a json file
data_handler.read_file("file/path/to/elpee/problem.json")

# reading from a yaml file
data_handler.read_file("file/path/to/elpee/problem.yaml")
save_file(problem: StandardProblem, file_format: str, file_path: str)

Save the standardized problem configurations to specified file format

Parameters

  • problemelpee.StandardProblem

    Standardized LP problem to be saved into file

  • file_formatstr (Options: [“json”, “yaml”])

    Specifies file type used for saving solution

  • file_pathstr

    File path of file to be saved

Example Code

from elpee import data_handler

# let lp_solution be the solution obtained from an elpee problem to be saved to a json file

data_handler.save_file(lp_solution, file_format="json", file_path="file/path/to/save/solution.json")

A function to print the elpee.StandardProblem from the file

Parameters

  • file_pathstr

    File path to the file containing LP problem to be read

  • show_interpreterbool (default = True)

    Provides interpretation of values in simplex table when True

Example Code

from elpee import data_handler

# let lp_solution be the solution obtained from an elpee problem from a yaml file

data_handler.print_lp_problem("file/path/to/save/solution.yaml")