JuMP Model Syntax

Do we need to write expression with jump macros only ? like @variable, @constraint, @Objective
Or we can write it as plain text like model = ax+by^2

If yes, can we write in combination

Example : model = Model(Optimizer) (Optimizer :: MOI.OptimizerWithAttributes)
@expression(model, eObj, 0)
also ,
model= ax+by^2

I do believe the options are:

  1. Use the JuMP macros.
  2. You can directly construct the objects @expression will return to you (using, for example, Expressions · JuMP).
  3. You can write the model in some common format (to a file or a string) and then read the model from it (see: Overview · JuMP).

I am not entirely sure what you mean by writing in plain text. In your example, a, x, b, and y are what? They were already defined before this point?

1 Like