Skip to content

exponential function is doubled as a function of infinite parameters #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
julia-sand opened this issue Feb 20, 2025 · 2 comments
Open
Labels
bug Something isn't working

Comments

@julia-sand
Copy link

Hi I have a problem issue with using the exponential function within infiniteopt models.

Describe the bug
an exponential function with infinite parameters in the infinite model causes the exponential function to be doubled in the output.

To Reproduce

using InfiniteOpt

#Setup the model
#create a new model object
model = InfiniteModel();

#add any infinite parameter
@infinite_parameter(model, q in [-5, 5], num_supports = 11)

#try any function with an exponential
print(exp(-(q-1)^4))

output then has the exponential doubled

exp(-exp((q - 1)^4)

Desktop (please complete the following information):

  • OS linux
  • InfiniteOpt v0.5.9
  • Julia Version: both in 1.11.3 and 1.10.4
@julia-sand julia-sand added the bug Something isn't working label Feb 20, 2025
@odow
Copy link
Contributor

odow commented Feb 20, 2025

It looks like this is just a bug in the printing. The actual numeric values are correct.

julia> using InfiniteOpt, Ipopt

julia> model = InfiniteModel(Ipopt.Optimizer);

julia> @infinite_parameter(model, q in [0, 1]);

julia> optimize!(model)

julia> y = exp(-q^3)
exp(-exp(q^3)

julia> value(y)
10-element Vector{Float64}:
 1.0
 0.9986291982956845
 0.9890860570884186
 0.9636404443013933
 0.9159518371704141
 0.8424274240215702
 0.7435670792055757
 0.6246851322548268
 0.49542863511370566
 0.36787944117144233

julia> exp.(-value(q).^3)
10-element Vector{Float64}:
 1.0
 0.9986291982956845
 0.9890860570884186
 0.9636404443013933
 0.9159518371704141
 0.8424274240215702
 0.7435670792055757
 0.6246851322548268
 0.49542863511370566
 0.36787944117144233

julia> exp.(-exp.(value(q).^3))
10-element Vector{Float64}:
 0.36787944117144233
 0.36737480560798674
 0.36384243664781807
 0.354257420122658
 0.3356251183824255
 0.3051212999827777
 0.2605739509203343
 0.2017337606088849
 0.13286068497591894
 0.06598803584531254

@pulsipher
Copy link
Collaborator

Yep, this is just a printing bug in InfiniteOpt's legacy NL interface. The developmental version no longer has this problem. My schedule has been busy, but I hope to finish the next release soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants