Hello Everyone,
I am working on a linear programming problem. I want to solve variables for the constraints.

The issue is I am able to get feasible values for all my variables from HiGHs for my problem, but these values tends= to be extreme, i.e. it tries to give me the lowerBound or upperBound as the solution. For my case out of 5273 variables, I am getting 3938 instances of lowerBound and 207 instances of upperBound. I would like to get as many evenly distributed values as possible(In a range of [1, 10000], instead of the values being (1, 10000) I would like to get (2343, 6542, etc)). The sum of variables is conserved also, changes to objective fuction can be made to achieve this outcome.
Below is the model description

Make sure that you are seeking a result that is theoretically possible. Whenever you add sum constraints or try to minimize the L1-norm of a vector variable, you tend to get sparse solutions. This is a theoretical result.

This result is widely used in statistics to â€śkillâ€ť the contribution of not-so-important variables, and only retain the most important ones. LASSO regression is an example.

HiGHS uses a simplex algorithm by default (I believe), and simplex returns so-called â€śbasicâ€ť solutions where, by design, several variables will be at their lower or upper bound.
In general, if you have m equality constraints and n variables, in a simplex solution, you will get m-n variables at their lower or upper bound.

To avoid this behavior in the returned solution, youâ€™ll need to break that intrinsic property of simplex.
I know of two ways:

use an interior-point algorithm and disable crossover. This will give better balanced solutions, if multiple optima exist. I do not know whether HiGHS supports doing that though

add a (small) quadratic term to the objective that penalizes the sum of the squared variables. This tends to produce solutions like what youâ€™re looking for, but it makes the problem quadratic. HiGHS should support it, but it may be slower

HiGHS cannot solve a mixed-integer problem with a quadratic objective. Use a solver like Gurobi.jl instead.

Can you provide a reproducible example for your problem? Solvers will find a solution. If you want a particular structure, like evenly spaced x values, then you should encode this as constraints or somehow specify it via the objective. If multiple solutions are possible, solvers provide very little control over which solution will be returned.

Sure. So to get a different solution you either need to add constraints, or you need to use a different objective value.

What type of solution do you want? One with â€śevenlyâ€ť spaced x? Maximize the minimim distance between two points? Away from bounds, so every value at 50?

Yes, So I want my variables to be away from bounds. Say I have x[1:20] variable with [0.01, 10] and along with other relevant constraint, one of the costraint will be sum(x) == 100. So, I would like my variables to be close to 5.
Now, one way I tried to a achieve this was by manually increasing the lb, and decreasing the hb for all variables, but this didnâ€™t gave me as good of a solution.