Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions docs/.vitepress/theme/components/FitnessLandscape3D.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,19 @@ const surfaceGeometry = computed(() => {
for (let i = 0; i < positions.count; i++) {
const u = positions.getX(i) // [-1, 1]
const v = positions.getY(i) // [-1, 1]

const x = xMin + (u + 1) / 2 * (xMax - xMin)
const y = yMin + (v + 1) / 2 * (yMax - yMin)
const z = evaluateFunction(x, y, props.functionName)

positions.setZ(i, z)
zMin = Math.min(zMin, z)
zMax = Math.max(zMax, z)
}

// Second pass: apply colors based on Z values
const colorScale = getColorScale(props.colorScale, zMin, zMax)

for (let i = 0; i < positions.count; i++) {
const z = positions.getZ(i)
const colorValue = d3.color(colorScale(z))
Expand Down Expand Up @@ -168,11 +168,11 @@ const trajectoryGeometry = computed(() => {
const points = props.trajectory.map(p => {
const [xMin, xMax] = props.xRange
const [yMin, yMax] = props.yRange

// Map world coordinates to [-1, 1] range
const u = -1 + (p.x - xMin) / (xMax - xMin) * 2
const v = -1 + (p.y - yMin) / (yMax - yMin) * 2

return new THREE.Vector3(u, v, p.z)
})

Expand All @@ -185,10 +185,10 @@ const startPoint = computed(() => {
const p = props.trajectory[0]
const [xMin, xMax] = props.xRange
const [yMin, yMax] = props.yRange

const u = -1 + (p.x - xMin) / (xMax - xMin) * 2
const v = -1 + (p.y - yMin) / (yMax - yMin) * 2

return new THREE.Vector3(u, v, p.z)
})

Expand All @@ -197,10 +197,10 @@ const endPoint = computed(() => {
const p = props.trajectory[props.trajectory.length - 1]
const [xMin, xMax] = props.xRange
const [yMin, yMax] = props.yRange

const u = -1 + (p.x - xMin) / (xMax - xMin) * 2
const v = -1 + (p.y - yMin) / (yMax - yMin) * 2

return new THREE.Vector3(u, v, p.z)
})
</script>
Expand All @@ -227,15 +227,15 @@ const endPoint = computed(() => {
<span class="hint">πŸ–±οΈ Drag to rotate β€’ Scroll to zoom β€’ Right-click to pan</span>
</div>
</div>

<div class="chart" :style="{ height: chartHeight }">
<TresCanvas>
<TresPerspectiveCamera :position="[3, 3, 5]" :fov="45" />
<OrbitControls />

<!-- Surface mesh with vertex colors -->
<TresMesh :geometry="surfaceGeometry">
<TresMeshPhongMaterial
<TresMeshPhongMaterial
:vertex-colors="true"
:side="THREE.DoubleSide"
:shininess="100"
Expand All @@ -244,7 +244,7 @@ const endPoint = computed(() => {
</TresMesh>

<!-- Trajectory line -->
<TresLine
<TresLine
v-if="trajectoryGeometry"
:geometry="trajectoryGeometry"
>
Expand Down
10 changes: 5 additions & 5 deletions docs/benchmark-demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const ecdfData = computed(() => {
const threshold = 0.01 / (budget / 2000)
return fitnessValues.filter(f => f <= threshold).length / fitnessValues.length
})

return {
algorithm: opt,
budget: budgets,
Expand Down Expand Up @@ -171,7 +171,7 @@ const metadata = computed(() => mockData.value.metadata)
Comparison of **{{ optimizers.join(' vs ') }}** on the **Shifted Ackley** function (dimension 2):

<ClientOnly>
<ConvergenceChart
<ConvergenceChart
:data="convergenceData"
title="Convergence: Shifted Ackley (2D)"
xAxisLabel="Iteration"
Expand All @@ -188,7 +188,7 @@ Comparison of **{{ optimizers.join(' vs ') }}** on the **Shifted Ackley** functi
Statistical distribution of final fitness values across multiple runs:

<ClientOnly>
<ViolinPlot
<ViolinPlot
:data="violinData"
title="Final Fitness Distribution: Shifted Ackley (2D)"
yAxisLabel="Best Fitness"
Expand All @@ -205,7 +205,7 @@ Statistical distribution of final fitness values across multiple runs:
Empirical Cumulative Distribution Function showing the proportion of targets reached:

<ClientOnly>
<ECDFChart
<ECDFChart
:data="ecdfData"
title="ECDF: Shifted Ackley (2D)"
xAxisLabel="Budget (function evaluations)"
Expand All @@ -221,7 +221,7 @@ Empirical Cumulative Distribution Function showing the proportion of targets rea
Interactive 3D visualization of the Ackley function:

<ClientOnly>
<FitnessLandscape3D
<FitnessLandscape3D
functionName="ackley"
:xRange="[-5, 5]"
:yRange="[-5, 5]"
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"@tresjs/core": "^4.3.6",
"d3": "^7.9.0",
"d3-scale-chromatic": "^3.1.0",
"three": "^0.170.0"
"three": "^0.182.0"
}
}
4 changes: 2 additions & 2 deletions docs/public/test-data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const convergenceData = computed(() => {
algorithm: opt,
iterations: Array.from({length: 10}, (_, i) => i * 10),
mean: firstRun.history.best_fitness,
std: firstRun.history.mean_fitness.map((m, i) =>
std: firstRun.history.mean_fitness.map((m, i) =>
Math.abs(m - firstRun.history.best_fitness[i])
)
}
Expand Down Expand Up @@ -139,7 +139,7 @@ const ecdfData = computed(() => {
// Your proportion calculation logic
return 0.5 // Example
})

return {
algorithm: opt,
budget: budgets,
Expand Down
8 changes: 4 additions & 4 deletions docs/test-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This page demonstrates the ECharts and TresJS visualization components.
### ECDF Chart

<ClientOnly>
<ECDFChart
<ECDFChart
:data="[
{
algorithm: 'PSO',
Expand All @@ -27,7 +27,7 @@ This page demonstrates the ECharts and TresJS visualization components.
### Convergence Chart

<ClientOnly>
<ConvergenceChart
<ConvergenceChart
:data="[
{
algorithm: 'PSO',
Expand All @@ -49,7 +49,7 @@ This page demonstrates the ECharts and TresJS visualization components.
### Violin Plot

<ClientOnly>
<ViolinPlot
<ViolinPlot
:data="[
{
algorithm: 'PSO',
Expand All @@ -69,7 +69,7 @@ This page demonstrates the ECharts and TresJS visualization components.
### Fitness Landscape

<ClientOnly>
<FitnessLandscape3D
<FitnessLandscape3D
functionName="ackley"
:xRange="[-5, 5]"
:yRange="[-5, 5]"
Expand Down
4 changes: 2 additions & 2 deletions scripts/test-benchmark-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ TYPES_FILE="$PROJECT_ROOT/docs/.vitepress/theme/types/benchmark.ts"
if [[ -f "$TYPES_FILE" ]]; then
echo -e "${GREEN}βœ“ TypeScript types file found${NC}"
echo -e " Location: ${TYPES_FILE}"

# Create a simple TypeScript test
cat > "$TEMP_DIR/test_types.ts" << 'TS_SCRIPT'
import type { BenchmarkDataSchema } from '../../../.vitepress/theme/types/benchmark'
Expand All @@ -156,7 +156,7 @@ const benchmarkData: BenchmarkDataSchema = data as BenchmarkDataSchema
console.log('βœ“ TypeScript types are compatible')
console.log(` Functions: ${Object.keys(benchmarkData.benchmarks).join(', ')}`)
TS_SCRIPT

# Check if Node.js and TypeScript are available
if command -v node &> /dev/null && [[ -d "$PROJECT_ROOT/docs/node_modules" ]]; then
cd "$PROJECT_ROOT/docs"
Expand Down
Loading