Example of Main Script
Bayesian optimization
import nimsos
#Specify the number of objective functions
ObjectivesNum = 2
#Specify the number of experimental conditions proposed by the AI in one cycle.
ProposalsNum = 2
#Specify the number of cycles.
CyclesNum = 3
#Specify a file listing experimental conditions.
candidates_file = "./candidates.csv"
#Specify a file that describes the experimental conditions proposed by the AI.
proposals_file = "./proposals.csv"
#Specify the folder to store the input files for the robotic experiments.
input_folder = "./EXPInput"
#Specify the folder where the output files from the robotic experiments will be stored.
output_folder = "./EXPOutput"
#Create a list to store history
res_history = nimsos.history(input_file = candidates_file,
num_objectives = ObjectivesNum)
for K in range(CyclesNum):
print("Start cycle", K+1)
#Random exploration is performed for the first cycle due to the lack of experimental data.
#If some experimental data are available from the beginning, the PHYSBO can be executed from the beginning and no branching is required.
if K==0:
method = "RE"
else:
method = "PHYSBO"
#Execution of the AI.
nimsos.selection(method = method,
input_file = candidates_file,
output_file = proposals_file,
num_objectives = ObjectivesNum,
num_proposals = ProposalsNum)
#Creation of input files for robotic experiments and execution of robotic experiments.
nimsos.preparation_input(machine = "STAN",
input_file = proposals_file,
input_folder = input_folder)
#Analysis of results by robotic experiments and update of candidates files.
nimsos.analysis_output(machine = "STAN",
input_file = proposals_file,
output_file = candidates_file,
num_objectives = ObjectivesNum,
output_folder = output_folder)
#Update list to store history
res_history = nimsos.history(input_file = candidates_file,
num_objectives = ObjectivesNum,
itt = K,
history_file = res_history)
#Output the distribution of the objective functions for each cycle.
nimsos.visualization.plot_distribution.plot(input_file = candidates_file,
num_objectives = ObjectivesNum)
#Plot the cycle dependence of the objective functions.
nimsos.visualization.plot_history.cycle(input_file = res_history,
num_cycles = CyclesNum)
#Plot the cycle dependence of the maximum value of the objective functions.
nimsos.visualization.plot_history.best(input_file = res_history,
num_cycles = CyclesNum)
Boundless objective-free exploration
import nimsos
#Specify the number of objective functions.
ObjectivesNum = 2
#Specify the number of experimental conditions proposed by the AI in one cycle.
ProposalsNum = 2
#Specify the number of cycles.
CyclesNum = 3
#Specify a file listing experimental conditions.
candidates_file = "./candidates.csv"
#Specify a file that describes the experimental conditions proposed by the AI.
proposals_file = "./proposals.csv"
#Specify the folder to store the input files for the robotic experiments.
input_folder = "./EXPInput"
#Specify the folder where the output files from the robotic experiments will be stored.
output_folder = "./EXPOutput"
#Create a list to store history
res_history = nimsos.history(input_file = candidates_file,
num_objectives = ObjectivesNum)
for K in range(CyclesNum):
print("Start cycle", K+1)
#Random exploration is performed for the first cycle due to the lack of experimental data.
#If some experimental data are available from the beginning, the BLOX can be executed from the beginning and no branching is required.
if K==0:
method = "RE"
else:
method = "BLOX"
#Execution of the AI.
nimsos.selection(method = method,
input_file = candidates_file,
output_file = proposals_file,
num_objectives = ObjectivesNum,
num_proposals = ProposalsNum)
#Creation of input files for robotic experiments and execution of robotic experiments.
nimsos.preparation_input(machine = "STAN",
input_file = proposals_file,
input_folder = input_folder)
#Analysis of results by robotic experiments and update of candidates files.
nimsos.analysis_output(machine = "STAN",
input_file = proposals_file,
output_file = candidates_file,
num_objectives = ObjectivesNum,
output_folder = output_folder)
#Update list to store history
res_history = nimsos.history(input_file = candidates_file,
num_objectives = ObjectivesNum,
itt = K,
history_file = res_history)
#Output the distribution of the objective functions for each cycle.
nimsos.visualization.plot_distribution.plot(input_file = candidates_file,
num_objectives = ObjectivesNum)
#Plot the cycle dependence of the objective functions.
nimsos.visualization.plot_history.cycle(input_file = res_history,
num_cycles = CyclesNum)
#Plot the cycle dependence of the maximum value of the objective functions.
nimsos.visualization.plot_history.best(input_file = res_history,
num_cycles = CyclesNum)
Phase diagram construction
import nimsos
#Specify the number of objective functions.
ObjectivesNum = 2
#Specify the number of experimental conditions proposed by the AI in one cycle.
ProposalsNum = 2
#Specify the number of cycles.
CyclesNum = 3
#Specify a file listing experimental conditions.
candidates_file = "./candidates.csv"
#Specify a file that describes the experimental conditions proposed by the AI.
proposals_file = "./proposals.csv"
#Specify the folder to store the input files for the robotic experiments.
input_folder = "./EXPInput"
#Specify the folder where the output files from the robotic experiments will be stored.
output_folder = "./EXPOutput"
#Create a list to store history.
res_history = nimsos.history(input_file = candidates_file,
num_objectives = ObjectivesNum)
for K in range(CyclesNum):
print("Start cycle", K+1)
#Random exploration is performed for the first cycle due to the lack of experimental data.
#If some experimental data are available from the beginning, the PDC can be executed from the beginning and no branching is required.
if K==0:
method = "RE"
else:
method = "PDC"
#Execution of the AI.
nimsos.selection(method = method,
input_file = candidates_file,
output_file = proposals_file,
num_objectives = ObjectivesNum,
num_proposals = ProposalsNum)
#Creation of input files for robotic experiments and execution of robotic experiments.
nimsos.preparation_input(machine = "STAN",
input_file = proposals_file,
input_folder = input_folder)
#Analysis of results by robotic experiments and update of candidates files.
nimsos.analysis_output(machine = "STAN",
input_file = proposals_file,
output_file = candidates_file,
num_objectives = ObjectivesNum,
output_folder = output_folder)
#Update list to store history.
res_history = nimsos.history(input_file = candidates_file,
num_objectives = ObjectivesNum,
itt = K,
history_file = res_history)
#Output phase diagram for each cycle.
nimsos.visualization.plot_phase_diagram.plot(input_file = candidates_file)
Usage of original modules
import nimsos
#Specify the number of objective functions.
ObjectivesNum = 2
#Specify the number of experimental conditions proposed by the AI in one cycle.
ProposalsNum = 2
#Specify the number of cycles.
CyclesNum = 3
#Specify a file listing experimental conditions.
candidates_file = "./candidates.csv"
#Specify a file that describes the experimental conditions proposed by the AI.
proposals_file = "./proposals.csv"
#Specify the folder to store the input files for the robotic experiments.
input_folder = "./EXPInput"
#Specify the folder where the output files from the robotic experiments will be stored.
output_folder = "./EXPOutput"
#Create a list to store history.
res_history = nimsos.history(input_file = candidates_file, num_objectives = ObjectivesNum)
for K in range(CyclesNum):
print("Start cycle", K+1)
#Execution of the AI.
import ai_tool_original
ai_tool_original.ORIGINAL(input_file = candidates_file,
output_file = proposals_file,
num_objectives = ObjectivesNum,
num_proposals = ProposalsNum).select()
#Creation of input files for robotic experiments and execution of robotic experiments.
import preparation_input_original
preparation_input_original.ORIGINAL(input_file = proposals_file,
input_folder = input_folder).perform()
#Analysis of results by robotic experiments and update of candidates files.
import analysis_output_original
analysis_output_original.ORIGINAL(input_file = proposals_file,
output_file = candidates_file,
num_objectives = ObjectivesNum,
output_folder = output_folder).perform()
#Update list to store history
res_history = nimsos.history(input_file = candidates_file, num_objectives = ObjectivesNum, itt = K, history_file = res_history)
#Output the distribution of the objective functions for each cycle.
nimsos.visualization.plot_distribution.plot(input_file = candidates_file, num_objectives = ObjectivesNum)
#Plot the cycle dependence of the objective functions.
nimsos.visualization.plot_history.cycle(input_file = res_history, num_cycles = CyclesNum)
#Plot the cycle dependence of the maximum value of the objective functions.
nimsos.visualization.plot_history.best(input_file = res_history, num_cycles = CyclesNum)