Adding a bit more documentation + clarifying some interfaces#2
Adding a bit more documentation + clarifying some interfaces#2kwesiRutledge merged 20 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2 +/- ##
==========================================
- Coverage 41.89% 40.79% -1.11%
==========================================
Files 15 17 +2
Lines 1518 1564 +46
==========================================
+ Hits 636 638 +2
- Misses 830 874 +44
Partials 52 52 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR updates the simplex library to align with a new version of the MatProInterface.go dependency (v0.6.0) and introduces a new dedicated SimplexSolution type to replace the generic problem.Solution type.
- Introduces a new SimplexSolution struct with clearer field naming (
VariableValuesinstead ofValues) - Updates all algorithm interfaces and implementations to use the new solution type
- Updates dependency versions in go.mod to latest versions
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| solution/simplex_solution.go | Defines new SimplexSolution struct with VariableValues, Objective, and Status fields |
| simplexSolver/solver.go | Updates Solve method to return SimplexSolution instead of problem.Solution |
| go.mod | Updates MatProInterface.go to v0.6.0 and SymbolicMath.go to v0.2.5 |
| examples/sergiy_butenko1/the_simplex_method_part_ii.go | Updates field access from Values to VariableValues |
| examples/gonum_bug1/try_bug.go | New example file demonstrating simplex solver usage |
| algorithms/tableau/termination/termination_types.go | Updates imports and return type for solution status |
| algorithms/tableau/tableau_algo.go | Updates Solve method signature and solution construction |
| algorithms/tableau/state.go | Updates solution creation and field naming |
| algorithms/stanford/stanford.go | Updates solution construction to use new SimplexSolution type |
| algorithms/algorithm_interface.go | Updates interface to return SimplexSolution |
| README.md | Adds installation instructions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| for ii, bv := range state.BasicVariables { | ||
| solution.Values[bv.ID] = xBasic.AtVec(ii) | ||
| solution.VariableValues[bv.ID] = xBasic.AtVec(ii) | ||
| } | ||
|
|
||
| // Set the values of the non-basic variables | ||
| for jj, nv := range state.GetNonBasicVariables() { | ||
| solution.Values[nv.ID] = state.NonBasicValues.AtVec(jj) | ||
| solution.VariableValues[nv.ID] = state.NonBasicValues.AtVec(jj) | ||
| } |
There was a problem hiding this comment.
The VariableValues map is not initialized before use. This will cause a panic when trying to assign values to a nil map.
There was a problem hiding this comment.
We will likely delete this soon.
algorithms/tableau/state.go
Outdated
|
|
||
| // Assemble Solution Output | ||
| return problem.Solution{ | ||
| Values: map[uint64]float64{}, | ||
| Objective: -1.0, | ||
| Status: currentStatus, | ||
| return simplex_solution.SimplexSolution{ | ||
| VariableValues: map[uint64]float64{}, | ||
| Objective: -1.0, |
There was a problem hiding this comment.
The hardcoded objective value of -1.0 appears to be a placeholder. This should either be calculated properly or documented as a placeholder value.
There was a problem hiding this comment.
This value was removed from the solution object.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ex into kr/feature/gonum-bug1
…ing variable selection, it looks like we've come up with a better solution
Summary
simplex_solution, which implements a solution object that will be returned by all simplex solvers.