-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
401 additions
and
97 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,79 @@ | ||
// Prevents additional console window on Windows in release, DO NOT REMOVE!! | ||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | ||
|
||
use std::hash::{DefaultHasher, Hash, Hasher}; | ||
use std::sync::OnceLock; | ||
use std::thread::ThreadId; | ||
use rism::constants::{Points}; | ||
use rism::io::{import_seminars, import_students}; | ||
use rism::rism_classic::run; | ||
use rism::rism_model_checking::run_model_check; | ||
use serde_json::to_string; | ||
use tauri::{ Manager, Window}; | ||
|
||
const VERSION: &str = env!("CARGO_PKG_VERSION"); | ||
static WINDOW: OnceLock<Window> = OnceLock::new(); | ||
|
||
|
||
#[tauri::command] | ||
fn get_version() -> String { | ||
return String::from(VERSION); | ||
return String::from(VERSION); | ||
} | ||
|
||
#[tauri::command] | ||
fn uses_system_z3() -> bool { | ||
#[cfg(feature = "bundle_z3")] | ||
return false; | ||
#[cfg(feature = "bundle_z3")] | ||
return false; | ||
|
||
#[cfg(not(feature = "bundle_z3"))] | ||
return true; | ||
} | ||
|
||
#[tauri::command] | ||
async fn run_normal(votes: String, seminars: String, iterations: u32, threads: u16) -> String { | ||
let seminars = import_seminars(&*seminars); | ||
let students = import_students(&*votes, &seminars); | ||
|
||
let best_iteration = run(&students, &seminars, iterations, Points::default(), threads, send_progress); | ||
println!("Done"); | ||
to_string(&best_iteration).unwrap() | ||
} | ||
|
||
#[tauri::command] | ||
async fn run_model_checking(votes: String, seminars: String) -> String { | ||
let seminars = import_seminars(&*seminars); | ||
let students = import_students(&*votes, &seminars); | ||
|
||
#[cfg(not(feature = "bundle_z3"))] | ||
return true; | ||
let best_iteration = run_model_check(&students, &seminars, Points::default()); | ||
println!("Done"); | ||
to_string(&best_iteration).unwrap() | ||
} | ||
|
||
#[derive(Clone, serde::Serialize)] | ||
struct ProgressPayload { | ||
thread_id: u64, | ||
progress: u32, | ||
total: u32, | ||
} | ||
|
||
fn send_progress(t_id: ThreadId, p: u32, t: u32) { | ||
if p % 10000 == 0 { | ||
let mut hasher = DefaultHasher::new(); | ||
t_id.hash(&mut hasher); | ||
WINDOW.get().expect("window is available").emit("progress", ProgressPayload { thread_id: hasher.finish(), progress: p, total: t }).expect("Send message"); | ||
} | ||
} | ||
|
||
fn main() { | ||
tauri::Builder::default() | ||
.invoke_handler(tauri::generate_handler![get_version,uses_system_z3]) | ||
.run(tauri::generate_context!()) | ||
.expect("error while running tauri application"); | ||
tauri::Builder::default() | ||
.setup(|app| { | ||
let window = app.get_window("main").unwrap(); | ||
|
||
_ = WINDOW.set(window); | ||
Ok(()) | ||
}) | ||
.invoke_handler(tauri::generate_handler![get_version,uses_system_z3,run_normal,run_model_checking]) | ||
.run(tauri::generate_context!()) | ||
.expect("error while running tauri application"); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,38 @@ | ||
import { createRouter, createWebHistory } from 'vue-router' | ||
import {createRouter, createWebHistory} from 'vue-router' | ||
import HomeView from '../views/HomeView.vue' | ||
|
||
const router = createRouter({ | ||
history: createWebHistory(import.meta.env.BASE_URL), | ||
routes: [ | ||
{ | ||
path: '/', | ||
name: 'home', | ||
component: HomeView | ||
}, | ||
{ | ||
path: '/about', | ||
name: 'about', | ||
// route level code-splitting | ||
// this generates a separate chunk (About.[hash].js) for this route | ||
// which is lazy-loaded when the route is visited. | ||
component: () => import('../views/AboutView.vue') | ||
} | ||
] | ||
history: createWebHistory(import.meta.env.BASE_URL), | ||
routes: [ | ||
{ | ||
path: '/', | ||
name: 'home', | ||
component: HomeView | ||
}, | ||
{ | ||
path: '/results', | ||
name: 'results', | ||
component: () => import('../views/Results.vue') | ||
}, | ||
{ | ||
path: '/run/normal', | ||
name: 'run-normal', | ||
component: () => import('../views/NormalRun.vue') | ||
}, | ||
{ | ||
path: '/run/model-checking', | ||
name: 'run-model-checking', | ||
component: () => import('../views/ModelCheckingRun.vue') | ||
}, | ||
{ | ||
path: '/about', | ||
name: 'about', | ||
// route level code-splitting | ||
// this generates a separate chunk (About.[hash].js) for this route | ||
// which is lazy-loaded when the route is visited. | ||
component: () => import('../views/AboutView.vue') | ||
} | ||
] | ||
}) | ||
|
||
export default router |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {defineStore} from "pinia"; | ||
import {type Ref, ref} from "vue"; | ||
|
||
export const useDataStore = defineStore('data', () => { | ||
const votes = ref(''); | ||
const seminars = ref(''); | ||
const modelChecking = ref(false); | ||
const iterations = ref(1000000); | ||
const threads = ref(4); | ||
|
||
const result: Ref<Result | null> = ref(null); | ||
|
||
return {votes, seminars, modelChecking, iterations, threads, result} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Defines a seminar, whether it's a wish or an assigned seminar | ||
interface Seminar { | ||
name: string; | ||
capacity: number; | ||
id: number; | ||
seminar_type: 'Scientific' | 'Practical'; | ||
} | ||
|
||
// Defines the structure for a student, including their wishes for scientific and practical seminars | ||
interface Student { | ||
id: number; | ||
name: string; | ||
w_wishes: Seminar[]; // Wishes for scientific seminars | ||
p_wishes?: Seminar[]; // Wishes for practical seminars (optional as your JSON sample has a student missing this field) | ||
} | ||
|
||
// Represents an assignment of a student to seminars, including points for the assignment | ||
interface Assignment { | ||
student: Student; | ||
w_seminar?: Seminar; // Assigned scientific seminar | ||
p_seminar?: Seminar; // Assigned practical seminar | ||
points: number; | ||
} | ||
|
||
// The root structure of your JSON data | ||
interface Result { | ||
points: number; | ||
assignments: Assignment[]; | ||
} |
Oops, something went wrong.