Prerequisites
Ensure the rosepy library is installed and your environment variables are configured.
Using default parameters
To submit the .mps or .lp file using all of the default settings, this will get you going.
from rosepy.solver import Solver
solver = Solver()
solve = solver.solve_file('model.mps')
print(solve.solve_id) # OptionalIf you want the solve ID afterwards, you can refer to solve.solve_id and to get the location where you can find the results and solve information through your web browser, you can call solve.web_console_solve_url.
Including custom parameters
If you don't want to use the default parameter values when solving your models, you can pass in custom values using the RoseSolveConfig object.
The example below shows how to override all the configurable parameters with non-default values. If you leave out any of these, the default value will be used for that parameter. You can also omit the entire RoseSolveConfig object to use all default settings.
Optionally, you may also include the problem_target_filename if you want the model name to appear as something different in web interface than the original name of the file. Just be sure to keep the same model extension (either .mps or .lp) as the original file.
from rosepy.solver import Solver
from rosepy.solver import RoseSolveConfig
options = RoseSolveConfig(
max_time_seconds=300,
mip_gap_percentage=0.01,
mip_gap_absolute=1e-10,
presolve='on',
node_count=1,
tol_primal_feasibility=5e-7,
tol_dual_feasibility=6e-10,
tol_integer=.444,
cut_strategy='off',
heuristic_strategy='minimal',
scaling='l2'
)
solver = Solver()
result = solver.solve_file(filename='random_lp_2.mps',
config=options,
problem_target_filename='new_filename2.mps')
print(result.solve_id) # Optional
Comments
0 comments
Please sign in to leave a comment.