Exception: LpSolver::SolverError

Inherits:
Error
  • Object
show all
Defined in:
lib/lpsolver/exception.rb

Overview

Raised when the HiGHS solver encounters an error.

This exception is raised when the HiGHS command-line tool exits with a non-zero status, indicating a problem with the model (e.g., syntax error, infeasibility not handled, etc.).

Examples:

begin
  model.solve
rescue LpSolver::SolverError => e
  puts "HiGHS error: #{e.message}"
  puts "Stderr: #{e.stderr}" if e.stderr
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, stderr: nil) ⇒ SolverError

Creates a new SolverError.

Parameters:

  • message (String)

    The error message.

  • stderr (String, nil) (defaults to: nil)

    The stderr output from HiGHS.



37
38
39
40
# File 'lib/lpsolver/exception.rb', line 37

def initialize(message, stderr: nil)
  @stderr = stderr
  super(message)
end

Instance Attribute Details

#stderrString? (readonly)

Returns The stderr output from the HiGHS solver.

Returns:

  • (String, nil)

    The stderr output from the HiGHS solver.



31
32
33
# File 'lib/lpsolver/exception.rb', line 31

def stderr
  @stderr
end