# How to solve two ODE differential equations, numerically, with four dependent boundary condition

I have two ODE differential equations(DE) and four dependent B.C. $$y_1''(x)=-\frac{1}{2} \left(x-y_1(x)\right)$$ $$y_2''(y)=-\frac{1}{4} \left(y-y_2(y)-5\right)$$ $$y_1(0)=y_2(1)$$ $$y_1(1)=y_2(0)$$ $$\frac{\text{dy}_1(0)}{\text{dx}}=\frac{\text{dy}_2(1)}{\text{dx}}$$ $$\frac{\text{dy}_1(1)}{\text{dx}}=\frac{\text{dy}_2(0)}{\text{dx}}$$ In order to solve them, I did the following:

By using DSolveValue[], I solved each of DEs. Obviously, each of the gives me two equation with two unknown(c[1] & c[2]). At the end, by using Solve[] and applying four dependent B.C, I found unknowns for each equation and there wasn't any problem. Following is what I explained.

odey1 = DSolveValue[y1''[x] == -((x - y1[x])/2), y1[x], x];
odey2 = DSolveValue[y2''[y] == -((y - y2[y] - 5)/4), y2[y],
y] /. {C[1] -> C[3], C[2] -> C[4]};

coef = Simplify[
Solve[(ode1 /. x -> 0) == (odey2 /. y -> 1) && (odey1 /.
y -> 1) == (odey2 /. y -> 0) && ((D[odey1, x]) /.
x -> l) == ((D[odey2, y]) /. y -> 0) && ((D[odey1, x]) /.
x -> 0) == ((D[odey2, y]) /. y -> 1), { C[1], C[2], C[3],
C[4]}]];

odey1 /. coef;
odey2 /. coef;


In my real case, DEs doesn't have any close form solution and I have to use NDSolveValue[] to solve DEs. Therefore, I cannot used aforementioned procedure for finding unknowns, because of having dependent B.C. I will appreciate, If somebody can help and make an example with aforementioned example(NDSolveValue[] instead of DSolveValue[]).

{xsol, ysol} =