Skip to content

Commit

Permalink
Added model getters/setters
Browse files Browse the repository at this point in the history
  • Loading branch information
IainNZ committed Jun 30, 2013
1 parent 8cbcf59 commit fc74bdd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/MathProg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ type Model
solverOptions
end


# Default constructor
function Model(sense::Symbol)
if (sense != :Max && sense != :Min)
Expand All @@ -85,6 +84,13 @@ function Model(sense::Symbol)
0,Float64[],nothing,Dict())
end

# Getters/setters
getNumVars(m::Model) = m.numCols
getNumConstraints(m::Model) = length(m.linconstr)
getObjectiveValue(m::Model) = m.objVal
getObjectiveSense(m::Model) = m.objSense
setObjectiveSense(m::Model, newSense:::Symbol) = (m.objSense = newSense)

This comment has been minimized.

Copy link
@mlubin

mlubin Jun 30, 2013

Member

Check that we match :Min or :Max here?


# Pretty print
function print(io::IO, m::Model)
println(io, string(m.objSense," ",quadToStr(m.obj)))
Expand Down

1 comment on commit fc74bdd

@IainNZ
Copy link
Collaborator Author

@IainNZ IainNZ commented on fc74bdd Jul 1, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I'll patch that

Please sign in to comment.