platypus.io module
- platypus.io.dump(obj, fp, indent=None)
Dumps the object to JSON.
This overrides
json.dump()to convert Platypus types to JSON. Use the correspondingload()method in this module to load the JSON back into memory.Parameters
- objobject
The object to dump to JSON.
- fpfile-like
A file-like object, typically created by
open().- indent:
Controls the formatting of the JSON fle, see
json.dump().
- platypus.io.load(fp, problem=None)
Loads the JSON data.
Parameters
- fpfile-like
A file-like object, typically created by
open().- problemProblem, optional
Optional problem definition. If not set, a placeholder is used.
- platypus.io.load_json(file, problem=None)
Loads the solutions stored in a JSON file.
Parameters
- filestr, bytes, or os.PathLike
The file.
- problemProblem, optional
The problem definition. If
None, a placeholder is used.
- platypus.io.load_objectives(file, problem=None)
Loads objective values from a file.
Parameters
- filestr, bytes, or
os.PathLike The file.
- problemProblem, optional
The problem definition. If
None, a placeholder is used.
- filestr, bytes, or
- platypus.io.save_json(file, solutions, indent=None)
Converts the solutions to JSON and saves to a file.
If given an
Algorithmobject, extra information about the algorithm state and problem are stored in the JSON; however, this is for informational purposes only and can not be read back.Parameters
- filestr, bytes, or os.PathLike
The file.
- solutionsobject
The solutions, archive, or algorithm.
- indent:
Controls the formatting of the JSON fle, see
json.dump().