![]() |
naev 0.12.6
|
Handles Linear linoptization in Lua. More...
#include "nlua_linopt.h"#include "log.h"#include "nluadef.h"
Go to the source code of this file.
Data Structures | |
| struct | LuaLinOpt_t |
| Our cute little linear program wrapper. More... | |
Macros | |
| #define | LINOPT_MAX_TM 1000 |
| #define | METH_DEF GLP_PRIMAL |
| #define | PRICING_DEF GLP_PT_PSE |
| #define | R_TEST_DEF GLP_RT_HAR |
| #define | PRESOLVE_DEF GLP_OFF |
| #define | BR_TECH_DEF GLP_BR_DTH |
| #define | BT_TECH_DEF GLP_BT_BLB |
| #define | PP_TECH_DEF GLP_PP_ALL |
| #define | SR_HEUR_DEF GLP_ON |
| #define | FP_HEUR_DEF GLP_OFF |
| #define | PS_HEUR_DEF GLP_OFF |
| #define | GMI_CUTS_DEF GLP_OFF |
| #define | MIR_CUTS_DEF GLP_OFF |
| #define | COV_CUTS_DEF GLP_OFF |
| #define | CLQ_CUTS_DEF GLP_OFF |
| #define | STRCHK(val, ret) |
| #define | GETOPT_IOCP(name, func, def) |
| #define | GETOPT_SMCP(name, func, def) |
Functions | |
| static int | linoptL_gc (lua_State *L) |
| Frees a linopt. | |
| static int | linoptL_eq (lua_State *L) |
| Compares two linopts to see if they are the same. | |
| static int | linoptL_new (lua_State *L) |
| Opens a new linopt. | |
| static int | linoptL_size (lua_State *L) |
| Adds columns to the linear program. | |
| static int | linoptL_addcols (lua_State *L) |
| Adds columns to the linear program. | |
| static int | linoptL_addrows (lua_State *L) |
| Adds rows to the linear program. | |
| static int | linoptL_setcol (lua_State *L) |
| Adds an optimization column. | |
| static int | linoptL_setrow (lua_State *L) |
| Adds an optimization row. | |
| static int | linoptL_loadmatrix (lua_State *L) |
| Loads the entire matrix for the linear program. | |
| static int | linoptL_solve (lua_State *L) |
| Solves the linear optimization problem. | |
| static int | linoptL_readProblem (lua_State *L) |
| Reads an optimization problem from a file for debugging purposes. | |
| static int | linoptL_writeProblem (lua_State *L) |
| Writes an optimization problem to a file for debugging purposes. | |
| int | nlua_loadLinOpt (nlua_env env) |
| Loads the linopt library. | |
| LuaLinOpt_t * | lua_tolinopt (lua_State *L, int ind) |
| Lua bindings to interact with linopts. | |
| LuaLinOpt_t * | luaL_checklinopt (lua_State *L, int ind) |
| Gets linopt at index or raises error if there is no linopt at index. | |
| LuaLinOpt_t * | lua_pushlinopt (lua_State *L, LuaLinOpt_t linopt) |
| Pushes a linopt on the stack. | |
| int | lua_islinopt (lua_State *L, int ind) |
| Checks to see if ind is a linopt. | |
| static const char * | linopt_status (int retval) |
| static const char * | linopt_error (int retval) |
| static int | opt_meth (const char *str, int def) |
| static int | opt_pricing (const char *str, int def) |
| static int | opt_r_test (const char *str, int def) |
| static int | opt_br_tech (const char *str, int def) |
| static int | opt_bt_tech (const char *str, int def) |
| static int | opt_pp_tech (const char *str, int def) |
| static int | opt_onoff (const char *str, int def) |
Variables | |
| static const luaL_Reg | linoptL_methods [] |
Handles Linear linoptization in Lua.
Definition in file nlua_linopt.c.
| #define BR_TECH_DEF GLP_BR_DTH |
Definition at line 522 of file nlua_linopt.c.
| #define BT_TECH_DEF GLP_BT_BLB |
Definition at line 523 of file nlua_linopt.c.
| #define CLQ_CUTS_DEF GLP_OFF |
Definition at line 531 of file nlua_linopt.c.
| #define COV_CUTS_DEF GLP_OFF |
Definition at line 530 of file nlua_linopt.c.
| #define FP_HEUR_DEF GLP_OFF |
Definition at line 526 of file nlua_linopt.c.
| #define GETOPT_IOCP | ( | name, | |
| func, | |||
| def ) |
Definition at line 620 of file nlua_linopt.c.
| #define GETOPT_SMCP | ( | name, | |
| func, | |||
| def ) |
Definition at line 626 of file nlua_linopt.c.
| #define GMI_CUTS_DEF GLP_OFF |
Definition at line 528 of file nlua_linopt.c.
| #define LINOPT_MAX_TM 1000 |
Maximum time to optimize (in ms). Applied to linear relaxation \ and MIP independently.
Definition at line 25 of file nlua_linopt.c.
| #define METH_DEF GLP_PRIMAL |
Definition at line 517 of file nlua_linopt.c.
| #define MIR_CUTS_DEF GLP_OFF |
Definition at line 529 of file nlua_linopt.c.
| #define PP_TECH_DEF GLP_PP_ALL |
Definition at line 524 of file nlua_linopt.c.
| #define PRESOLVE_DEF GLP_OFF |
Definition at line 520 of file nlua_linopt.c.
| #define PRICING_DEF GLP_PT_PSE |
Definition at line 518 of file nlua_linopt.c.
| #define PS_HEUR_DEF GLP_OFF |
Definition at line 527 of file nlua_linopt.c.
| #define R_TEST_DEF GLP_RT_HAR |
Definition at line 519 of file nlua_linopt.c.
| #define SR_HEUR_DEF GLP_ON |
Definition at line 525 of file nlua_linopt.c.
| #define STRCHK | ( | val, | |
| ret ) |
Definition at line 545 of file nlua_linopt.c.
|
static |
Definition at line 445 of file nlua_linopt.c.
|
static |
Definition at line 426 of file nlua_linopt.c.
|
static |
Adds columns to the linear program.
Lua function parameter: LinOpt lp Linear program to modify. Lua function parameter: number cols Number of columns to add.
| L | Lua State |
Lua function: add_cols
Definition at line 244 of file nlua_linopt.c.
|
static |
Adds rows to the linear program.
Lua function parameter: LinOpt lp Linear program to modify. Lua function parameter: number rows Number of rows to add.
| L | Lua State |
Lua function: add_rows
Definition at line 260 of file nlua_linopt.c.
|
static |
Compares two linopts to see if they are the same.
Lua function parameter: Optim d1 Optim 1 to compare. Lua function parameter: Optim d2 Optim 2 to compare. Lua return parameter: boolean true if both linopts are the same.
| L | Lua State |
Lua function: __eq
Definition at line 171 of file nlua_linopt.c.
|
static |
Frees a linopt.
Lua function parameter: Optim linopt Optim to free.
| L | Lua State |
Lua function: __gc
Definition at line 156 of file nlua_linopt.c.
|
static |
Loads the entire matrix for the linear program.
Lua function parameter: LinOpt lp Linear program to modify. Lua function parameter: number row_indices Indices of the rows. Lua function parameter: number col_indices Indices of the columns. Lua function parameter: number coefficients Values of the coefficients.
| L | Lua State |
Lua function: load_matrix
Definition at line 379 of file nlua_linopt.c.
|
static |
Opens a new linopt.
Lua function parameter:[opt=nil] string name Name of the optimization program. Lua function parameter: number cols Number of columns in the optimization program. Lua function parameter: number rows Number of rows in the optimization program. Lua function parameter:[opt=false] boolean maximize Whether to maximize (rather than minimize) the function. Lua return parameter: Optim New linopt object.
| L | Lua State |
Lua function: new
Definition at line 191 of file nlua_linopt.c.
|
static |
Reads an optimization problem from a file for debugging purposes.
Lua function parameter: string fname Path to the file. Lua function parameter:[opt=false] boolean glpk_format Whether the program is in GLPK format instead of MPS format. Lua function parameter:[opt=false] boolean maximize Whether to maximize (rather than minimize) the function. Lua return parameter: LinOpt Linear program in the file.
| L | Lua State |
Lua function: read_problem
Definition at line 781 of file nlua_linopt.c.
|
static |
Adds an optimization column.
Lua function parameter: LinOpt lp Linear program to modify. Lua function parameter: number index Index of the column to set. Lua function parameter: string name Name of the column being added. Lua function parameter: number coefficient Coefficient of the objective function being added. Lua function parameter:[opt="real"] string kind Kind of the column being added. Can be either "real", "integer", or "binary". Lua function parameter:[opt=nil] number lb Lower bound of the column. Lua function parameter:[opt=nil] number ub Upper bound of the column.
| L | Lua State |
Lua function: set_col
Definition at line 283 of file nlua_linopt.c.
|
static |
Adds an optimization row.
Lua function parameter: LinOpt lp Linear program to modify. Lua function parameter: number index Index of the row to set. Lua function parameter: string name Name of the row being added. Lua function parameter:[opt=nil] number lb Lower bound of the row. Lua function parameter:[opt=nil] number ub Upper bound of the row.
| L | Lua State |
Lua function: set_row
Definition at line 338 of file nlua_linopt.c.
|
static |
Adds columns to the linear program.
Lua function parameter: LinOpt lp Linear program to modify. Lua return parameter: number Number of columns in the linear program. Lua return parameter: number Number of rows in the linear program.
| L | Lua State |
Lua function: size
Definition at line 229 of file nlua_linopt.c.
|
static |
Solves the linear optimization problem.
Lua function parameter: LinOpt lp Linear program to modify. Lua return parameter: number The value of the primal funcation. Lua return parameter: table Table of column values.
| L | Lua State |
Lua function: solve
Definition at line 640 of file nlua_linopt.c.
|
static |
Writes an optimization problem to a file for debugging purposes.
Lua function parameter: LinOpt lp Linear program to write. Lua function parameter: string fname Path to write the program to. Lua function parameter:[opt=false] boolean glpk_format Whether to write the program in GLPK format instead of MPS format.
| L | Lua State |
Lua function: write_problem
Definition at line 818 of file nlua_linopt.c.
| int lua_islinopt | ( | lua_State * | L, |
| int | ind ) |
Checks to see if ind is a linopt.
| L | Lua state to check. |
| ind | Index position to check. |
Definition at line 134 of file nlua_linopt.c.
| LuaLinOpt_t * lua_pushlinopt | ( | lua_State * | L, |
| LuaLinOpt_t | linopt ) |
Pushes a linopt on the stack.
| L | Lua state to push linopt into. |
| linopt | Optim to push. |
Definition at line 118 of file nlua_linopt.c.
| LuaLinOpt_t * lua_tolinopt | ( | lua_State * | L, |
| int | ind ) |
Lua bindings to interact with linopts.
Lua module: linopt
Gets linopt at index.
| L | Lua state to get linopt from. |
| ind | Index position to find the linopt. |
Definition at line 91 of file nlua_linopt.c.
| LuaLinOpt_t * luaL_checklinopt | ( | lua_State * | L, |
| int | ind ) |
Gets linopt at index or raises error if there is no linopt at index.
| L | Lua state to get linopt from. |
| ind | Index position to find linopt. |
Definition at line 103 of file nlua_linopt.c.
| int nlua_loadLinOpt | ( | nlua_env | env | ) |
Loads the linopt library.
| env | Environment to load linopt library into. |
Definition at line 73 of file nlua_linopt.c.
|
static |
Definition at line 576 of file nlua_linopt.c.
|
static |
Definition at line 588 of file nlua_linopt.c.
|
static |
Definition at line 548 of file nlua_linopt.c.
|
static |
Definition at line 609 of file nlua_linopt.c.
|
static |
Definition at line 599 of file nlua_linopt.c.
|
static |
Definition at line 558 of file nlua_linopt.c.
|
static |
Definition at line 567 of file nlua_linopt.c.
|
static |
Optim metatable methods.
Definition at line 52 of file nlua_linopt.c.