-
Notifications
You must be signed in to change notification settings - Fork 20
feat/wasm emscripten target #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
403523e
b2c3b8e
5dd3ded
b32b215
7ba938f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "pumpkin-solver" | ||
version = "0.2.0" | ||
version = "0.1.4" | ||
description = "The Pumpkin combinatorial optimisation solver library." | ||
readme = "../README.md" | ||
authors.workspace = true | ||
|
@@ -15,10 +15,9 @@ bitfield = "0.14.0" | |
enumset = "1.1.2" | ||
fnv = "1.0.3" | ||
rand = { version = "0.8.5", features = [ "small_rng", "alloc" ] } | ||
signal-hook = "0.3.17" | ||
once_cell = "1.19.0" | ||
downcast-rs = "1.2.1" | ||
drcp-format = { version = "0.2.1", path = "../drcp-format" } | ||
drcp-format = { version = "0.2.0", path = "../drcp-format" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also here please |
||
convert_case = "0.6.0" | ||
itertools = "0.13.0" | ||
flatzinc = "0.3.21" | ||
|
@@ -28,6 +27,12 @@ bitfield-struct = "0.9.2" | |
num = "0.4.3" | ||
enum-map = "2.7.3" | ||
|
||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] | ||
signal-hook = "0.3.17" | ||
|
||
[target.'cfg(target_arch = "wasm32")'.dependencies] | ||
getrandom = { version = "0.2", features = ["js"] } | ||
|
||
[dev-dependencies] | ||
clap = { version = "4.5.17", features = ["derive"] } | ||
env_logger = "0.10.0" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,9 @@ use pumpkin_solver::results::SatisfactionResult; | |
use pumpkin_solver::results::SolutionReference; | ||
use pumpkin_solver::statistics::StatisticLogger; | ||
use pumpkin_solver::termination::Combinator; | ||
#[cfg(target_arch = "wasm32")] | ||
use pumpkin_solver::termination::Indefinite as OsSignalReplacement; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The naming here is a bit confusing; |
||
#[cfg(not(target_arch = "wasm32"))] | ||
use pumpkin_solver::termination::OsSignal; | ||
use pumpkin_solver::termination::TerminationCondition; | ||
use pumpkin_solver::termination::TimeBudget; | ||
|
@@ -83,10 +86,14 @@ pub(crate) fn solve( | |
) -> Result<(), FlatZincError> { | ||
let instance = File::open(instance)?; | ||
|
||
let mut termination = Combinator::new( | ||
OsSignal::install(), | ||
time_limit.map(TimeBudget::starting_now), | ||
); | ||
#[cfg(not(target_arch = "wasm32"))] | ||
let signal_condition = OsSignal::install(); | ||
|
||
#[cfg(target_arch = "wasm32")] | ||
let signal_condition = OsSignalReplacement; | ||
|
||
let mut termination = | ||
Combinator::new(signal_condition, time_limit.map(TimeBudget::starting_now)); | ||
|
||
let instance = parse_and_compile(&mut solver, instance, options)?; | ||
let outputs = instance.outputs.clone(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The versioning is incorrect when compared to the current main