Naev

Module linopt

Lua bindings to interact with linopts.

Functions

__gc (linopt) Frees a linopt.
__eq (d1, d2) Compares two linopts to see if they are the same.
new ([name=nil], cols, rows[, maximize=false]) Opens a new linopt.
size (lp) Adds columns to the linear program.
add_cols (lp, cols) Adds columns to the linear program.
add_rows (lp, rows) Adds rows to the linear program.
set_col (lp, index, name, coefficient[, kind="real"[, lb=nil[, ub=nil]]]) Adds an optimization column.
set_row (lp, index, name[, lb=nil[, ub=nil]]) Adds an optimization row.
load_matrix (lp, row_indices, col_indices, coefficients) Loads the entire matrix for the linear program.
solve (lp) Solves the linear optimization problem.
read_problem (fname[, glpk_format=false[, maximize=false]]) Reads an optimization problem from a file for debugging purposes.
write_problem (lp, fname[, glpk_format=false]) Writes an optimization problem to a file for debugging purposes.


Functions

__gc (linopt)
Frees a linopt.

Parameters:

  • linopt Optim Optim to free.
__eq (d1, d2)
Compares two linopts to see if they are the same.

Parameters:

  • d1 Optim Optim 1 to compare.
  • d2 Optim Optim 2 to compare.

Returns:

    boolean true if both linopts are the same.
new ([name=nil], cols, rows[, maximize=false])
Opens a new linopt.

Parameters:

  • name string Name of the optimization program. (default nil)
  • cols number Number of columns in the optimization program.
  • rows number Number of rows in the optimization program.
  • maximize boolean Whether to maximize (rather than minimize) the function. (default false)

Returns:

    Optim New linopt object.
size (lp)
Adds columns to the linear program.

Parameters:

  • lp LinOpt Linear program to modify.

Returns:

  1. number Number of columns in the linear program.
  2. number Number of rows in the linear program.
add_cols (lp, cols)
Adds columns to the linear program.

Parameters:

  • lp LinOpt Linear program to modify.
  • cols number Number of columns to add.
add_rows (lp, rows)
Adds rows to the linear program.

Parameters:

  • lp LinOpt Linear program to modify.
  • rows number Number of rows to add.
set_col (lp, index, name, coefficient[, kind="real"[, lb=nil[, ub=nil]]])
Adds an optimization column.

Parameters:

  • lp LinOpt Linear program to modify.
  • index number Index of the column to set.
  • name string Name of the column being added.
  • coefficient number Coefficient of the objective function being added.
  • kind string Kind of the column being added. Can be either "real", "integer", or "binary". (default "real")
  • lb number Lower bound of the column. (default nil)
  • ub number Upper bound of the column. (default nil)
set_row (lp, index, name[, lb=nil[, ub=nil]])
Adds an optimization row.

Parameters:

  • lp LinOpt Linear program to modify.
  • index number Index of the row to set.
  • name string Name of the row being added.
  • lb number Lower bound of the row. (default nil)
  • ub number Upper bound of the row. (default nil)
load_matrix (lp, row_indices, col_indices, coefficients)
Loads the entire matrix for the linear program.

Parameters:

  • lp LinOpt Linear program to modify.
  • row_indices number Indices of the rows.
  • col_indices number Indices of the columns.
  • coefficients number Values of the coefficients.
solve (lp)
Solves the linear optimization problem.

Parameters:

  • lp LinOpt Linear program to modify.

Returns:

  1. number The value of the primal funcation.
  2. table Table of column values.
read_problem (fname[, glpk_format=false[, maximize=false]])
Reads an optimization problem from a file for debugging purposes.

Parameters:

  • fname string Path to the file.
  • glpk_format boolean Whether the program is in GLPK format instead of MPS format. (default false)
  • maximize boolean Whether to maximize (rather than minimize) the function. (default false)

Returns:

    LinOpt Linear program in the file.
write_problem (lp, fname[, glpk_format=false])
Writes an optimization problem to a file for debugging purposes.

Parameters:

  • lp LinOpt Linear program to write.
  • fname string Path to write the program to.
  • glpk_format boolean Whether to write the program in GLPK format instead of MPS format. (default false)
generated by LDoc 1.5.0 Last updated 2024-04-26 14:59:58