User guide · 2.0 development

Reading Problems from Files

SHOT can read optimization problems from various file formats:

  • OSiL (Optimization Services Instance Language)

  • GAMS files (.gms)

  • Other formats supported by modeling systems

# Example: Reading from an OSiL file
# Note: Replace the path with an actual OSiL file path

# fileSolver = SHOTpy.Solver()
# problem_file = "/path/to/problem.osil"
#
# # Read the problem from file
# if fileSolver.setProblem(problem_file):
#     print(f"Successfully loaded problem from {problem_file}")
#     fileSolver.solveProblem()
#     print(f"Objective value: {fileSolver.getPrimalSolution().objValue:.4f}")
# else:
#     print("Failed to load problem file")

print("See commented code above for file loading example")