protocol
linear_programming_protocol
Protocol for immutable linear-program construction, solving, and result inspection.
logtalk_load(linear_programming(loader))staticPublic predicates
new_problem/1
Creates an empty linear-program problem.
staticnew_problem(Problem)new_problem(-compound) - onevariable/4
Adds a variable with default bounds. Continuous and integer variables default to zero and positive infinity; binary variables default to zero and one. The variable type is continuous, integer, or binary.
staticvariable(Name,Type,Problem0,Problem)variable(+term,+atom,+compound,-compound) - one_or_errorinstantiation_errorProblem0 is not a linear-program problem:type_error(linear_program,Problem0)Type is not a supported variable type:domain_error(linear_programming_variable_type,Type)Name is already declared:domain_error(linear_programming_variable,Name)variable/6
Adds a variable with explicit lower and upper bounds. A bound is a number, inf, or -inf as appropriate.
staticvariable(Name,Type,Lower,Upper,Problem0,Problem)variable(+term,+atom,+term,+term,+compound,-compound) - one_or_errorinstantiation_errorProblem0 is not a linear-program problem:type_error(linear_program,Problem0)Type is not a supported variable type:domain_error(linear_programming_variable_type,Type)Name is already declared:domain_error(linear_programming_variable,Name)domain_error(linear_programming_bounds,Lower-Upper)constraint/5
Adds a linear constraint. Coefficients is a list of Coefficient*Variable terms and Sense is =<, >=, or =.
staticconstraint(Coefficients,Sense,RightHandSide,Problem0,Problem)constraint(+list(compound),+atom,+number,+compound,-compound) - one_or_errorinstantiation_errorProblem0 is not a linear-program problem:type_error(linear_program,Problem0)Coefficients is not a list of coefficient-variable terms:type_error(linear_expression,Coefficients)Sense is not a supported constraint sense:domain_error(linear_programming_constraint_sense,Sense)domain_error(linear_programming_variable,Variable)constraints/3
Adds a list of constraint(Coefficients, Sense, RightHandSide) terms.
staticconstraints(Constraints,Problem0,Problem)constraints(+list(compound),+compound,-compound) - one_or_errorinstantiation_errorConstraints is not a list of valid constraint terms:type_error(linear_programming_constraints,Constraints)Problem0 is not a linear-program problem:type_error(linear_program,Problem0)objective/4
Sets the linear objective. Coefficients is a list of Coefficient*Variable terms and Sense is minimize or maximize.
staticobjective(Coefficients,Sense,Problem0,Problem)objective(+list(compound),+atom,+compound,-compound) - one_or_errorinstantiation_errorProblem0 is not a linear-program problem:type_error(linear_program,Problem0)Coefficients is not a list of coefficient-variable terms:type_error(linear_expression,Coefficients)Sense is not a supported objective sense:domain_error(linear_programming_objective_sense,Sense)domain_error(linear_programming_objective,Problem0)domain_error(linear_programming_variable,Variable)problem_from_matrices/8
Creates a problem from a dense objective vector, objective sense, equality rows and right-hand sides, less-than-or-equal rows and right-hand sides, and variable bounds. Variables are named by their one-based column indices.
staticproblem_from_matrices(Objective,ObjectiveSense,EqualityMatrix,EqualityRightHandSide,InequalityMatrix,InequalityRightHandSide,Bounds,Problem)problem_from_matrices(+list(number),+atom,+list(list(number)),+list(number),+list(list(number)),+list(number),+list(pair),-compound) - one_or_errorinstantiation_errordomain_error(linear_programming_dimensions,Objective)type_error(linear_programming_matrix_problem,Objective)solve/2
Solves a linear-program problem using default options and returns a result term. Solver statuses include optimal, infeasible, unbounded, iteration_limit, node_limit, and numerical_error as applicable to the backend.
staticsolve(Problem,Result)solve(+compound,-compound) - one_or_errorProblem is a variable:instantiation_errorProblem is not a linear-program problem:type_error(linear_program,Problem)Problem has no variables:domain_error(linear_programming_problem,empty)Problem has no objective:domain_error(linear_programming_problem,missing_objective)Problem contains a variable type unsupported by the backend:domain_error(simplex_variable_type,Variable-Type)domain_error(milp_finite_integer_bounds,Variable-(Lower-Upper))domain_error(milp_integer_domain,Variable-(Lower-Upper))solve/3
Solves a linear-program problem using the specified options and returns a result term. Solver statuses include optimal, infeasible, unbounded, iteration_limit, node_limit, and numerical_error as applicable to the backend.
staticsolve(Problem,Result,Options)solve(+compound,-compound,+list(compound)) - one_or_errorProblem is a variable:instantiation_errorProblem is not a linear-program problem:type_error(linear_program,Problem)Problem has no variables:domain_error(linear_programming_problem,empty)Problem has no objective:domain_error(linear_programming_problem,missing_objective)Problem contains a variable type unsupported by the backend:domain_error(simplex_variable_type,Variable-Type)domain_error(milp_finite_integer_bounds,Variable-(Lower-Upper))domain_error(milp_integer_domain,Variable-(Lower-Upper))Options is a variable:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is a variable:instantiation_errorOption of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)status/2
Returns the result status.
staticstatus(Result,Status)status(+compound,-atom) - one_or_errorResult is a variable:instantiation_errorResult is not a linear-programming result:type_error(linear_programming_result,Result)objective_value/2
Returns the optimal objective value. Fails when the result status is not optimal.
staticobjective_value(Result,Value)objective_value(+compound,-number) - zero_or_one_or_errorResult is a variable:instantiation_errorResult is not a linear-programming result:type_error(linear_programming_result,Result)variable_value/3
Returns an optimal variable value. Fails when the result status is not optimal or the variable is absent.
staticvariable_value(Result,Variable,Value)variable_value(+compound,+term,-number) - zero_or_one_or_errorResult is a variable:instantiation_errorResult is not a linear-programming result:type_error(linear_programming_result,Result)statistics/2
Returns solver statistics stored in a result.
staticstatistics(Result,Statistics)statistics(+compound,-list(compound)) - one_or_errorResult is a variable:instantiation_errorResult is not a linear-programming result:type_error(linear_programming_result,Result)print_problem/1
Prints a linear-program problem to the current output stream.
staticprint_problem(Problem)print_problem(+compound) - one_or_errorProblem is a variable:instantiation_errorProblem is not a linear-program problem:type_error(linear_program,Problem)print_solution/1
Prints a linear-program result to the current output stream.
staticprint_solution(Result)print_solution(+compound) - one_or_errorResult is a variable:instantiation_errorResult is not a linear-programming result:type_error(linear_programming_result,Result)Protected predicates
(none)
Private predicates
(none)
Operators
(none)