Skip to content
Filipe Brandão edited this page Aug 27, 2015 · 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_LOAD: $VBP_LOAD[name]{fname, i0=0, d0=0};
  • VBP_FLOW: $VBP_FLOW[zvar]{W, w, b, bounds=None};
  • VBP_GRAPH: $VBP_GRAPH[V_name, A_name]{W, w, labels, bounds=None};
  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):

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 was declared before and we do not want to declared it again.


Copyright © Filipe Brandão. All rights reserved.
E-mail: [email protected]. [Homepage]

Clone this wiki locally