MethodError: no method matching parseNLExpr_runtime
I have an error for the following code in Julia for solving NLP problem.
using JuMP
using Ipopt
using DataFrames,ConditionalJuMP
m = Model(solver=IpoptSolver())
#importing data
xi=[-1.016713795 0.804447648 0.932137661 1.064136698 -0.963217531
-1.048396778 1.076371484 1.099027177 1.061556926 -0.95185481
-0.980261302 0.271253807 0.184946729 1.062838197 -0.958794505
-0.980703191 0.278820569 0.231132677 1.062967459 -0.959302488
-0.953074503 -0.00768112 0.128808175 1.067743779 -0.978524489
-1.014866259 0.815325963 1.065956208 1.067059122 -0.974682291
-0.995088119 0.550359991 0.845087207 1.066556784 -0.973154887]
xj=xi
pii=[-300
-259.6530828
-284.3708955
-291.3387625
-342.4479859
-356.5031603
-351.0154738]
sample_size=7
bus_num=5
tempsum=0
#define variables
@variable(m,aij[1:2*bus_num,1:2*bus_num]) # define matrix by
2bus_num*2bus_num
for n=1:sample_size
for i=1:bus_num
for j=1:bus_num
tempsum=(aij[i,j]*xi[n,i]*xj[n,j]-pii[n,2])^2+tempsum
end
end
end
#define constraints
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,j]==aij[j,i])
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,j]*aij[i,j]<=aij
[i,i]*aij[j,j])
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,i]*aij[j,j]<=0.25*
(aij[i,i]+aij[j,j])*(aij[i,i]+aij[j,j]))
#define NLP objective function
@NLobjective(m, Min, tempsum)
solve(m)
println("m = ",getobjectivevalue(m))
println("Aij = ", getvalue(aij))
but after operation, an error was shown as below.
MethodError: no method matching parseNLExpr_runtime(::JuMP.Model,
::JuMP.GenericQuadExprFloat64,JuMP.Variable,
::ArrayReverseDiffSparse.NodeData,1, ::Int64, ::ArrayFloat64,1)
The error occurs on @NLobjective(m, Min, tempsum)
, but I dont know how to modify the code. May you please anyone help me ?
Besides, I am also confused by how to add positive definite contraints here for the solution Matrix aij, as I want to get a positive definite matrix aij.
matrix nlp sum julia
add a comment |
I have an error for the following code in Julia for solving NLP problem.
using JuMP
using Ipopt
using DataFrames,ConditionalJuMP
m = Model(solver=IpoptSolver())
#importing data
xi=[-1.016713795 0.804447648 0.932137661 1.064136698 -0.963217531
-1.048396778 1.076371484 1.099027177 1.061556926 -0.95185481
-0.980261302 0.271253807 0.184946729 1.062838197 -0.958794505
-0.980703191 0.278820569 0.231132677 1.062967459 -0.959302488
-0.953074503 -0.00768112 0.128808175 1.067743779 -0.978524489
-1.014866259 0.815325963 1.065956208 1.067059122 -0.974682291
-0.995088119 0.550359991 0.845087207 1.066556784 -0.973154887]
xj=xi
pii=[-300
-259.6530828
-284.3708955
-291.3387625
-342.4479859
-356.5031603
-351.0154738]
sample_size=7
bus_num=5
tempsum=0
#define variables
@variable(m,aij[1:2*bus_num,1:2*bus_num]) # define matrix by
2bus_num*2bus_num
for n=1:sample_size
for i=1:bus_num
for j=1:bus_num
tempsum=(aij[i,j]*xi[n,i]*xj[n,j]-pii[n,2])^2+tempsum
end
end
end
#define constraints
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,j]==aij[j,i])
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,j]*aij[i,j]<=aij
[i,i]*aij[j,j])
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,i]*aij[j,j]<=0.25*
(aij[i,i]+aij[j,j])*(aij[i,i]+aij[j,j]))
#define NLP objective function
@NLobjective(m, Min, tempsum)
solve(m)
println("m = ",getobjectivevalue(m))
println("Aij = ", getvalue(aij))
but after operation, an error was shown as below.
MethodError: no method matching parseNLExpr_runtime(::JuMP.Model,
::JuMP.GenericQuadExprFloat64,JuMP.Variable,
::ArrayReverseDiffSparse.NodeData,1, ::Int64, ::ArrayFloat64,1)
The error occurs on @NLobjective(m, Min, tempsum)
, but I dont know how to modify the code. May you please anyone help me ?
Besides, I am also confused by how to add positive definite contraints here for the solution Matrix aij, as I want to get a positive definite matrix aij.
matrix nlp sum julia
Hi Ryan. In questions it's best to use simple data rather than CSV files, since no-one has access to those. Is the problem still there if you replace all these with a few simple numbers? (This is the MWE approach.) Then people can copy/paste your code. The error suggests that one of the arguments isn't the right form; at a guess, it'stempsum
... Also, perhaps list the version numbers of the packages and software you're using...
– daycaster
Nov 12 '18 at 10:49
@daycaster: Hi, thanks for your suggestion. I just posted a part of data. actually I want to upload my data file, but I found there is no item here.
– Ryan
Nov 12 '18 at 14:03
No problem, but bear in mind that the more tasks the prospective answerers have to do, the fewer of them will be prepared to do them all. :)
– daycaster
Nov 12 '18 at 14:11
@daycaster:I see, but appreciate your advice!
– Ryan
Nov 12 '18 at 14:22
add a comment |
I have an error for the following code in Julia for solving NLP problem.
using JuMP
using Ipopt
using DataFrames,ConditionalJuMP
m = Model(solver=IpoptSolver())
#importing data
xi=[-1.016713795 0.804447648 0.932137661 1.064136698 -0.963217531
-1.048396778 1.076371484 1.099027177 1.061556926 -0.95185481
-0.980261302 0.271253807 0.184946729 1.062838197 -0.958794505
-0.980703191 0.278820569 0.231132677 1.062967459 -0.959302488
-0.953074503 -0.00768112 0.128808175 1.067743779 -0.978524489
-1.014866259 0.815325963 1.065956208 1.067059122 -0.974682291
-0.995088119 0.550359991 0.845087207 1.066556784 -0.973154887]
xj=xi
pii=[-300
-259.6530828
-284.3708955
-291.3387625
-342.4479859
-356.5031603
-351.0154738]
sample_size=7
bus_num=5
tempsum=0
#define variables
@variable(m,aij[1:2*bus_num,1:2*bus_num]) # define matrix by
2bus_num*2bus_num
for n=1:sample_size
for i=1:bus_num
for j=1:bus_num
tempsum=(aij[i,j]*xi[n,i]*xj[n,j]-pii[n,2])^2+tempsum
end
end
end
#define constraints
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,j]==aij[j,i])
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,j]*aij[i,j]<=aij
[i,i]*aij[j,j])
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,i]*aij[j,j]<=0.25*
(aij[i,i]+aij[j,j])*(aij[i,i]+aij[j,j]))
#define NLP objective function
@NLobjective(m, Min, tempsum)
solve(m)
println("m = ",getobjectivevalue(m))
println("Aij = ", getvalue(aij))
but after operation, an error was shown as below.
MethodError: no method matching parseNLExpr_runtime(::JuMP.Model,
::JuMP.GenericQuadExprFloat64,JuMP.Variable,
::ArrayReverseDiffSparse.NodeData,1, ::Int64, ::ArrayFloat64,1)
The error occurs on @NLobjective(m, Min, tempsum)
, but I dont know how to modify the code. May you please anyone help me ?
Besides, I am also confused by how to add positive definite contraints here for the solution Matrix aij, as I want to get a positive definite matrix aij.
matrix nlp sum julia
I have an error for the following code in Julia for solving NLP problem.
using JuMP
using Ipopt
using DataFrames,ConditionalJuMP
m = Model(solver=IpoptSolver())
#importing data
xi=[-1.016713795 0.804447648 0.932137661 1.064136698 -0.963217531
-1.048396778 1.076371484 1.099027177 1.061556926 -0.95185481
-0.980261302 0.271253807 0.184946729 1.062838197 -0.958794505
-0.980703191 0.278820569 0.231132677 1.062967459 -0.959302488
-0.953074503 -0.00768112 0.128808175 1.067743779 -0.978524489
-1.014866259 0.815325963 1.065956208 1.067059122 -0.974682291
-0.995088119 0.550359991 0.845087207 1.066556784 -0.973154887]
xj=xi
pii=[-300
-259.6530828
-284.3708955
-291.3387625
-342.4479859
-356.5031603
-351.0154738]
sample_size=7
bus_num=5
tempsum=0
#define variables
@variable(m,aij[1:2*bus_num,1:2*bus_num]) # define matrix by
2bus_num*2bus_num
for n=1:sample_size
for i=1:bus_num
for j=1:bus_num
tempsum=(aij[i,j]*xi[n,i]*xj[n,j]-pii[n,2])^2+tempsum
end
end
end
#define constraints
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,j]==aij[j,i])
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,j]*aij[i,j]<=aij
[i,i]*aij[j,j])
@constraint(m, [i=1:2*bus_num,j=2*bus_num],aij[i,i]*aij[j,j]<=0.25*
(aij[i,i]+aij[j,j])*(aij[i,i]+aij[j,j]))
#define NLP objective function
@NLobjective(m, Min, tempsum)
solve(m)
println("m = ",getobjectivevalue(m))
println("Aij = ", getvalue(aij))
but after operation, an error was shown as below.
MethodError: no method matching parseNLExpr_runtime(::JuMP.Model,
::JuMP.GenericQuadExprFloat64,JuMP.Variable,
::ArrayReverseDiffSparse.NodeData,1, ::Int64, ::ArrayFloat64,1)
The error occurs on @NLobjective(m, Min, tempsum)
, but I dont know how to modify the code. May you please anyone help me ?
Besides, I am also confused by how to add positive definite contraints here for the solution Matrix aij, as I want to get a positive definite matrix aij.
matrix nlp sum julia
matrix nlp sum julia
edited Nov 12 '18 at 13:57
Ryan
asked Nov 12 '18 at 3:48
RyanRyan
93
93
Hi Ryan. In questions it's best to use simple data rather than CSV files, since no-one has access to those. Is the problem still there if you replace all these with a few simple numbers? (This is the MWE approach.) Then people can copy/paste your code. The error suggests that one of the arguments isn't the right form; at a guess, it'stempsum
... Also, perhaps list the version numbers of the packages and software you're using...
– daycaster
Nov 12 '18 at 10:49
@daycaster: Hi, thanks for your suggestion. I just posted a part of data. actually I want to upload my data file, but I found there is no item here.
– Ryan
Nov 12 '18 at 14:03
No problem, but bear in mind that the more tasks the prospective answerers have to do, the fewer of them will be prepared to do them all. :)
– daycaster
Nov 12 '18 at 14:11
@daycaster:I see, but appreciate your advice!
– Ryan
Nov 12 '18 at 14:22
add a comment |
Hi Ryan. In questions it's best to use simple data rather than CSV files, since no-one has access to those. Is the problem still there if you replace all these with a few simple numbers? (This is the MWE approach.) Then people can copy/paste your code. The error suggests that one of the arguments isn't the right form; at a guess, it'stempsum
... Also, perhaps list the version numbers of the packages and software you're using...
– daycaster
Nov 12 '18 at 10:49
@daycaster: Hi, thanks for your suggestion. I just posted a part of data. actually I want to upload my data file, but I found there is no item here.
– Ryan
Nov 12 '18 at 14:03
No problem, but bear in mind that the more tasks the prospective answerers have to do, the fewer of them will be prepared to do them all. :)
– daycaster
Nov 12 '18 at 14:11
@daycaster:I see, but appreciate your advice!
– Ryan
Nov 12 '18 at 14:22
Hi Ryan. In questions it's best to use simple data rather than CSV files, since no-one has access to those. Is the problem still there if you replace all these with a few simple numbers? (This is the MWE approach.) Then people can copy/paste your code. The error suggests that one of the arguments isn't the right form; at a guess, it's
tempsum
... Also, perhaps list the version numbers of the packages and software you're using...– daycaster
Nov 12 '18 at 10:49
Hi Ryan. In questions it's best to use simple data rather than CSV files, since no-one has access to those. Is the problem still there if you replace all these with a few simple numbers? (This is the MWE approach.) Then people can copy/paste your code. The error suggests that one of the arguments isn't the right form; at a guess, it's
tempsum
... Also, perhaps list the version numbers of the packages and software you're using...– daycaster
Nov 12 '18 at 10:49
@daycaster: Hi, thanks for your suggestion. I just posted a part of data. actually I want to upload my data file, but I found there is no item here.
– Ryan
Nov 12 '18 at 14:03
@daycaster: Hi, thanks for your suggestion. I just posted a part of data. actually I want to upload my data file, but I found there is no item here.
– Ryan
Nov 12 '18 at 14:03
No problem, but bear in mind that the more tasks the prospective answerers have to do, the fewer of them will be prepared to do them all. :)
– daycaster
Nov 12 '18 at 14:11
No problem, but bear in mind that the more tasks the prospective answerers have to do, the fewer of them will be prepared to do them all. :)
– daycaster
Nov 12 '18 at 14:11
@daycaster:I see, but appreciate your advice!
– Ryan
Nov 12 '18 at 14:22
@daycaster:I see, but appreciate your advice!
– Ryan
Nov 12 '18 at 14:22
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255715%2fmethoderror-no-method-matching-parsenlexpr-runtime%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255715%2fmethoderror-no-method-matching-parsenlexpr-runtime%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Hi Ryan. In questions it's best to use simple data rather than CSV files, since no-one has access to those. Is the problem still there if you replace all these with a few simple numbers? (This is the MWE approach.) Then people can copy/paste your code. The error suggests that one of the arguments isn't the right form; at a guess, it's
tempsum
... Also, perhaps list the version numbers of the packages and software you're using...– daycaster
Nov 12 '18 at 10:49
@daycaster: Hi, thanks for your suggestion. I just posted a part of data. actually I want to upload my data file, but I found there is no item here.
– Ryan
Nov 12 '18 at 14:03
No problem, but bear in mind that the more tasks the prospective answerers have to do, the fewer of them will be prepared to do them all. :)
– daycaster
Nov 12 '18 at 14:11
@daycaster:I see, but appreciate your advice!
– Ryan
Nov 12 '18 at 14:22