From de808ab07663cf15b3a9267d701f46ec208e2e34 Mon Sep 17 00:00:00 2001 From: dzmitry-lahoda Date: Tue, 26 Mar 2024 21:51:05 +0000 Subject: [PATCH] comment out constraints --- Cargo.lock | 36 ------------- flake.nix | 2 +- mantis/node/Cargo.toml | 1 - mantis/node/src/solver/router.rs | 86 ++++++++++++++++---------------- 4 files changed, 44 insertions(+), 81 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb16ff7d..a37a67c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -493,25 +493,6 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" -[[package]] -name = "coin_cbc" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d602045cd2e7ad02608a71492af94357f493a6f3c934ce854c03bf10fddc5780" -dependencies = [ - "coin_cbc_sys", - "lazy_static", -] - -[[package]] -name = "coin_cbc_sys" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "085619f8bdc38e24e25c6336ecc3f2e6c0543d67566dff6daef0e32f7ac20f76" -dependencies = [ - "pkg-config", -] - [[package]] name = "colorchoice" version = "1.0.0" @@ -1474,16 +1455,6 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" -[[package]] -name = "good_lp" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa124423ded10046a849fa0ae9747c541895557f1af177e0890b09879e7e9e7d" -dependencies = [ - "coin_cbc", - "fnv", -] - [[package]] name = "group" version = "0.13.0" @@ -2290,7 +2261,6 @@ dependencies = [ "derive_more", "env_logger", "fraction", - "good_lp", "itertools 0.12.0", "log", "ndarray", @@ -2662,12 +2632,6 @@ dependencies = [ "spki", ] -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - [[package]] name = "powerfmt" version = "0.2.0" diff --git a/flake.nix b/flake.nix index 56b2631a..f2e3e245 100644 --- a/flake.nix +++ b/flake.nix @@ -152,7 +152,7 @@ NIX_BUILD_FLAKE = "true"; RUST_BACKTRACE = "full"; CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_DEBUG = true; - RUSTFLAGS="$RUSTFLAGS -A warnings"; + RUSTFLAGS="-A warnings"; buildInputs = [pkgs.protobuf]; }; cw-cvm-outpost = makeCosmwasmContract "cw-cvm-outpost" rust "--no-default-features --features=std,json-schema,cosmos"; diff --git a/mantis/node/Cargo.toml b/mantis/node/Cargo.toml index e6eaa68f..1504c6c7 100644 --- a/mantis/node/Cargo.toml +++ b/mantis/node/Cargo.toml @@ -41,7 +41,6 @@ tonic = { workspace = true } tuples = { workspace = true } cvm-runtime = { workspace = true, features = ["std"] } ndarray ={ workspace = true, features = ["std", "serde"]} -good_lp = {workspace = true, features = ["coin_cbc", "singlethread-cbc"]} fraction = {workspace = true, features = ["default"]} env_logger = {workspace = true} diff --git a/mantis/node/src/solver/router.rs b/mantis/node/src/solver/router.rs index 717c07f5..ba329c28 100644 --- a/mantis/node/src/solver/router.rs +++ b/mantis/node/src/solver/router.rs @@ -7,7 +7,7 @@ use std::{ }; use cosmrs::tendermint::chain; -use good_lp::*; +// use good_lp::*; use itertools::*; use ndarray::*; use prelude::*; @@ -41,53 +41,53 @@ pub fn populate_chain_dict(chains: &mut HashMap>, center_nod } } -pub fn solve( - all_tokens: Vec, - all_cffms: Vec<(String, String)>, - reserves: ndarray::Array1, - cfmm_tx_cost: Vec, - fees: Vec, - ibc_pools: u16, - origin_token: String, - number_of_init_tokens: f64, - obj_token: String, - force_eta: Vec, -) { - let count_tokens = all_tokens.len(); - let count_cffms = all_cffms.len(); - let mut current_assets = ndarray::Array1::::from_elem(count_tokens, <_>::default()); +// pub fn solve( +// all_tokens: Vec, +// all_cffms: Vec<(String, String)>, +// reserves: ndarray::Array1, +// cfmm_tx_cost: Vec, +// fees: Vec, +// ibc_pools: u16, +// origin_token: String, +// number_of_init_tokens: f64, +// obj_token: String, +// force_eta: Vec, +// ) { +// let count_tokens = all_tokens.len(); +// let count_cffms = all_cffms.len(); +// let mut current_assets = ndarray::Array1::::from_elem(count_tokens, <_>::default()); - fn find_index(vec: &[T], target: &T) -> usize { - vec.iter().position(|x| x == target).unwrap() - } - current_assets[find_index(&all_tokens, &origin_token)] = number_of_init_tokens; +// fn find_index(vec: &[T], target: &T) -> usize { +// vec.iter().position(|x| x == target).unwrap() +// } +// current_assets[find_index(&all_tokens, &origin_token)] = number_of_init_tokens; - let mut problem = ProblemVariables::new(); - let mut main_expression = Expression::default(); - let mut constraints: Vec = vec![]; +// let mut problem = ProblemVariables::new(); +// let mut main_expression = Expression::default(); +// let mut constraints: Vec = vec![]; - // Build variables +// // Build variables - let mut variables = variables!(); +// let mut variables = variables!(); - let mut A: Vec>> = vec![]; +// let mut A: Vec>> = vec![]; - for cfmm in all_cffms.iter() { - let n_i = 2; - let mut A_i = vec![vec![0.0, 0.0]; count_tokens]; - A_i[find_index(&all_tokens, &cfmm.0)][0] = 1.0; - A_i[find_index(&all_tokens, &cfmm.1)][1] = 1.0; - A.push(A_i); - } +// for cfmm in all_cffms.iter() { +// let n_i = 2; +// let mut A_i = vec![vec![0.0, 0.0]; count_tokens]; +// A_i[find_index(&all_tokens, &cfmm.0)][0] = 1.0; +// A_i[find_index(&all_tokens, &cfmm.1)][1] = 1.0; +// A.push(A_i); +// } - let mut deltas: Vec> = vec![]; - let mut lambdas: Vec> = vec![]; - // Binary value, indicates tx or not for given pool - let mut eta: Vec = vec![]; +// let mut deltas: Vec> = vec![]; +// let mut lambdas: Vec> = vec![]; +// // Binary value, indicates tx or not for given pool +// let mut eta: Vec = vec![]; - for _ in all_cffms { - deltas.push(vec![variable(), variable()]); - lambdas.push(vec![variable(), variable()]); - eta.push(variable()); - } -} +// for _ in all_cffms { +// deltas.push(vec![variable(), variable()]); +// lambdas.push(vec![variable(), variable()]); +// eta.push(variable()); +// } +// }