Commit 97de18ed authored by Theo Christiaanse's avatar Theo Christiaanse
Browse files

added the ability to set options.

parent e5ee7ea9
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -109,7 +109,8 @@ class EHubModel:
                                minimize=True,
                                solver=solver,
                                verbose=is_verbose,
                                solver_path=solver_path)
                                solver_path=solver_path,
                                options=options)
        except:
            status = pylp.solve(objective=self.objective,
                                constraints=self.constraints,
+7 −13
Original line number Diff line number Diff line
@@ -62,28 +62,22 @@ def solve(
        for constraint in constraints:
            problem += constraint.construct()

<<<<<<< HEAD
    if solver == "glpk":
        try:
            solver = pulp.solvers.GLPK(msg=verbose, options=kwargs['options'])
        except:
            print("glpk_path is not set, going to default.")
            # This catches the error if glpk_path is not set
            solver = pulp.solvers.GLPK(msg=verbose)
    elif solver == "glpk-cluster":
        try:
            solver = pulp.solvers.GLPK(msg=verbose, path=kwargs['solver_path'])
            solver = pulp.solvers.GLPK(msg=verbose, path=kwargs['solver_path'], options=kwargs['options'])
        except:
            print("glpk_path is not set, going to default.")
            # This catches the error if glpk_path is not set
            solver = pulp.solvers.GLPK(msg=verbose, path="/home/theochri/ENV/bin/glpsol")
    elif solver == "cplex":
        solver = pulp.solvers.CPLEX(msg=verbose)
=======
    if solver == 'glpk' and pulp.__version__ == '2.1':
        solver = glpk.GLPK_CMD(msg=verbose)
    elif solver == 'glpk' and pulp.__version__ != '2.1':
        solver = solvers.GLPK(msg=verbose)
    elif solver == 'cplex' and pulp.__version__ == '2.1':
        solver = cplex.CPLEX_CMD(msg=verbose)
    elif solver == 'cplex' and pulp.__version__ != '2.1':
        solver = solvers.CPLEX(msg=verbose)
>>>>>>> master
    else:
        raise ValueError(f"Unsupported solver: {solver}")