JuliaIO / ProtoBuf.jl

Julia protobuf implementation
Other
205 stars 55 forks source link

Too many quotes in long strings #243

Closed dourouc05 closed 10 months ago

dourouc05 commented 10 months ago

When using ProtoBuf.jl on https://github.com/google/or-tools/blob/stable/ortools/bop/bop_parameters.proto, I'm hitting a nasty problem around the default value of the field default_solver_optimizer_sets: it's extremely long and split into multiple lines, but ProtoBuf.jl doesn't understand the various lines as a single string (which it should). Here is a part of the generated Julia code:

PB.default_values(::Type{BopParameters}) = (;max_time_in_seconds = Float64(Inf), max_deterministic_time = Float64(Inf), lp_max_deterministic_time = Float64(1.0), max_number_of_consecutive_failing_optimizer_calls = zero(Int32), relative_gap_limit = Float64(1e-4), max_num_decisions_in_ls = Int32(4), max_num_broken_constraints_in_ls = Int32(2147483647), log_search_progress = false, compute_estimated_impact = true, prune_search_tree = false, sort_constraints_by_num_terms = false, use_random_lns = true, random_seed = Int32(8), num_relaxed_vars = Int32(10), max_number_of_conflicts_in_random_lns = Int32(2500), num_random_lns_tries = Int32(1), max_number_of_backtracks_in_ls = Int64(100000000), use_lp_lns = true, use_sat_to_choose_lns_neighbourhood = true, max_number_of_conflicts_for_quick_check = Int32(10), use_symmetry = false, exploit_symmetry_in_sat_first_solution = false, max_number_of_conflicts_in_random_solution_generation = Int32(500), max_number_of_explored_assignments_per_try_in_ls = Int64(10000), use_transposition_table_in_ls = true, use_potential_one_flip_repairs_in_ls = false, use_learned_binary_clauses_in_lp = true, number_of_solvers = Int32(1), synchronization_type = var"BopParameters.ThreadSynchronizationType".NO_SYNCHRONIZATION, solver_optimizer_sets = Vector{BopSolverOptimizerSet}(), default_solver_optimizer_sets = "methods:{type:LOCAL_SEARCH }                       "methods:{type:RANDOM_FIRST_SOLUTION }              "methods:{type:LINEAR_RELAXATION }                  "methods:{type:LP_FIRST_SOLUTION }                  "methods:{type:OBJECTIVE_FIRST_SOLUTION }           "methods:{type:USER_GUIDED_FIRST_SOLUTION }         "methods:{type:RANDOM_CONSTRAINT_LNS_GUIDED_BY_LP } "methods:{type:RANDOM_VARIABLE_LNS_GUIDED_BY_LP }   "methods:{type:RELATION_GRAPH_LNS }                 "methods:{type:RELATION_GRAPH_LNS_GUIDED_BY_LP }    "methods:{type:RANDOM_CONSTRAINT_LNS }              "methods:{type:RANDOM_VARIABLE_LNS }                "methods:{type:SAT_CORE_BASED }                     "methods:{type:COMPLETE_LNS }                       ", use_lp_strong_branching = false, decomposer_num_variables_threshold = Int32(50), num_bop_solvers_used_by_decomposition = Int32(1), decomposed_problem_min_time_in_seconds = Float64(0.0), guided_sat_conflicts_chunk = Int32(1000), max_lp_solve_for_feasibility_problems = Int32(0))

I bet the best fix is in lex_quote.