dynamic change of the metric parameters

This commit is contained in:
Niko Feith 2023-06-02 14:06:59 +02:00
parent a3d6498c21
commit 0a83136430
4 changed files with 42 additions and 40 deletions

View File

@ -1,6 +1,6 @@
<template>
<v-row>
<v-col class="px-4">
<v-row class="flex-row">
<v-col class="flex-col px-4">
<v-row class="d-flex justify-space-evenly">
<v-select
:items="envs"
@ -59,20 +59,43 @@
class="control-slider"
label="Metric Parameter"
v-model="cstore.metric_parameter"
:step="cstore.metric_limits[cstore.metric][2]"
:min="cstore.metric_limits[cstore.metric][0]"
:max="cstore.metric_limits[cstore.metric][1]"
thumb-label
/>
<v-slider
v-if="cstore.metric === 'improvement'"
class="control-slider"
label="Metric Parameter"
v-model="cstore.metric_parameter2"
:step="0.01"
:min="0"
:max="1"
thumb-label
/>
<v-row class="justify-space-evenly pa-1">
<v-checkbox v-model="cstore.fixed_seed" label="fixed seed" />
<v-checkbox v-model="cstore.save_result" label="save_result" />
<v-row class="justify-space-evenly px-1 py-0">
<v-checkbox
class="py-0 my-0"
v-model="cstore.fixed_seed"
label="fixed seed"
/>
<v-checkbox
class="py-0 my-0"
v-model="cstore.save_result"
label="save_result"
/>
</v-row>
<v-row class="d-flex justify-space-evenly mb-1">
<v-btn color="primary" @click="cstore.setSendWeights()"
<v-row class="d-flex justify-space-evenly py-0">
<v-btn
class="py-0 my-0"
color="primary"
@click="cstore.setSendWeights()"
>Send Weights</v-btn
>
<v-btn color="secondary" @click="cstore.setRunner()">Run</v-btn>
<v-btn class="py-0 my-0" color="secondary" @click="cstore.setRunner()"
>Run</v-btn
>
</v-row>
</v-col>
</v-row>
@ -87,7 +110,7 @@ const pstore = usePStore();
const cstore = useCStore();
const envs = cstore.envs;
const metrics = cstore.metircs;
const metrics = cstore.metrics;
const acq_funs = cstore.acq_funs;
const maxStepComp = computed({

View File

@ -166,24 +166,11 @@ watch(
console.log(active_eval_response);
active_rl_eval_pub.publish(active_eval_response);
// await sleep(1000);
console.log("New Policy/ Weights published");
pendingRequest.value = false;
}
);
// const rl_service = new ROS.Service({
// ros: ros,
// name: "/rl_srv",
// serviceType: "active_bo_msgs/srv/RLRollOut",
// });
// const bo_service = new ROS.Service({
// ros: ros,
// name: "/bo_srv",
// serviceType: "active_bo_msgs/srv/BO",
// });
const active_bo_pending = ref(false);
const active_bo_request = new ROS.Topic({
@ -225,21 +212,6 @@ watch(
active_bo_request.publish(request_msg);
}
);
// watch(
// () => active_bo_pending.value,
// () => {
// if (active_bo_pending.value) {
// return;
// }
// const rl_request = new ROS.ServiceRequest({
// env: cstore.env,
// policy: pstore.policy,
// });
//
// rl_service.callService(rl_request, () => {});
// }
// );
</script>
<style scoped></style>

View File

@ -36,7 +36,7 @@
class="tile"
:style="{ height: 'calc(40vh - 24px)', width: '100%' }"
>
<MountainCarCanvas />
<RLCanvas />
</v-card>
</v-col>
<v-col cols="12">
@ -58,7 +58,7 @@ import WeightTuner from "@/components/WeightTuner.vue";
import RewardPlot from "@/components/RewardPlot.vue";
import PolicyPlot from "@/components/PolicyPlot.vue";
import ControlPanel from "@/components/ControlPanel.vue";
import MountainCarCanvas from "@/components/RLCanvas.vue";
import RLCanvas from "@/components/RLCanvas.vue";
</script>
<style scoped>

View File

@ -6,7 +6,13 @@ export const useCStore = defineStore("Control Store", {
env: "Mountain Car",
envs: ["Mountain Car", "Cartpole", "Acrobot", "Pendulum"],
metric: "random",
metircs: ["random", "regular", "max acquisition", "improvement"],
metrics: ["random", "regular", "max_acquisition", "improvement"],
metric_limits: {
random: [0.0, 1.0, 0.01],
regular: [1, 100, 1],
max_acquisition: [1, 200, 1],
improvement: [1, 100, 1],
},
acq_fun: "Expected Improvement",
acq_funs: [
"Expected Improvement",
@ -16,6 +22,7 @@ export const useCStore = defineStore("Control Store", {
nr_episodes: 50,
nr_runs: 10,
metric_parameter: 0.5,
metric_parameter2: 0.5,
sendWeights: false,
runner: false,
fixed_seed: false,