UnDefVarError - Model not defined in Julia optimization problem

  1. using ExcelReaders, JuMP, CPLEX, DataFrames;
  2. using JuMP, Clp;
  3. MinCD = JuMP.Model(solver=CPLEX.CplexSolver(CPX_PARAM_TILIM = 3600)); “UnDefVarError Model not defined”

I did read most of the fixes for Model not defined, I have used all those solutions yet I am facing this error in the third line of my code. Line one and two passes without any error. All my packages required are updated.
Please help me resolve this error.
Thank You.

Could you please post the complete error output? You can follow the instructions here: PSA: how to quote code with backticks to quote your code so that it will render properly as well.

I restarted Julia, opened the file again and executed and it worked fine. Thank You.

I have a new error when I define my decision variables. The error message is “UndefVarError @variable not defined”
’ ’ 'Julia
using ExcelReaders, JuMP, CPLEX, DataFrames;

#PARAMETERS and Incides
I = 5
J = 5
K = 5
S = 5

A = ones(I,J,K,S)

#A = [[1 0 1 0 1];[0 0 1 1 0];[1 1 1 1 0];[0 1 0 0 0];[0 1 0 0 1]] #Binary Job assigned to RDSx
PrescriptionDemand= [7;10;12] #Number of prescription processed per each RDSx
M = 1000 #Very large number
R = 15
P = 30
#V = 30
T = 300
Demand= [5;6;7;10;12]
p = 10
F = 5500

MinCD= JuMP.Model(solver=CPLEX.CplexSolver(CPX_PARAM_TILIM = 3600));

#DECISION VARIABLES:
@variable(MinCD,X[1:I,1:J,1:K,1:S],Bin) "UndefVarError @Variable not defined"

Blockquote Please advice. Thank You.

Three things.

  1. You’re using JuMP 0.18 (and maybe Julia 0.6?). You should upgrade to JuMP 0.19 and Julia 1.1.

  2. Close everything and restart Julia and Atom/Juno. Something is weird, but I have no idea what.

  3. To quote code, you need to use backpacks ``` rather than apostrophes ‘’’

1 Like