Defining variables in JuMP

Hello,

I have a question about defining variables in JuMP, normally, the variables are defined as

@variable(model, testContinusVar)
@variable(model, testIntegerVar, Int)
@variable(model, testBinaryVar, Bin)

And what if I define variables as

testContinusVar = @variable(model, testContinusVar)
testIntegerVar = @variable(model, testIntegerVar, Int)
testBinaryVar = @variable(model, testBinaryVar, Bin)

Are the two defining ways the same? I’ve tested it in a small case, and it seems they are the same, while I’m not pretty sure from the bottom implementation method, so could anyone answer it?

These are exactly the same.

Is this part of the documentation clear?

Or could I improve it?

yep, it’s not so clear. Maybe it can be improved by adding:

  • (Special) Named JuMP variables have the form @variable(model, x), which exactly equals x = @variable(model, x)

though the above is not a difference between the name that a variable is registered under and the String name used for printing.

How’s this?

It looks better, thank you. @odow