This commit is contained in:
Niko Feith 2023-03-08 16:54:22 +01:00
parent c0abdae2e8
commit 9e61c3244b
5 changed files with 56 additions and 49 deletions

5
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@ -39,7 +39,7 @@
label="nr runs"
v-model="cstore.nr_runs"
:step="1"
:min="2"
:min="1"
:max="50"
thumb-label
:disabled="runRef"

View File

@ -1,11 +1,11 @@
<template>
<canvas id="policy-chart"/>
<canvas id="policy-chart" />
</template>
<script setup>
import { onMounted, watch } from "vue";
import { usePStore } from "@/store/PolicyStore";
import { Chart } from 'chart.js/auto';
import { Chart } from "chart.js/auto";
const store = usePStore();
@ -13,16 +13,18 @@ let chartHandle;
function buildChart() {
const policy = store.getPolicy;
const policy_labels = Array(policy.length).fill(0).map((_, i) => i);
const policy_labels = Array(policy.length)
.fill(0)
.map((_, i) => i);
const RewardPlot = {
data: {
datasets: [
{
type: 'line',
xAxisID: 'x',
yAxisID: 'y',
type: "line",
xAxisID: "x",
yAxisID: "y",
data: policy,
borderColor: '#3DC47A',
borderColor: "#3DC47A",
borderWidth: 2,
pointRadius: 0,
},
@ -34,14 +36,14 @@ function buildChart() {
animation: {
duration: 0,
},
plugins:{
plugins: {
legend: {
display: false,
},
},
lineTension: 0,
tooltip: {
mode: 'label',
mode: "label",
},
scales: {
x: {
@ -53,9 +55,8 @@ function buildChart() {
autoSkip: true,
},
},
y:
{
type: 'linear',
y: {
type: "linear",
ticks: {
beginAtZero: true,
},
@ -63,7 +64,7 @@ function buildChart() {
},
},
};
const ctx = document.getElementById('policy-chart');
const ctx = document.getElementById("policy-chart");
// eslint-disable-next-line no-new
chartHandle = new Chart(ctx, RewardPlot);
}
@ -72,18 +73,18 @@ onMounted(() => {
buildChart();
});
watch(() => store.getPolicy, () => {
watch(
() => store.getPolicy,
() => {
const policy = store.getPolicy;
const policy_labels = Array(policy.length).fill(0).map((_, i) => i)
chartHandle.options.scales.x.labels = policy_labels;
chartHandle.options.scales.x.labels = Array(policy.length)
.fill(0)
.map((_, i) => i);
chartHandle.data.datasets[0].data = policy;
chartHandle.update();
});
}
);
</script>
<style scoped>
</style>
<style scoped></style>

View File

@ -1,8 +1,10 @@
<template>
<v-row no-gutters justify="center" class="weight-tuner">
<!-- eslint-disable-next-line -->
<v-col v-for="(_, idx) in weights">
<div class="weight-container">
<vue-slider v-model="weights[idx]"
<vue-slider
v-model="weights[idx]"
direction="btt"
:height="100"
:min="-1"
@ -18,13 +20,12 @@
import { usePStore } from "@/store/PolicyStore";
import VueSlider from "vue-slider-component";
import 'vue-slider-component/theme/default.css';
import {computed} from "vue";
import "vue-slider-component/theme/default.css";
import { computed } from "vue";
const store = usePStore()
const store = usePStore();
const weights = computed(() => store.weights);
</script>
<style scoped>

View File

@ -11,8 +11,8 @@ export const useCStore = defineStore("Control Store", {
"Probability of Improvement",
"Upper Confidence Bound",
],
nr_episodes: 10,
nr_runs: 2,
nr_episodes: 50,
nr_runs: 10,
greedy: 0,
sendWeights: false,
runner: false,