Added full study configuration UI: - Create studies with isolated folder structure (sim/, results/, config.json) - File management: users drop .sim/.prt files into study's sim folder - NX expression extraction: journal script to explore .sim file - Configuration UI for design variables, objectives, and constraints - Save/load study configurations through API - Step-by-step workflow: create → add files → explore → configure → run Backend API (app.py): - POST /api/study/create - Create new study with folder structure - GET /api/study/<name>/sim/files - List files in sim folder - POST /api/study/<name>/explore - Extract expressions from .sim file - GET/POST /api/study/<name>/config - Load/save study configuration Frontend: - New study configuration view with 5-step wizard - Modal for creating new studies - Expression explorer with clickable selection - Dynamic forms for variables/objectives/constraints - Professional styling with config cards NX Integration: - extract_expressions.py journal script - Scans .sim and all loaded .prt files - Identifies potential design variable candidates - Exports expressions with values, formulas, units Each study is self-contained with its own geometry files and config.
308 lines
14 KiB
HTML
308 lines
14 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Atomizer - Optimization Dashboard</title>
|
||
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
|
||
<link rel="stylesheet" href="styles.css">
|
||
</head>
|
||
<body>
|
||
<div class="dashboard-container">
|
||
<!-- Header -->
|
||
<header class="dashboard-header">
|
||
<div class="header-content">
|
||
<h1>⚛️ Atomizer</h1>
|
||
<p class="subtitle">Optimization Dashboard</p>
|
||
</div>
|
||
<div class="header-actions">
|
||
<button class="btn btn-primary" onclick="showNewOptimizationModal()">
|
||
▶️ New Optimization
|
||
</button>
|
||
<button class="btn btn-secondary" onclick="refreshStudies()">
|
||
🔄 Refresh
|
||
</button>
|
||
</div>
|
||
</header>
|
||
|
||
<!-- Main Content -->
|
||
<div class="main-content">
|
||
<!-- Sidebar -->
|
||
<aside class="sidebar">
|
||
<div class="sidebar-section">
|
||
<h3>Studies</h3>
|
||
<div id="studiesList" class="studies-list">
|
||
<p class="loading">Loading studies...</p>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="sidebar-section">
|
||
<h3>Active Optimizations</h3>
|
||
<div id="activeOptimizations" class="active-list">
|
||
<p class="empty">No active optimizations</p>
|
||
</div>
|
||
</div>
|
||
</aside>
|
||
|
||
<!-- Content Area -->
|
||
<main class="content-area">
|
||
<!-- Welcome Screen -->
|
||
<div id="welcomeScreen" class="welcome-screen">
|
||
<h2>Welcome to Atomizer</h2>
|
||
<p>Select a study from the sidebar or create a new study</p>
|
||
<div class="quick-actions">
|
||
<button class="btn btn-large btn-primary" onclick="showCreateStudyModal()">
|
||
Create New Study
|
||
</button>
|
||
<button class="btn btn-large btn-secondary" onclick="refreshStudies()">
|
||
View Existing Studies
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Study Configuration View -->
|
||
<div id="studyConfig" class="study-config" style="display: none;">
|
||
<div class="study-header">
|
||
<div>
|
||
<h2 id="configStudyTitle">Configure Study</h2>
|
||
<p id="configStudyMeta" class="study-meta"></p>
|
||
</div>
|
||
<div class="study-actions">
|
||
<button class="btn btn-secondary" onclick="backToStudyList()">
|
||
← Back
|
||
</button>
|
||
<button class="btn btn-primary" onclick="saveStudyConfiguration()">
|
||
💾 Save Configuration
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Configuration Steps -->
|
||
<div class="config-steps">
|
||
<!-- Step 1: Sim Files -->
|
||
<div class="config-step">
|
||
<h3>1. Simulation Files</h3>
|
||
<div class="step-content">
|
||
<p class="step-description">Drop your .sim and .prt files in the sim folder, then explore the model</p>
|
||
<div class="file-info">
|
||
<p><strong>Sim Folder:</strong> <span id="simFolderPath"></span></p>
|
||
<button class="btn btn-secondary" onclick="openSimFolder()">Open Folder</button>
|
||
<button class="btn btn-primary" onclick="refreshSimFiles()">Refresh Files</button>
|
||
</div>
|
||
<div id="simFilesList" class="files-list"></div>
|
||
<button id="exploreBtn" class="btn btn-primary" onclick="exploreSimFile()" disabled>
|
||
🔍 Explore .sim File
|
||
</button>
|
||
<div id="expressionsList" class="expressions-list" style="display: none;"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 2: Design Variables -->
|
||
<div class="config-step">
|
||
<h3>2. Design Variables</h3>
|
||
<div class="step-content">
|
||
<p class="step-description">Select expressions to use as design variables and set their bounds</p>
|
||
<div id="designVariablesConfig" class="variables-config">
|
||
<p class="empty">Explore .sim file first to see available expressions</p>
|
||
</div>
|
||
<button class="btn btn-secondary" onclick="addDesignVariable()">+ Add Variable</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 3: Objectives -->
|
||
<div class="config-step">
|
||
<h3>3. Objectives</h3>
|
||
<div class="step-content">
|
||
<p class="step-description">Define what you want to optimize (minimize or maximize)</p>
|
||
<div id="objectivesConfig" class="objectives-config">
|
||
<p class="empty">No objectives defined yet</p>
|
||
</div>
|
||
<button class="btn btn-secondary" onclick="addObjective()">+ Add Objective</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 4: Constraints -->
|
||
<div class="config-step">
|
||
<h3>4. Constraints</h3>
|
||
<div class="step-content">
|
||
<p class="step-description">Set limits on simulation outputs</p>
|
||
<div id="constraintsConfig" class="constraints-config">
|
||
<p class="empty">No constraints defined yet</p>
|
||
</div>
|
||
<button class="btn btn-secondary" onclick="addConstraint()">+ Add Constraint</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Step 5: Optimization Settings -->
|
||
<div class="config-step">
|
||
<h3>5. Optimization Settings</h3>
|
||
<div class="step-content">
|
||
<div class="form-group">
|
||
<label>Number of Trials</label>
|
||
<input type="number" id="nTrials" value="50" min="1">
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Sampler</label>
|
||
<select id="samplerType">
|
||
<option value="TPE" selected>TPE (Tree-structured Parzen Estimator)</option>
|
||
<option value="CMAES">CMA-ES</option>
|
||
<option value="GP">Gaussian Process</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Startup Trials (random exploration)</label>
|
||
<input type="number" id="startupTrials" value="20" min="0">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Study Details View -->
|
||
<div id="studyDetails" class="study-details" style="display: none;">
|
||
<div class="study-header">
|
||
<div>
|
||
<h2 id="studyTitle">Study Name</h2>
|
||
<p id="studyMeta" class="study-meta"></p>
|
||
</div>
|
||
<div class="study-actions">
|
||
<button class="btn btn-primary" onclick="resumeCurrentStudy()">
|
||
▶️ Resume Study
|
||
</button>
|
||
<button class="btn btn-danger" onclick="deleteCurrentStudy()">
|
||
🗑️ Delete
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Best Result Card -->
|
||
<div class="results-cards">
|
||
<div class="result-card">
|
||
<h3>Best Result</h3>
|
||
<div class="result-value" id="bestObjective">-</div>
|
||
<p class="result-label">Objective Value</p>
|
||
</div>
|
||
<div class="result-card">
|
||
<h3>Total Trials</h3>
|
||
<div class="result-value" id="totalTrials">-</div>
|
||
<p class="result-label">Completed</p>
|
||
</div>
|
||
<div class="result-card">
|
||
<h3>Best Parameters</h3>
|
||
<div id="bestParams" class="params-list"></div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Charts -->
|
||
<div class="charts-container">
|
||
<div class="chart-card">
|
||
<h3>Optimization Progress</h3>
|
||
<canvas id="progressChart"></canvas>
|
||
</div>
|
||
<div class="chart-card">
|
||
<h3>Design Variables</h3>
|
||
<canvas id="designVarsChart"></canvas>
|
||
</div>
|
||
<div class="chart-card">
|
||
<h3>Constraints</h3>
|
||
<canvas id="constraintsChart"></canvas>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- History Table -->
|
||
<div class="history-section">
|
||
<h3>Trial History</h3>
|
||
<div class="table-container">
|
||
<table id="historyTable">
|
||
<thead>
|
||
<tr>
|
||
<th>Trial</th>
|
||
<th>Objective</th>
|
||
<th>Design Variables</th>
|
||
<th>Constraints</th>
|
||
<th>Timestamp</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody></tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</main>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- New Optimization Modal -->
|
||
<div id="newOptimizationModal" class="modal" style="display: none;">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h2>Start New Optimization</h2>
|
||
<button class="close-btn" onclick="closeNewOptimizationModal()">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="form-group">
|
||
<label>Study Name</label>
|
||
<input type="text" id="newStudyName" placeholder="my_optimization_study" />
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Number of Trials</label>
|
||
<input type="number" id="newTrials" value="50" min="1" />
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Configuration File</label>
|
||
<select id="newConfigPath">
|
||
<option value="examples/bracket/optimization_config_stress_displacement.json">
|
||
Bracket - Stress Minimization
|
||
</option>
|
||
<option value="examples/bracket/optimization_config.json">
|
||
Bracket - Multi-objective
|
||
</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group">
|
||
<label>
|
||
<input type="checkbox" id="resumeExisting" />
|
||
Resume existing study (if exists)
|
||
</label>
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-secondary" onclick="closeNewOptimizationModal()">
|
||
Cancel
|
||
</button>
|
||
<button class="btn btn-primary" onclick="startOptimization()">
|
||
Start Optimization
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Create Study Modal -->
|
||
<div id="createStudyModal" class="modal" style="display: none;">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<h2>Create New Study</h2>
|
||
<button class="close-btn" onclick="closeCreateStudyModal()">×</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div class="form-group">
|
||
<label>Study Name</label>
|
||
<input type="text" id="createStudyName" placeholder="my_optimization_study" />
|
||
</div>
|
||
<div class="form-group">
|
||
<label>Description (optional)</label>
|
||
<input type="text" id="createStudyDescription" placeholder="Brief description of this study" />
|
||
</div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-secondary" onclick="closeCreateStudyModal()">Cancel</button>
|
||
<button class="btn btn-primary" onclick="createNewStudy()">Create Study</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script src="app.js"></script>
|
||
<script src="study_config.js"></script>
|
||
</body>
|
||
</html>
|