Skip to content

Commit

Permalink
fix: Only fail Ganak on Windows on runtime, not on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Elscrux committed Feb 3, 2025
1 parent f31aaee commit 2fd49de
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;

/**
* {@link SharpSatConfiguration#SHARPSAT} solver using OpenSource GANAK implementation.
*/
@Configuration
@Component
public class GanakSolver extends SharpSatSolver {
private final String binaryPath;
private final ApplicationContext context;
Expand All @@ -31,11 +31,6 @@ public GanakSolver(
@Value("${custom.binary.ganak-sat}") String binaryPath,
ApplicationContext context) {

if (binaryPath == null || binaryPath.isEmpty()) {
throw new IllegalArgumentException("Property 'custom.binary.ganak-sat' is not defined."
+ " This solver isn't available for windows. Use PythonBruteForce instead");
}

this.binaryPath = binaryPath;
this.context = context;
}
Expand Down Expand Up @@ -74,6 +69,11 @@ public String getDescription() {
public Mono<Solution<Integer>> solve(String input, SubRoutineResolver subRoutineResolver,
SolvingProperties properties) {

if (binaryPath == null || binaryPath.isEmpty()) {
throw new IllegalArgumentException("Property 'custom.binary.ganak-sat' is not defined."
+ " This solver isn't available for windows. Use PythonBruteForce instead");
}

var solution = new Solution<>(this);

DimacsCnf dimacsCnf;
Expand Down

0 comments on commit 2fd49de

Please sign in to comment.