FanucWeb/ActiveBOWeb/src/store/PolicyStore.js

35 lines
902 B
JavaScript
Raw Normal View History

2023-02-17 12:29:49 +00:00
import { defineStore } from "pinia";
export const usePStore = defineStore('Policy Store', {
state: () => {
return {
2023-02-28 18:33:48 +00:00
policy: Array(10).fill(0),
2023-02-27 15:49:09 +00:00
nr_weights: 5,
weights: [0, 0, 0, 0, 0],
2023-02-28 18:33:48 +00:00
max_steps: 10,
2023-02-17 12:29:49 +00:00
}
},
getters: {
getPolicy: (state) => state.policy,
2023-02-27 15:49:09 +00:00
getNrWeights: (state) => state.nr_weights,
2023-02-17 12:29:49 +00:00
getWeights: (state) => state.weights,
2023-02-27 15:49:09 +00:00
getMaxSteps: (state) => state.max_steps,
2023-02-17 12:29:49 +00:00
},
actions: {
setPolicy(value) {
2023-02-28 18:33:48 +00:00
this.policy = null;
2023-02-17 12:29:49 +00:00
this.policy = value;
},
2023-02-27 15:49:09 +00:00
setNrWeights(value) {
this.nr_weights = value;
this.weights = Array(this.nr_weights).fill(0);
},
2023-02-17 12:29:49 +00:00
setWeights(value) {
this.weights = value;
},
2023-02-27 15:49:09 +00:00
setMaxSteps(value) {
this.max_steps = value;
2023-02-17 12:29:49 +00:00
},
}
})