* @brief Structs for HiGHS simplex solvers
*/
#ifndef SIMPLEX_SIMPLEXSTRUCT_H_
#define SIMPLEX_SIMPLEXSTRUCT_H_
#include <cstdint>
#include <vector>
#include "lp_data/HConst.h"
#include "simplex/SimplexConst.h"
struct SimplexBasis {
std::vector<HighsInt> basicIndex_;
std::vector<int8_t> nonbasicFlag_;
std::vector<int8_t> nonbasicMove_;
uint64_t hash;
HighsInt debug_id = -1;
HighsInt debug_update_count = -1;
std::string debug_origin_name = "";
void clear();
void setup(const HighsInt num_col, const HighsInt num_row);
};
struct HighsSimplexStatus {
bool initialised_for_new_lp = false;
bool is_dualized = false;
bool is_permuted = false;
bool initialised_for_solve = false;
bool has_basis = false;
bool has_ar_matrix = false;
bool has_nla = false;
bool has_dual_steepest_edge_weights = false;
bool has_invert =
false;
bool has_fresh_invert = false;
bool has_fresh_rebuild = false;
bool has_dual_objective_value =
false;
bool has_primal_objective_value =
false;
};
struct HighsSimplexInfo {
std::vector<double> workCost_;
std::vector<double> workDual_;
std::vector<double> workShift_;
std::vector<double> workLower_;
std::vector<double> workUpper_;
std::vector<double> workRange_;
std::vector<double> workValue_;
std::vector<double> workLowerShift_;
std::vector<double> workUpperShift_;
std::vector<double> baseLower_;
std::vector<double> baseUpper_;
std::vector<double> baseValue_;
std::vector<double> numTotRandomValue_;
std::vector<HighsInt> numTotPermutation_;
std::vector<HighsInt> numColPermutation_;
std::vector<HighsInt> devex_index_;
std::vector<HighsInt> index_chosen_;
std::vector<double> pivot_;
HighsInt phase1_backtracking_test_done = false;
HighsInt phase2_backtracking_test_done = false;
bool backtracking_ = false;
bool valid_backtracking_basis_ = false;
SimplexBasis backtracking_basis_;
HighsInt backtracking_basis_costs_shifted_;
HighsInt backtracking_basis_costs_perturbed_;
HighsInt backtracking_basis_bounds_shifted_;
HighsInt backtracking_basis_bounds_perturbed_;
std::vector<double> backtracking_basis_workShift_;
std::vector<double> backtracking_basis_workLowerShift_;
std::vector<double> backtracking_basis_workUpperShift_;
std::vector<double> backtracking_basis_edge_weight_;
HighsInt simplex_strategy;
HighsInt dual_edge_weight_strategy;
HighsInt primal_edge_weight_strategy;
HighsInt price_strategy;
double dual_simplex_cost_perturbation_multiplier;
double primal_simplex_phase1_cost_perturbation_multiplier = 1;
double primal_simplex_bound_perturbation_multiplier;
double factor_pivot_threshold;
HighsInt update_limit;
HighsInt control_iteration_count0;
double col_aq_density;
double row_ep_density;
double row_ap_density;
double row_DSE_density;
double col_steepest_edge_density;
double col_basic_feasibility_change_density;
double row_basic_feasibility_change_density;
double col_BFRT_density;
double primal_col_density;
double dual_col_density;
bool allow_dual_steepest_edge_to_devex_switch;
double dual_steepest_edge_weight_log_error_threshold;
double costly_DSE_frequency;
HighsInt num_costly_DSE_iteration;
double costly_DSE_measure;
double average_log_low_DSE_weight_error;
double average_log_high_DSE_weight_error;
bool run_quiet = false;
bool store_squared_primal_infeasibility = false;
bool report_simplex_inner_clock = false;
bool report_simplex_outer_clock = false;
bool report_simplex_phases_clock = false;
bool report_HFactor_clock = false;
bool analyse_lp = false;
bool analyse_iterations = false;
bool analyse_invert_form = false;
bool allow_cost_shifting = true;
bool allow_cost_perturbation = true;
bool allow_bound_perturbation = true;
bool costs_shifted = false;
bool costs_perturbed = false;
bool bounds_shifted = false;
bool bounds_perturbed = false;
HighsInt num_primal_infeasibilities = -1;
double max_primal_infeasibility;
double sum_primal_infeasibilities;
HighsInt num_dual_infeasibilities = -1;
double max_dual_infeasibility;
double sum_dual_infeasibilities;
HighsInt dual_phase1_iteration_count = 0;
HighsInt dual_phase2_iteration_count = 0;
HighsInt primal_phase1_iteration_count = 0;
HighsInt primal_phase2_iteration_count = 0;
HighsInt primal_bound_swap = 0;
HighsInt iteration_count0 = 0;
HighsInt dual_phase1_iteration_count0 = 0;
HighsInt dual_phase2_iteration_count0 = 0;
HighsInt primal_phase1_iteration_count0 = 0;
HighsInt primal_phase2_iteration_count0 = 0;
HighsInt primal_bound_swap0 = 0;
HighsInt min_concurrency = 1;
HighsInt num_concurrency = 1;
HighsInt max_concurrency = kSimplexConcurrencyLimit;
HighsInt multi_iteration = 0;
HighsInt update_count;
double dual_objective_value;
double primal_objective_value;
double updated_dual_objective_value;
double updated_primal_objective_value;
HighsInt num_basic_logicals;
};
struct HighsSimplexBadBasisChangeRecord {
bool taboo;
HighsInt row_out;
HighsInt variable_out;
HighsInt variable_in;
BadBasisChangeReason reason;
double save_value = 0.0;
};
struct HighsRayRecord {
HighsInt index;
HighsInt sign;
std::vector<double> value;
HighsRayRecord getRayRecord() const;
void setRayRecord(const HighsRayRecord& from_record);
void clear();
};
#endif