Skip to content
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

Default measure evaluation methods #19

Merged
merged 12 commits into from
Dec 17, 2019
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"

[compat]
julia = "1"
Expand Down
4 changes: 2 additions & 2 deletions docs/src/guide/objective.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ julia> objective_function(model)
0.5 x[1] + 0.5 x[2] + expect(y(ξ)² - y(ξ))

julia> objective_function_type(model)
GenericQuadExpr{Float64,MeasureFiniteVariableRef}
GenericAffExpr{Float64,MeasureFiniteVariableRef}
```
The objective sense can be one of three possibilities: `MIN_SENSE`, `MAX_SENSE`,
or `FEASIBILITY_SENSE`. The later sense applies to models that contain no
Expand Down Expand Up @@ -94,7 +94,7 @@ macro. The objective function is specified via [`set_objective_function`](@ref J
simply updates the expression stored in the objective. For example, let's update
out objective to simply be ``0.5x_1 + 0.5x_2``:
```jldoctest obj
julia> set_objective_function(model, 0.5 x[1] + 0.5 x[2])
julia> set_objective_function(model, 0.5x[1] + 0.5x[2])

julia> objective_function(model)
0.5 x[1] + 0.5 x[2]
Expand Down
9 changes: 8 additions & 1 deletion src/InfiniteOpt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ include("utilities.jl")
include("TranscriptionOpt/TranscriptionOpt.jl")
using .TranscriptionOpt

include("MeasureEvalMethods/MeasureEvalMethods.jl")
using .MeasureEvalMethods

# Export model object datatype
export InfiniteModel

Expand Down Expand Up @@ -79,7 +82,11 @@ Measure, MeasureRef

# Export measure methods
export add_measure, measure, measure_function, measure_data, expand,
expand_all_measures!
expand_all_measures!, expect, support_sum

# Export measure evaluation functions
export generate_measure_data, MC_sampling, Gauss_Legendre, Gauss_Hermite,
Gauss_Laguerre, infinite_transform, support_formatting, measure_dispatch

# Export transcription datatypes
export TranscriptionData, TranscriptionModel
Expand Down
16 changes: 16 additions & 0 deletions src/MeasureEvalMethods/MeasureEvalMethods.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module MeasureEvalMethods

# Import the necessary packages.
import FastGaussQuadrature
import JuMP
import Distributions
const JuMPC = JuMP.Containers
using ..InfiniteOpt

# include jl files here
include("methods.jl")
# Export functions here
export generate_measure_data, MC_sampling, Gauss_Legendre, Gauss_Hermite,
Gauss_Laguerre, infinite_transform, support_formatting, measure_dispatch

end # end module
Loading