Skip to content

Commit

Permalink
comment out constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Mar 26, 2024
1 parent b241962 commit de808ab
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 81 deletions.
36 changes: 0 additions & 36 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 0 additions & 1 deletion mantis/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
86 changes: 43 additions & 43 deletions mantis/node/src/solver/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
};

use cosmrs::tendermint::chain;
use good_lp::*;
// use good_lp::*;
use itertools::*;
use ndarray::*;
use prelude::*;
Expand Down Expand Up @@ -41,53 +41,53 @@ pub fn populate_chain_dict(chains: &mut HashMap<String, Vec<String>>, center_nod
}
}

pub fn solve(
all_tokens: Vec<String>,
all_cffms: Vec<(String, String)>,
reserves: ndarray::Array1<f64>,
cfmm_tx_cost: Vec<f64>,
fees: Vec<f64>,
ibc_pools: u16,
origin_token: String,
number_of_init_tokens: f64,
obj_token: String,
force_eta: Vec<f64>,
) {
let count_tokens = all_tokens.len();
let count_cffms = all_cffms.len();
let mut current_assets = ndarray::Array1::<f64>::from_elem(count_tokens, <_>::default());
// pub fn solve(
// all_tokens: Vec<String>,
// all_cffms: Vec<(String, String)>,
// reserves: ndarray::Array1<f64>,
// cfmm_tx_cost: Vec<f64>,
// fees: Vec<f64>,
// ibc_pools: u16,
// origin_token: String,
// number_of_init_tokens: f64,
// obj_token: String,
// force_eta: Vec<f64>,
// ) {
// let count_tokens = all_tokens.len();
// let count_cffms = all_cffms.len();
// let mut current_assets = ndarray::Array1::<f64>::from_elem(count_tokens, <_>::default());

fn find_index<T: PartialEq>(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<T: PartialEq>(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<Constraint> = vec![];
// let mut problem = ProblemVariables::new();
// let mut main_expression = Expression::default();
// let mut constraints: Vec<Constraint> = vec![];

// Build variables
// // Build variables

let mut variables = variables!();
// let mut variables = variables!();

let mut A: Vec<Vec<Vec<f64>>> = vec![];
// let mut A: Vec<Vec<Vec<f64>>> = 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<VariableDefinition>> = vec![];
let mut lambdas: Vec<Vec<VariableDefinition>> = vec![];
// Binary value, indicates tx or not for given pool
let mut eta: Vec<VariableDefinition> = vec![];
// let mut deltas: Vec<Vec<VariableDefinition>> = vec![];
// let mut lambdas: Vec<Vec<VariableDefinition>> = vec![];
// // Binary value, indicates tx or not for given pool
// let mut eta: Vec<VariableDefinition> = 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());
// }
// }

0 comments on commit de808ab

Please sign in to comment.