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

ParametricInstance #146

Merged
merged 34 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
9227896
ParametricInstance and sub messages
termoshtt Nov 18, 2024
38b8dc5
Rename `values` to `entries` in `Parameters` to match `State` message
termoshtt Nov 19, 2024
421086d
Regenerate Rust and Python bindings
termoshtt Nov 19, 2024
540012f
Split parameter.proto
termoshtt Nov 19, 2024
356595f
Move Parameters to instance.proto
termoshtt Nov 19, 2024
e3e64cc
Re-merge
termoshtt Nov 19, 2024
c361829
Add parameters to the Instance message
termoshtt Nov 19, 2024
411ed7c
Remove outdated
termoshtt Nov 19, 2024
4cc29ab
Moc for ParametricInstance::create_instance
termoshtt Nov 19, 2024
e093d1b
Add doc_rust task
termoshtt Nov 20, 2024
3555160
impl From<Instance> for ParametricInstance
termoshtt Nov 20, 2024
1da9f31
Merge branch 'main' into parametric-instance
termoshtt Nov 20, 2024
bdbfbe6
Partial evaluate
termoshtt Nov 20, 2024
d8e8cde
WIP: partial_evaluate for Quadratic (without test)
termoshtt Nov 20, 2024
02f9faf
Add convert::state submod
termoshtt Nov 20, 2024
2ef3cfa
Use parametric Arbitrary for Function, Linear, Polynomial, and Quadratic
termoshtt Nov 20, 2024
cd542d8
clippy fix
termoshtt Nov 20, 2024
12ed71e
arbitrary_coefficient
termoshtt Nov 20, 2024
4585936
Add zero check in Polynomial addition
termoshtt Nov 20, 2024
7a59be9
Do not compare used variables in tests
termoshtt Nov 20, 2024
d34cab8
More tests for evaluate
termoshtt Nov 20, 2024
ec52bb5
Merge branch 'main' into parametric-instance
termoshtt Nov 21, 2024
fb8ad08
ParametricInstance::with_parameters
termoshtt Nov 21, 2024
db034a0
Merge branch 'main' into parametric-instance
termoshtt Nov 21, 2024
1ab13e3
Merge branch 'main' into parametric-instance
termoshtt Nov 22, 2024
108fd72
Fill parameters in Instance
termoshtt Nov 22, 2024
3733279
Limit size of generated subscripts and parameters in Arbitrary impl o…
termoshtt Nov 22, 2024
ee4b30d
Test for ParametricInstance
termoshtt Nov 22, 2024
a96dfaa
Manually implemented Arbitrary for Description
termoshtt Nov 22, 2024
afd6658
Fix test
termoshtt Nov 22, 2024
b5c7aa9
Test for parametric_instance conversion
termoshtt Nov 25, 2024
91a1bc3
Merge branch 'main' into parametric-instance
termoshtt Nov 25, 2024
93a8d31
clippy fix
termoshtt Nov 25, 2024
db95a54
Revise method names
termoshtt Nov 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ maplit = "1.0.2"
num = "0.4.3"
ocipkg = "0.3.9"
proptest = "1.5.0"
proptest-derive = "0.5.0"
prost = "0.12.6"
prost-build = "0.12.6"
pyo3 = { version = "0.21.2", features = ["anyhow"] }
Expand Down
9 changes: 9 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
version: "3"

tasks:
# Documents
doc_rust:
cmds:
- cargo doc --no-deps -p ommx

doc_rust_open:
cmds:
- cargo doc --no-deps --open -p ommx

# Protocol Buffers
protogen:
cmds:
Expand Down
8 changes: 8 additions & 0 deletions proto/ommx/v1/instance.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import "ommx/v1/constraint.proto";
import "ommx/v1/decision_variables.proto";
import "ommx/v1/function.proto";

// A set of parameters for instantiating an optimization problem from a parametric instance
message Parameters {
map<uint64, double> entries = 1;
}

message Instance {
message Description {
optional string name = 1;
Expand Down Expand Up @@ -45,4 +50,7 @@ message Instance {
// - This is a required field. Most mathematical modeling tools allow for an empty sense and default to minimization. Alternatively, some tools do not create such a field and represent maximization problems by negating the objective function. This project prefers explicit descriptions over implicit ones to avoid such ambiguity and to make it unnecessary for developers to look up the reference for the treatment of omitted cases.
//
Sense sense = 5;

// Parameters used when instantiating this instance
optional Parameters parameters = 6;
}
52 changes: 52 additions & 0 deletions proto/ommx/v1/parametric_instance.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
syntax = "proto3";

package ommx.v1;

import "ommx/v1/constraint.proto";
import "ommx/v1/decision_variables.proto";
import "ommx/v1/function.proto";
import "ommx/v1/instance.proto";

// Placeholder of a parameter in a parametrized optimization problem
message Parameter {
// ID for the parameter
//
// - IDs are not required to be sequential.
// - The ID must be unique within the instance including the decision variables.
uint64 id = 1;

// Name of the parameter. e.g. `x`
optional string name = 2;

// Subscripts of the parameter, same usage as DecisionVariable.subscripts
repeated int64 subscripts = 3;

// Additional metadata for the parameter, same usage as DecisionVariable.parameters
map<string, string> parameters = 4;

// Human-readable description for the parameter
optional string description = 5;
}

// Optimization problem including parameter, variables varying while solving the problem like penalty weights or dual variables.
// These parameters are not decision variables.
message ParametricInstance {
Instance.Description description = 1;

// Decision variables used in this instance
repeated DecisionVariable decision_variables = 2;

// Parameters of this instance
//
// - The ID must be unique within the instance including the decision variables.
repeated Parameter parameters = 3;

// Objective function of the optimization problem. This may contain parameters in addition to the decision variables.
Function objective = 4;

// Constraints of the optimization problem. This may contain parameters in addition to the decision variables.
repeated Constraint constraints = 5;

// The sense of this problem, i.e. minimize the objective or maximize it.
Instance.Sense sense = 6;
}
20 changes: 13 additions & 7 deletions python/ommx/ommx/v1/instance_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 61 additions & 1 deletion python/ommx/ommx/v1/instance_pb2.pyi

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions python/ommx/ommx/v1/parametric_instance_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading