Skip to content
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

pull request for Sat backend #415

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
136d488
basic framework
Shikhar-Srivastava-16 Nov 4, 2024
b44b2fb
added basic functions
Shikhar-Srivastava-16 Nov 5, 2024
5e03ea5
refactored into separate module
Shikhar-Srivastava-16 Nov 5, 2024
fd58cbf
basic functions for populating SatInstance
Shikhar-Srivastava-16 Nov 5, 2024
1d02783
removed kissat lib, not in use
Shikhar-Srivastava-16 Nov 5, 2024
a764a25
changes to Cargo.toml
Shikhar-Srivastava-16 Nov 5, 2024
ac6b5c4
changes to building cargo.lock, auto-gen
Shikhar-Srivastava-16 Nov 5, 2024
0c662cc
added solver_instance with trait for solver and updated library script
Shikhar-Srivastava-16 Nov 6, 2024
ae9bc3b
removed unused file
Shikhar-Srivastava-16 Nov 6, 2024
5f39b3b
basic structure for solver adaptor, may not function well
Shikhar-Srivastava-16 Nov 6, 2024
faada12
more basics, see before
Shikhar-Srivastava-16 Nov 6, 2024
42beb47
push for adaptor
Nov 12, 2024
1e34041
Updated the lib.rs and added solver_utils to it
Nov 13, 2024
261dd47
Updated main.rs to display the solver result
Nov 13, 2024
5fcd6b6
Updated main.rs to display the solver result
Nov 13, 2024
5194683
Updated all sat_rs files by implementing a solver and mapping
Nov 13, 2024
9c6397f
minor change to main.rs, temp
Nov 13, 2024
d949cdf
Merge branch 'main' of https://github.com/Shikhar-Srivastava-16/conju…
Nov 13, 2024
e29dcaf
debugging
Nov 13, 2024
ea2ce69
changes
Nov 23, 2024
615c76f
final functions for model generation (must integrate into load)
Nov 26, 2024
80e780f
removed kissat.rs file, made relevant changes to other files
Nov 26, 2024
6659fdd
function in `SolverAdaptor` trait called, partial implementation for …
Nov 27, 2024
b139de3
housekeeping
Nov 30, 2024
d806a7e
Implemented the solver and edited the coversion functions as well
Nov 30, 2024
f62e008
Making changes
Nov 30, 2024
b01b714
housekeeping
Nov 30, 2024
b222638
adaptor changes
Dec 1, 2024
55d0458
Fixed bugs and implemeneted a solver
Dec 1, 2024
c2b2d32
rename + auxiliary file deleted
Shikhar-Srivastava-16 Dec 16, 2024
731921b
rename, unneeded main deleted
Shikhar-Srivastava-16 Dec 19, 2024
25162e2
rename WIP
Shikhar-Srivastava-16 Dec 19, 2024
c9ca602
tests added
Shikhar-Srivastava-16 Dec 19, 2024
f20119f
Cleaned up some code and removed coments from files I have worked on
Dec 19, 2024
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
347 changes: 206 additions & 141 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ resolver = "2"
default-members = [
"conjure_oxide",
"crates/conjure_core",
"solvers/kissat",
"solvers/sat_rs",
"solvers/minion",
]

Expand All @@ -13,8 +13,8 @@ members = [
"crates/conjure_core",
"crates/enum_compatability_macro",
"crates/conjure_macros",
"solvers/kissat",
"solvers/minion",
"solvers/minion",
"solvers/sat_rs",
]

[workspace.lints.clippy]
Expand Down
2 changes: 2 additions & 0 deletions conjure_oxide/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ schemars = "0.8.21"
toml = "0.8.19"
glob = "0.3.1"
rand = "0.8.5"
rustsat = "0.6.1"
rustsat-minisat = "0.4.1"

[features]

Expand Down
3 changes: 3 additions & 0 deletions crates/conjure_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ schemars = "0.8.21"
clap = { version = "4.5.20", features = ["derive"] }
itertools = "0.13.0"
im = "15.1.0"
sat_rs = { version = "0.1.0", path = "../../solvers/sat_rs" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we decided to remove the sat_rs crate, is it still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still being used for some of the model loading step, so retaining it.

rustsat-minisat = "0.4.0"
rustsat = "0.6.1"

[lints]
workspace = true
45 changes: 45 additions & 0 deletions crates/conjure_core/src/solver/adaptors/common.rs.txt
Shikhar-Srivastava-16 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
use crate::solver::SolverFamily;

use rustsat::instances::SatInstance;

use sat_rs::{sat_solvers::SatSolverInst, sat_tree};

// use rustsat_minisat:

trait SolverAdaptor {
fn prep_dat();

fn get_soln();

fn print_soln() -> ();
}

impl SolverAdaptor for SatSolverInst<SolverType: > {
fn prep_dat(vec_problem: &Vec<Vec<i16>>, inst_in_use: &mut SatInstance) -> () {
// todo!()
sat_tree::conv_to_formula(&vec_problem, &mut self.inst);
}

fn get_soln() -> Result<bool, String>{
// todo!()
self.solver.solve()
}

fn print_soln() {
// todo!()
match problem.solve() {
Ok(true) => {
println!("SATISFIABLE");
println!("a = {}", problem.get_assignment(a).unwrap());
println!("b = {}", problem.get_assignment(b).unwrap());
}
Ok(false) => println!("UNSATISFIABLE"),
Err(e) => println!("Error during solving: {:?}", e),
}
}


}

struct MinionAdaptor {
}
63 changes: 0 additions & 63 deletions crates/conjure_core/src/solver/adaptors/kissat.rs

This file was deleted.

12 changes: 7 additions & 5 deletions crates/conjure_core/src/solver/adaptors/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
//! Solver adaptors.

#[doc(inline)]
pub use kissat::Kissat;
// #[doc(inline)]
// pub use kissat::Kissat;
#[doc(inline)]
pub use minion::Minion;
pub use sat_adaptor::SAT;
// mod sat_common;

mod sat_common;

mod kissat;
// mod kissat;
mod minion;
pub mod sat_adaptor; //temp visibility
// mod common;
Loading