Usage¶
The following flow solves the optimization problem. The number of flow corresponds the comment in the program example.
Define your
Algorithm
and/orSolver
Of course, classes that
py2dmat
defines are available
Prepare the input parameter,
info: py2dmat.Info
Make a dictionary as your favorite way
The below example uses a TOML formatted input file for generating a dictionary
Instantiate
solver: Solver
,runner: py2dmat.Runner
, andalgorithm: Algorithm
Invoke
algorithm.main()
Example:
import sys
import toml
import py2dmat
# (1)
class Solver(py2dmat.solver.SolverBase):
# Define your solver
...
class Algorithm(py2dmat.algorithm.AlgorithmBase):
# Define your algorithm
...
file_name = sys.argv[1]
# (2)
info = py2dmat.Info(toml.load(file_name))
# (3)
solver = Solver(info)
runner = py2dmat.Runner(solver, info)
algorithm = Algorithm(info, runner)
# (4)
algorithm.main()