Skip to content
Filipe Brandão edited this page May 20, 2016 · 16 revisions

PyMPL Statements

There are three types of statements:

  1. ${python code}$
  • EVAL: ${python expression}$
  1. $CMD{python parameters or code};
  • EXEC: $EXEC{python code};
  • STMT: $STMT{python expression};
  1. $CMD[AMPL parameters]{python arguments or code};
  • SET: $SET[set_name]{values};
  • PARAM: $PARAM[param_name]{values, i0=0};
  • VAR: $VAR[var_name]{typ="", lb=None, ub=None, index_set=None};
  • CON: $CON[constraint_name]{left, sign, right};

Additional statements:

  1. Statements for VPSolver:
  • VBP_FLOW: $VBP_FLOW[zvar]{W, w, b, bounds=None, binary=False};
  • VBP_GRAPH: $VBP_GRAPH[V_name, A_name]{W, w, labels, bounds=None, binary=False, S="S", T="T", LOSS="LOSS"};
  • MVP_FLOW: $MVP_FLOW[zvars]{Ws, ws, b, bounds=None, binary=False, i0=0};
  • MVP_GRAPH: $MVP_GRAPH[V_name, A_name]{Ws, ws, labels, bounds=None, binary=False, S="S", Ts=None, LOSS="LOSS"};
  1. Statements for special ordered sets and piecewise linear functions:
  • SOS1: $SOS1{varl, ub=1};
  • SOS2: $SOS2{varl, ub=1};
  • PWL: $PWL[var_x, var_y]{xyvalues};
  1. Statements for TSP:
  • ATSP_MTZ: $ATSP_MTZ{xvars, DL=False, cuts=False};
  • ATSP_SCF: $ATSP_SCF{xvars, cuts=False};
  • ATSP_MCF: $ATSP_SCF{xvars, cuts=False};
  1. Statements for Lot-sizing (LS-LIB, implemented in collaboration with Laurence Wolsey):

Note: The values between [] are usually used to name new AMPL variables, constraints, sets, or parameters. Names starting with a ^ indicate that the corresponding AMPL element should not be defined by the command. This prefix is useful when the corresponding AMPL element has already been declared before and we do not want to declared it again.


Copyright © 2015-2016 Filipe Brandão < [email protected] >. All rights reserved.

Clone this wiki locally